方程式中表格的垂直對齊

方程式中表格的垂直對齊

我正在使用該包sgame來格式化普通形式的遊戲。這些遊戲通常figureequation.我對標點符號的垂直間距有疑問。

這是我使用的程式碼:

\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套件重新實現了數組結構,但有兩個主要區別:

  1. 文字在儲存格中居中,而不是基線位於 30%

  2. 數組周圍的規則可能會與文字發生衝突,它們似乎處於某種覆蓋狀態

以下解決方案處理這兩個差異,並在更改\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}

相關內容