Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am using the package sgame to format normal form games. The games are commonly formatted inside a figure but I would like to use them in an equation. I am having a problem with the vertical spacing of punctuation.

Here is the code I use:

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

Here is the result: result

I like the alignment of the equation number but not of the period. I would like to have the period aligned with the text in the last row of the table. The distance is 0.3\baselineskip from the bottom horizontal line but it is not a fixed distance from the baseline.

This is what I am after: enter image description here

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

It turns out that the baseline was not 0.3\baselineskip from the bottom of the game. The sgame package reimplements the array structure with two major differences:

  1. the text is centered in the cell instead of having the baseline at 30%

  2. the rules around the array can collide with the text, they seem to be in a sort of overlay

The following solution deals with these two differences and work when changing the values of \gamestretch and 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}
share|improve this answer
add comment

enter image description here

\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}
share|improve this answer
    
Thanks, this does work in that case. However, I was trying to keep everything outside the game environment. I am trying to find a way to align something to the bottom of the previous box, this way the horizontal alignment will be better. –  Nicolas Dudebout Aug 17 '12 at 22:33
    
the actual bottom of the box or the baseline of the bottom row (which is where the above aligns the .)? The bottom row baseline is not available from outside the box without changing the package code quote a bit as it is basically array[c] not array[b] –  David Carlisle Aug 17 '12 at 23:01
    
I would like to align the bottom of a new box with the bottom of the game box. I know that the baseline of the bottom row is at 0.3\baselineskip from the bottom of the game box. –  Nicolas Dudebout Aug 17 '12 at 23:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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