
我正在使用該包sgame
來格式化普通形式的遊戲。這些遊戲通常figure
在equation
.我對標點符號的垂直間距有疑問。
這是我使用的程式碼:
\documentclass{article}
\usepackage{color}
\usepackage{sgame}
\gamemathtrue
\begin{document}
\begin{equation}
\begin{game}{3}{2}
& F & O \\
F & 2, 2 & 0, 1 \\
O & 0, 0 & 1, 3 \\
P & 0, 0 & 1, 3
\end{game}
.
\end{equation}
\end{document}
結果如下:
我喜歡方程式編號的對齊,但不喜歡週期的對齊。我希望句點與表格最後一行中的文字對齊。此距離是0.3\baselineskip
距底部水平線的距離,但不是與基線的固定距離。
這就是我所追求的:
答案1
\documentclass{article}
\usepackage{color}
\usepackage{sgame}
\gamemathtrue
\begin{document}
\begin{equation}
\begin{game}{3}{2}
& F & O \\
F & 2, 2 & 0, 1 \\
O & 0, 0 & 1, 3 \\
P & 0, 0 & 1, 3\rlap{\quad.}
\end{game}
\end{equation}
\end{document}
答案2
事實證明,底線並不是0.3\baselineskip
從比賽的底部開始的。該sgame
套件重新實現了數組結構,但有兩個主要區別:
文字在儲存格中居中,而不是基線位於 30%
數組周圍的規則可能會與文字發生衝突,它們似乎處於某種覆蓋狀態
以下解決方案處理這兩個差異,並在更改\gamestretch
和的值時起作用arrayrulewidth
。
\documentclass{article}
\usepackage{calc}
\usepackage{color}
\usepackage{sgamevar}
\newcommand{\punctuategame}[2]{%
\setbox0 = \hbox{#1}% box containing the whole game
\setbox1=\hbox{I}% box used to determined the height of text in a cell
\newlength{\vdisp}% vertical displacement of punctuation
\setlength{\vdisp}{-\dp0 - \arrayrulewidth + \gamestretch \baselineskip / 2 - \ht1 / 2}%
\newlength{\hdisp}% horizontal displacement of punctuation
\setlength{\hdisp}{0.5\arrayrulewidth}%
\mbox{#1}% placing the game
\raisebox{\vdisp}{\hspace{\hdisp}\mbox{#2}}}% placing punctuation
\begin{document}
\begin{equation}
\punctuategame{
\begin{game}{3}{2}
\> F \> O \\
F \> 2, 2 \> 0, 1 \\
O \> 0, 0 \> 1, 3 \\
P \> 0, 0 \> 1, 3
\end{game}
}{.}
\end{equation}
\end{document}