For presenting positions in the game of backgammon, there is a commercially developed, but free for personal use, without modifications, font called eXtremeGammon. The ttf font file is available from the eXtreme Gammon site ttf file. I was hoping to use this font for typesetting notes and references using LaTeX. I took the advice from the accepted answer to an earlier TeX Stackexchange post, Installing TTF fonts in LaTeX, on using ttf fonts in LaTeX by using XeTeX rather than LaTeX.

I have two problems with this approach:

1) Some characters in the font are not found by XeLaTeX, eg. digraphs and the £ character. The font does work with these characters outside TeX and the characters do appear with a symbol when studying the ttf file using FontForge. The following simple example outputs a pdf file from XeLaTeX, but containins only the symbol for the @-character.

ñ © @ £

The only thing I can understand as related in the log file is these lines:

Missing character: There is no ñ in font eXtreme Gammon/ICU!
Missing character: There is no © in font eXtreme Gammon/ICU!
Missing character: There is no £ in font eXtreme Gammon/ICU!

I tried using the tip from this earlier posting related to inputting characters to XeLaTeX Foreign characters in XeLaTeX, but it did not change anything for me.

2) The goal is to be able to typeset positions with end result as in this picture enter image description here

which is an image of how browsers render the font. The font works by individual characters being eg. a black disc on the middle fifth of a downward triangle with white background, a white disc on the lowest fifth of an upward triangle with lined background or eg. a part of the playing frame. In order to have the characters "connect" and not have holes in the resulting position I add \offinterlineskip. However, this still leaves very thin horizontal empty lines in the diagram after some lines. Here is a simple example that draws a downward white triangle using the font. The spacing is better but not quite right at all lines, even with \offinterlineskip

\offinterlineskip %% Still leaves thin vertical lines of empty space
                  %% after some lines. Problem in font itself ?

Here is image of the triangle in the pdf output with thin empty lines in two spots:

enter image description here

A last note is that the eg. the triangles does not look nearly as "sharp" as in a browser when it is rendered using a CSS sheet with @font-face, so perhaps this overall strategy on how to typeset these positions in TeX is flawed ?

UPDATE: Regarding part 1) I tried running Leo Liu's answer to Generating a table of glyphs with XeLaTeX and it turns out that only for values i in the range from 32 to 160 are there any for which \iffontchar\font\i is true despite there being more characters with symbols in the ttf font then the number of trues here. I haven't worked much with LaTeX and fonts but I am starting to think if this could be some sort of encoding problem ? The following post could be relevant Font has glyph but XeLaTeX reports "Missing character". How would I check the following from the last comment in that post: if this font is to old and doesn't use unicode ?

  • I added the image from the font website. Could you add the image from your code? As you don't have enough rep yet to do this, the right way is to upload via the image button and then remove just the ! from the automatically inserted code. Then another user can easily add the image. If you edit the code before you have enough rep to include images, you'll need to remove the !s from both image inclusions (as you'll need to do to add the second image since I've added the first - if I'd thought about it, I'd've waited before adding the first! Sorry!). Commented Mar 19, 2012 at 14:26
  • Not sure if I understand correctly: "Could you add the image from your code?". I could press the image button and input the URL for it and only when submitting the question the "Oops..." message appeared with the info about images and new users. Or you mean somehow add image from TeX code ? Commented Mar 19, 2012 at 14:37
  • @MichaelRas I have upvoted, please try again. You can ping the person you want to reply to by putting an @ character and typing the nickname of that particular user.
    – percusse
    Commented Mar 19, 2012 at 14:40
  • @percusse Thank you for info. I have added proper image now. Commented Mar 19, 2012 at 14:45
  • 1
    The link to the font doesn't seem to work.
    – Alan Munn
    Commented Mar 19, 2012 at 15:03

2 Answers 2


Since I like to play backgammon, this seemed like a useful thing to do. Here's an initial version of a backgammon display package. This is pretty rough, and I expect to update it, but it's pretty usable in its present state. Obviously it still needs some documentation, and there may be a few features missing.


The package described below is currently being developed and is not yet officially released. The latest version of the code can be obtained from GitHub. Comments welcome.


Put this in your local texmf folder:

% Copyright 2012 by Alan Munn
% This package may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
% This package has the LPPL maintenance status `maintained'.
% The Current Maintainer of this package is Alan Munn.
% This package consists of the file tikz-backgammon.sty and documentation files
% tikz-backgammon.tex and tikz-backgammon.pdf
% Version 0.5 2012/03/20
\ProvidesPackage{tikz-backgammon}[2012/03/20 Backgammon game display using TikZ v0.5]

% Construct the board
% alternating colours for the board
% construct a  down point
     (\x,0) -- (\x+3/2,15) -- (\x+3,0) -- cycle; }
% construct an up point
     (\x,32) -- (\x+3/2,17) -- (\x+3,32) -- cycle; }
% set basic tikzparameters     
                cube/.style={minimum size=.5cm}
% initialization
% These should be made internal or key values
\newcommand*{\black}{black} % for the stones
% initial state of the doubling cube
% create 24 counters for the point counts
% create 24 macros for the point state (black,white,none)
\foreach \x in {1,...,24}{
\expandafter\gdef\csname bk@state\x\endcsname{none}

% some debugging commands
\newcommand*\showpoint[1]{\the\csname c@bk@pt#1\endcsname}
\newcommand*\setstate[2]{\expandafter\gdef\csname bk@state#1\endcsname{#2}}
\newcommand*\usestate[1]{\csname bk@state#1\endcsname}

% basic command to draw the board
% all of these numbers probably shouldn't be hard coded
% draw the boarder and the point numbers
    \draw[line width=4pt] (0,0) -- (0,32) -- (38,32) -- (38,0) -- cycle;
    \foreach \x in {1,...,6}{
       \node[sans] (\x) at (39.5-\x*3,-1.5)  {\x};
        \node[sans] (\nodename) at (25.5-\x*3-6,-1.5)  {\nodename};
        \node[sans] (\nodename) at (39.5-\x*3,33.5)  {\nodename};
         \node[sans] (\nodename) at (25.5+\x*3-27,33.5)  {\nodename};
% now draw the first half points
  \foreach \x in {0,3,...,15}
  \foreach \x in {0,3,...,15}
% draw the bar and set the anchors for bar and the doubling cube
  \draw[very thick,fill=brown](18,0) -- (18,32) -- (20,32) -- (20,0) -- cycle;
  \node (barcenter) at (19,14) {};
  \node (black double) at (40, 2) {};
  \node (white double) at (40, 30) {};
  \node (neutral double) at (40,12.5) {};
% draw the other half of the points
  \foreach \x in {20,23,...,35}
  \foreach \x in {20,23,...,35}
% commands to place markers on a point and set its state
% these are used for setting the initial board and for users
% to make arbitrary board configurations
% placement is still a little off (some overlap)

% first for a black point
  \global\csname c@bk@pt#1\endcsname #2\relax
% check to see if we're on an up point or a down point
    \foreach \x in {1,...,#2}
       \node[fill=\black,style=stone,\pos=.5*\x-.45  of #1]  {};
% same again for a white point
  \global\csname c@bk@pt#1\endcsname #2\relax
     \foreach \x in {1,...,#2}
        \node[fill=\white,style=stone,\pos=.5*\x-.45  of #1]  {};
% now a generic version of the command for use in displaying the board
% this is really an internal command
         \foreach \x in {1,...,#2}
            \node[fill=\usestate{\ptname},style=stone,\pos=.5*\x-.45  of \ptname]  {};
% command to place pieces on the bar
     \foreach \x in {1,...,#2}
         \node[fill=\csname#1\endcsname,style=stone,above=.5*\x-.35 of barcenter)] {};
% user command to set a double
% syntax is \double{<owner>}{amount}
     {\gdef\doublestate{neutral double}}
        {\gdef\cubepos{below}\gdef\doublestate{white double}}
        {\gdef\cubepos{above}\gdef\doublestate{black double}}
% internal command to place the doubling cube in the correct place
   \node[draw,style=cube, \cubepos=.5cm of \doublestate %
  ,font={\bfseries\sffamily}] {\doublenum};}

% command to set a new game and display it  

% commands to move first black, then white  

    \advance\csname c@bk@pt#1\endcsname -1\relax
    \ifnumcomp{\the\csname c@bk@pt#1\endcsname}{=}{0}
        {\expandafter\gdef\csname bk@state#1\endcsname{none}}
        {\expandafter\gdef\csname bk@state#1\endcsname{black}}
    \ifnumcomp{#2}{=}{0}{}{\advance\csname c@bk@pt#2\endcsname 1\relax}
    \expandafter\gdef\csname bk@state#2\endcsname{black}
    \advance\csname c@bk@pt#3\endcsname -1\relax
    \ifnumcomp{\the\csname c@bk@pt#3\endcsname}{=}{0}
        {\expandafter\gdef\csname bk@state#1\endcsname{none}}
        {\expandafter\gdef\csname bk@state#3\endcsname{black}}
    \ifnumcomp{#4}{=}{0}{}{\advance\csname c@bk@pt#4\endcsname 1\relax}
    \expandafter\gdef\csname bk@state#4\endcsname{black}

    \advance\csname c@bk@pt#1\endcsname -1\relax
    \ifnumcomp{\the\csname c@bk@pt#1\endcsname}{=}{0}
        {\expandafter\gdef\csname bk@state#1\endcsname{none}}
        {\expandafter\gdef\csname bk@state#1\endcsname{white}}
    \ifnumcomp{#2}{=}{0}{}{\advance\csname c@bk@pt#2\endcsname 1\relax}
    \expandafter\gdef\csname bk@state#2\endcsname{white}
    \advance\csname c@bk@pt#3\endcsname -1\relax
    \ifnumcomp{\the\csname c@bk@pt#3\endcsname}{=}{0}
        {\expandafter\gdef\csname bk@state#1\endcsname{none}}
        {\expandafter\gdef\csname bk@state#3\endcsname{white}}
    \ifnumcomp{#4}{=}{0}{}{\advance\csname c@bk@pt#4\endcsname 1\relax}
    \expandafter\gdef\csname bk@state#4\endcsname{white}

% command to display the current state of the board
        \foreach \x in {1,...,24}{
            \placepoint{\x}{\the\csname c@bk@pt\x\endcsname}}
% Still to be added:
% Displaying the dice (easy, but I can't be bothered)

Sample document

% This is a test document for the tikz-backgammon package.


output of sample document

  • That is impressive. Very nice to get a super tutorial on TeX and tikz coding by reading your code. This is so good I feel I should mark this as the answer despite it not technically being an answer to the original question. Will keep this open for 24 hours and if nothing ttf specific shows up, I will close, if it is not considered too bad Stack Exchange form :) Commented Mar 20, 2012 at 8:31
  • 1
    Amazing code, Alan! I wish I could upvote your answer ten times. :) Commented Mar 20, 2012 at 10:35
  • @MichaelRas Yes, I know it's not an answer to your question. I messed around with the font and then decided that any system using it would be close to unusable, hence this alternative. (But don't feel obliged to accept the answer unless you decide this is effectively a better solution for your larger problem.)
    – Alan Munn
    Commented Mar 20, 2012 at 12:03
  • @AlanMunn Ok, and I am happy you messed around. Learning a lot from the code. Similar to FEN notation for chess, there are standard ways of encoding backgammon positions. Programs and some people store positions using these encodings. I am using the font on the web with a small tool that translates encodings to the text for the position in the given ttf font and my first thought was to do the same in TeX. Definitely the right way to go in general is a package. I know that the LaTeX using part of the backgammon community have been looking for a package like yours before. Commented Mar 20, 2012 at 14:01
  • @MichaelRas If you have suggestions for the syntax let me know. (You can find the code on GitHub or email me). Also if there are features that are missing. I didn't include anything for the dice roll, for example, but that wouldn't be hard to do. Since I just play backgammon for fun, I don't have much sense of the notation.
    – Alan Munn
    Commented Mar 20, 2012 at 14:06

I know it's been a while, and this question has even resulted in a new package, which is amazing ;) However, I just stumbled upon this question and managed to create a beautiful board with the extremegammon font. One needs the fancyvrb package, which lets you define a new verbatim environment (board) which is basically verbatim without any line height (taken from xelatex — remove line spacing in verbatim environment). Then, you have to set the mono font to the one offered by extreme gammon (I put the font into ~/.fonts and ran fc-cache). The whole thing gets compiled with lualatex, I'm currently using the version that comes with TeXLive 2019. The example board is taken from the website (I added rolls by just using simple numbers for the dice), but you can export a position from extreme gammon into the font.

% from the fontspec documentation, chp. 4.2: Specifically choosing the NFSS family
\newfontfamily\verbatimfont[NFSSFamily=myverbatimfont]{eXtreme Gammon}
% create a new verbatim environment that uses the gammon font (with its new name)
'ð      @ @ 3  1 ð
 ðejejej@ @ejejejð
 ðxididi@ @dididið
 ðwhchmh@ @mhchchð
 ðvgbglg@ @lglgb{ð
 ðupapkf@ @kfkfazð

Here's how it looks:

Board rendered with the eXtreme Gammon font

  • +1 for actually answering the question. :) The input here leaves a lot to be desired but I guess you could write Lua code to map move notation into boards.
    – Alan Munn
    Commented Aug 3, 2020 at 13:01
  • Thanks ;) I'm not sure if I really understand, but if you want to see which move is best in this situation or has been made in a game, you could just add it as text and layout in latex.
    – drm
    Commented Aug 3, 2020 at 16:58
  • All I meant was that inputting all of those characters to generate a board doesn't seem particularly user-friendly (just an observation, not a criticism).
    – Alan Munn
    Commented Aug 3, 2020 at 17:00
  • 1
    Ah, now I get it ;) You can export any position from eXtreme Gammon (the software) directly into the font (along with an analysis table for the best moves). It would be cool to directly translate a XGID or GnuBG-ID into a position as font, much like on fishbust.com/diagram, but then you would miss the analysis of course.
    – drm
    Commented Aug 3, 2020 at 17:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .