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.
My convention card editor does not use the grbbridge macros (but certainly does leverage my experience from creating grbbridge.) You may, if you wish, put grbcce.sty in the same directory as grbbridge.
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':
- 1.0 - unusable experiments of mine, back as far as 2003.
- 2.0 - first public release, 23 November 2011.
- 2.1 - second public release, 20 August 2013. Minor enhancements to a few commands, and a new nonfloating numbered-hand feature
- 2.1.1 - 05 September 2013. Changed hand diagram so North and South hands always aligned vertically.
- 2.2 - third public release, 24 December 2013. Support for partial auctions and bidding problems, and some behind-the-scenes recoding.
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.)