TaigaBridge

"Play smarter, not harder"

You are here: Home > Trivia > LaTeX

Typesetting bridge articles with LaTeX

Like many other mathematicians and scientists, I've had reasons to use Donald Knuth's TeX document typesetting system at my "day job." I liked the way it looked, and wanted to use to produce equally nice-looking bridge lesson handouts and system notes.

If you aren't familiar with TeX and LaTeX, you can read an overview at The LaTeX project, or the (Not So) Short Introduction to LaTeX (PDF). I use the MiKTeX 2.9 LaTeX distribution, with the TeXnicCenter front end, but you can use grbbridge with any LaTeX installation.

After several false starts, I built a bridge typesetting package I was fairly happy with in the spring of 2011, and released it to the public in fall of 2011. I made a few modest enhancements in 2012 and 2013. "Someday" I will see about releasing the package properly on CTAN...

For a demonstration of grbbridge's features, see this PDF, made from this LaTeX source file. If you want to try it yourself, download grbbridge.sty and install it the same way you would any other package. (Save it in either the ~/tex/latex/grbbridge or ~/localtexmf/tex/latex/grbbridge folder, put usepackage{grbbridge} in your preamble, and away you go.) The package requires ifthen and xstring; most LaTeX installations will automatically download these additional packages if they are not already present.

Interested in customized help with LaTeX?

Do you need help formatting a manuscript in LaTeX, or want a custom package made for your typesetting needs (bridge-related or not?) That is one of the services I provide through my consulting business, Excelsior Statistics and Optimization. Your initial consultation about your project (or any quick questions you have about how to use grbbridge) is always free.

Version history of 'grbbridge':

LaTex and PBN

When I use LaTeX to prepare a handout for a live bridge lesson, I often also want a file containing the same hands, in a format that a Duplimate or PlayBridgeDealer4 machine can read. To do this, I have created two very primitive utilities, which you may use at your own risk:

PBNExtract scans a .tex file, and for every deal float that it finds, it reads the contents of the \north, \south, \east, and \west commands, and writes a .pbn file containing the deals. It does not read the dealer and vulnerability from the LaTeX, it just numbers the deals from 1 upwards. (This is because I make the handouts with South as declarer, but for the lesson, I rotate the boards so that students in each seat get their fair share of interesting decisions. I manually edit the PBN file to rotate the deals as I need to.)

PBNProof scans a .pbn file, and for every [Deal "X:blah blah blah"] line, it checks to make sure that each of the 52 spots is dealt to exactly one person. Very handy if, like me, you are prone to the occasional 14-card hand or garbling things when you turn all the "x"es into small spots.

Both are command-line tools. PBNExtract path/filename reads filename.tex and writes filename.pbn in the same directory. PBNProof path/filename.pbn displays either an OK message or an error message to the command window for each deal in the PBN file. You can download the executables here. Contact me if you're interested in the source code (both are short VB.NET programs.)

TeX trivia

TeX has been around since 1978, and is a very stable and robust system. Files I prepared while I was in college 20 years ago still compile on a modern installation with almost no modifications — try that with any Microsoft product!

Reflecting how stable TeX is, version numbers increase slowly: instead of progressing from 3.0 to 3.1 to 3.2 and then 4.0, the version number is now at 3.14159265. TeX's creator, Donald Knuth is still alive. He'll pay you a modest cash reward of $2.56 if you find a typo in one of his books. When he dies, the version number will become exactly π, "at which point all remaining bugs become features."

This page last edited 27.04.17