xskak 圖旁邊的文字?

xskak 圖旁邊的文字?

命令\chessboardfromxskak.sty使用國際象棋字體中的字形組裝棋盤。這使我試著將解釋性文字放在黑板旁的頭痛。

第一個也是最明顯的嘗試是使用表格(實際上,我在一個表格中有多個圖表,其中有 3 個板和每行相關的文本,但現在最好只使用一個圖表。):

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

不幸的是,文字出現在第二列的基線上,看起來……嗯……就像狗屎一樣。我希望它能黏在圖表的頂部或居中。

IE:

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.

答案1

這與棋盤的建構方式完全無關。棋盤就像一個圖形,只是一個底部有基線的盒子,因此幾乎所有關於圖形與文字對齊的答案(參見例如如何將文字與圖像垂直居中在表格的同一行中) 也可以在這種情況下使用:您可以使用\raisebox或 例如 adjustmentbox:

\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}

相關內容