GeneralRandom numbers in tables

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
indridi
Posts: 4
Joined: Thu Sep 17, 2009 7:53 pm

Random numbers in tables

Post by indridi »

Hi,

I've been trying to create tables with random numbers (strategic form games) using lcg package. Creating random numbers in regular text doesn't seem to be a problem but in tables I run into troubles with the first number in each cell (each contains a pair) being the same in each column except the first one. I'm guessing there is something about the table environment that causes this but, well, any insights would be appreciated. Below is a somewhat lengthy minimal example.

Best,
Indridi

Code: Select all

\documentclass[a4paper]{article}
\usepackage{lcg}


\begin{document}
        \reinitrand[first=0, last=9, counter=die, quiet]
            \begin{center}
                    \begin{table}[H]
                  \begin{tabular}{cr|c|c|c|c|c|}
                 & \multicolumn{1}{c}{} & \multicolumn{5}{c}{Player 2}  \\
                 & \multicolumn{1}{c}{} & \multicolumn{1}{c}{x} &
                 \multicolumn{1}{c}{y} & \multicolumn{1}{c}{z} & \multicolumn{1}{c}{w} & \multicolumn{1}{c}{r}\\
                 \cline{3-7}
                 Player 1   & x   &
                 \rand\arabic{die},
                 \rand\arabic{die}
                 & \rand\arabic{die},
                 \rand\arabic{die}
                 & \rand\arabic{die},
                 \rand\arabic{die}
                 & \rand\arabic{die},
                 \rand\arabic{die}
                 & \rand\arabic{die},
                 \rand\arabic{die}\\
        \cline{3-7} & y    &
        \rand\arabic{die},
        \rand\arabic{die}
        & \rand\arabic{die},
        \rand\arabic{die} &
        \rand\arabic{die},
        \rand\arabic{die} &
        \rand\arabic{die},
        \rand\arabic{die}
        & \rand\arabic{die},
        \rand\arabic{die}\\
    \cline{3-7} & z    & \rand\arabic{die},
    \rand\arabic{die}    &
    \rand\arabic{die},
    \rand\arabic{die}
    & \rand\arabic{die},
    \rand\arabic{die} &
    \rand\arabic{die},
    \rand\arabic{die}
    & \rand\arabic{die},
    \rand\arabic{die}\\
    \cline{3-7} & w    & \rand\arabic{die},
    \rand\arabic{die}    &
    \rand\arabic{die},
    \rand\arabic{die}
    & \rand\arabic{die},
    \rand\arabic{die} &
    \rand\arabic{die},
    \rand\arabic{die}
    & \rand\arabic{die},
    \rand\arabic{die}\\
    \cline{3-7} & r    & \rand\arabic{die},
    \rand\arabic{die}    &
    \rand\arabic{die},
    \rand\arabic{die}
    & \rand\arabic{die},
    \rand\arabic{die} &
    \rand\arabic{die},
    \rand\arabic{die}
    & \rand\arabic{die},
    \rand\arabic{die}\\
    \cline{3-7}
                \end{tabular}
                \end{table}
            \end{center}
\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

Post Reply