数式内の表の垂直配置

数式内の表の垂直配置

私は、通常の形式のゲームをフォーマットするために パッケージを使用しています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パッケージは、2 つの大きな違いを伴って配列構造を再実装します。

  1. テキストはベースラインが30%ではなくセルの中央に配置されます

  2. 配列の周りのルールはテキストと衝突する可能性があり、一種のオーバーレイのように見える

\gamestretch次のソリューションは、これら 2 つの違いに対処し、およびの値を変更するときに機能します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}

関連情報