2

The \chessboard command from xskak.sty assembles the board using glyphs from a chess font. This causes me a ton of headaches trying put explanatory text next to a board.

The first and most obvious attempt was to use a table (actually I have multiple diagrams in a table with 3 boards and associated text per line, but it would be nice to get just one diagram to work for now.):

\documentclass{article}
\usepackage{xskak}
\begin{document}
{\centering
\begin{tabular}{l p{4cm}}
\chessboard[setfen=] &
White to move.  Mutual zugzwang.
\end{tabular}\par}
\end{document}

Unfortunately the text goes on the baseline in the second column and it looks... well... like shit. I would prefer to have it stick to the top of the diagram or be centred.

I.e.:

r n b q k b n r    Text should be 
p p p p p p p p    aligned like this
. . . . . . . .    in the final PDF.
. . . . . . . .                          Or centred
. . . . . . . .                          vertically.
. . . . . . . . 
P P P P P P P P 
R N B Q K B N R                                        It should
                                                       definitely not
                                                       be aligned with
                                                       the baseline of 
                                                       the diagram.
3

This has absolutly nothing to do with the way the chessboard is build. The chessboard is like e.g. a graphic simply a box with the baseline at the bottom and so allmost all answers concerning the alignment of graphics with text (see e.g. How to vertically center text with an image in the same row of a table) can be used in this case too: You can use \raisebox or e.g. adjustbox:

\documentclass{article}
\usepackage{xskak,adjustbox}
\begin{document}

\begin{tabular}{l p{4cm}}
\adjustbox{valign=c}{\chessboard[setfen=]} &
White to move.  Mutual zugzwang.
\end{tabular}
\end{document}
2
  • Thank you! It even worked with array.sty and >{\adjustbox{valign=c}\bgroup}l<{\egroup} so I didn't have to write it every line.
    – kahen
    Apr 24 '15 at 15:47
  • Even better: >{\adjustbox{valign=t,raise=\adjboxvtop}\bgroup}l<{\egroup} which makes the text aligned with the top of the diagram such that the baseline matches the line between the 7th and 8th ranks.
    – kahen
    Apr 25 '15 at 4:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.