2

In the following MWE, I use package arrayjobx to define a 2x3 array \RowPayoffs, where I assign each element its value by referencing its (row, column). Specifically, I define \RowPayoffs(i,j)={Rij}, for each (i,j): i \in {1,2}, j \in {1,2,3}. I then query what value is actually in each element.

\documentclass{article}
\usepackage{arrayjobx}
\newarray\RowPayoffs
\begin{document}
\RowPayoffs(1,1)={R11}
\RowPayoffs(1,2)={R12}
\RowPayoffs(1,3)={R13}
\RowPayoffs(2,1)={R21}
\RowPayoffs(2,2)={R22}
\RowPayoffs(2,3)={R23}
\noindent
\verb+\RowPayoffs(1,1) = +\RowPayoffs(1,1) \\
\verb+\RowPayoffs(1,2) = +\RowPayoffs(1,2) \\
\verb+\RowPayoffs(1,3) = +\RowPayoffs(1,3) \\
\verb+\RowPayoffs(2,1) = +\RowPayoffs(2,1) \\
\verb+\RowPayoffs(2,2) = +\RowPayoffs(2,2) \\
\verb+\RowPayoffs(2,3) = +\RowPayoffs(2,3)
\end{document}

This yields the following output:

enter image description here

My puzzle: When I query what value is in each \RowPayoffs(i,j), not all of them are correct. Specifically, \RowPayoffs(1,2)=R21 and \RowPayoffs(1,3)=R22.

Any ideas what's causing this serious problem? Or, alternatively, what is my severe misunderstanding of what the proper behavior should be?

In addition to the MWE here, I also tried this with \normalindextrue and \normalindexfalse, but it made no difference.

2

You have to set \dataheight:

\documentclass{article}
\usepackage{arrayjobx}
\newarray\RowPayoffs
\begin{document}
\RowPayoffs(1,1)={R11}
\RowPayoffs(1,2)={R12}
\RowPayoffs(1,3)={R13}
\RowPayoffs(2,1)={R21}
\RowPayoffs(2,2)={R22}
\RowPayoffs(2,3)={R23}

\noindent
\verb+\RowPayoffs(1,1) = +\RowPayoffs(1,1) \\
\verb+\RowPayoffs(1,2) = +\RowPayoffs(1,2) \\
\verb+\RowPayoffs(1,3) = +\RowPayoffs(1,3) \\
\verb+\RowPayoffs(2,1) = +\RowPayoffs(2,1) \\
\verb+\RowPayoffs(2,2) = +\RowPayoffs(2,2) \\
\verb+\RowPayoffs(2,3) = +\RowPayoffs(2,3)

\bigskip

\dataheight=3
\RowPayoffs(1,1)={R11}
\RowPayoffs(1,2)={R12}
\RowPayoffs(1,3)={R13}
\RowPayoffs(2,1)={R21}
\RowPayoffs(2,2)={R22}
\RowPayoffs(2,3)={R23}

\noindent
\verb+\RowPayoffs(1,1) = +\RowPayoffs(1,1) \\
\verb+\RowPayoffs(1,2) = +\RowPayoffs(1,2) \\
\verb+\RowPayoffs(1,3) = +\RowPayoffs(1,3) \\
\verb+\RowPayoffs(2,1) = +\RowPayoffs(2,1) \\
\verb+\RowPayoffs(2,2) = +\RowPayoffs(2,2) \\
\verb+\RowPayoffs(2,3) = +\RowPayoffs(2,3)

\end{document}

enter image description here

  • Thanks! This fixes it. I had seen that section of the manual but didn't appreciate that \normalindexfalse/\normalindextrue requires \dataheight. I was mislead by "The arrays can be mono or bi-dimensional and they are dynamically allocated (so we do not have to declare their dimension statically.)" I thought that specifying \dataheight in effect declares statically one of the dimensions. – Jim Ratliff Jul 13 '18 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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