2

I am seeking to create a math workbook that looks similar to the picture below. I have included a selection of code I am attempting to get working - marked as MWE.

My issue is that I want to continue a list that I have already begun - a list named: ptestlist. The problem I am having is that I am trying to use tabularx to form the Column A and Column B, along with the answer choices. I plan on resuming the list with resume=ptest for each subsequent table. It is crucial that the numbering is automatic so that any additions or subtractions from question numbers are recalculated.

My original thought was to simply input my ptestlist into a multirow cell and continue the table as normal, but I get an error.

enter image description here

MWE: (or at least my attempt)

\documentclass[letterpaper,twoside,openright]{memoir}
\usepackage{enumitem}
    \newlist{ptestlist}{enumerate}{2}
    \setlist[ptestlist]{label={\arabic*.},itemsep=5mm,labelsep=3mm,topsep=1cm}

\usepackage{multirow}
\usepackage{multicol}
\usepackage{tabularx}
    \newcolumntype{Y}{>{\centering\arraybackslash}X}

\begin{document}

\begin{center}
{\LARGE Part Two --- Quantitative Reasoning}
\end{center}

\textbf{Directions:} Choose the best answer from the four choices given.

\hrulefill
%-----------        Questions           --------------% 
\begin{multicols}{2}

\begin{tabularx}{\columnwidth}{YXX}

\multirow{2}{c}{
\begin{ptestlist}[series=ptest] 
    \item ?
\end{ptestlist} }
&
\underline{Column A}
& 
\underline{Column B} 
\\
&
$ 5 + 2 \times ( 4 + 3 )$
&
$19$
\\
\end{tabularx}
\end{multicols}
\end{document}

[UPDATE]

Ok. So I think I have answered my own question, but have run into another. This may require a new question post however - which I have asked here: Anchoring Table (Tabularx) from the Bottom of Table

First, the solution I discovered is rather simple. I just didn't think about it this way. See below. My new problem though is aligning the question number with the answer choices under "Column A" and "Column B" (as you can see in the image above). The question number is specifically aligned next to the answer choices, not the shapes in my MWE for example.

MWE (Solution):

\documentclass[letterpaper,twoside,openright]{memoir}
\usepackage[bmargin=1in]{geometry}
\setlength{\parindent}{0pt}

\usepackage{enumitem}
    \newlist{ptestlist}{enumerate}{2}
    \setlist[ptestlist]{label={\arabic*.},itemsep=5mm,labelsep=3mm,topsep=1cm}

\usepackage{multirow}
\usepackage{multicol}
\usepackage{tabularx}
    \newcolumntype{Y}{>{\centering\arraybackslash}X}

\usepackage{tikz}

\begin{document}

\begin{center}
{\LARGE Part One --- Word Problems}
\end{center}

\textbf{Directions:} Choose the best answer from the four choices given.

\hrulefill
%-----------        Questions           --------------% 
\setlength{\columnsep}{50pt}
\begin{multicols}{2}
\begin{ptestlist}[series=ptest,labelsep=0pt]
\item \begin{tabularx}{3in}{YY}
      \underline{Column A}
      &
      \underline{Column B}
      \\
      $6 + 4 - 5 \times 6$
      &
      34
      \\
      \end{tabularx}

\item \begin{tabularx}{3in}{YY}
      \multicolumn{2}{c}
      {
      \begin{tikzpicture}
      \draw (-1.85,0) node [rectangle,draw,minimum size=1in,
                            label=below:$2x$,label=right:$x$] (rsquare) {};
      \draw (1.75,0) node [rectangle,draw,minimum size=.8in,
                            label=below:$2y$,label=right:$y$] (lsquare) {};
      \end{tikzpicture}
      } \\
      \underline{Column A}
      &
      \underline{Column B}
      \\
      34
      &
      34
      \\
      \end{tabularx}

\item \begin{tabularx}{3in}{YY}
      \underline{Column A}
      &
      \underline{Column B}
      \\
      34
      &
      34
      \\
      \end{tabularx}

\item \begin{tabularx}{3in}{YY}
      \underline{Column A}
      &
      \underline{Column B}
      \\
      34
      &
      34
      \\
      \end{tabularx}
\end{ptestlist}

\end{multicols}
\end{document}
  • If you're just trying to typeset the document in two columns, you could use the multicol package. – ChrisS Mar 28 '14 at 4:35
1

Edit 3: The OP was hoping to get a running counter that would allow another user to input additional questions without messing with the overall code framework. Is this possible?

Yes, It is possible. This new solution will automatically do the numbering by save the counter to tmpc and then restore it to ptestlisti, as shown below

\newcounter{tmpc}                  % defined in the preamble

\begin{ptestlist}[series=ptest]
\setcounter{ptestlisti}{\thetmpc}  % -- restore to 
   \item ...
   \item ...
\end{ptestlist} 
\setcounter{tmpc}{\theptestlisti}  % -- save to tmpc

and the output looks like

enter image description here

Code

\documentclass[letterpaper,twoside,openright]{memoir}
\usepackage[paper size={25cm,25cm}]{geometry}
\usepackage{enumitem,tikz,lipsum}
\newlist{ptestlist}{enumerate}{2}
\setlist[ptestlist]{label={\arabic*.},itemsep=5mm,labelsep=3mm,
topsep=0cm,parsep=-0.5cm}

\usepackage{multirow}
\usepackage{multicol}
\usepackage{tabularx}
\renewcommand\tabularxcolumn[1]{m{#1}}
\newcolumntype{Y}{>{\raggedright\arraybackslash}m{0.1\columnwidth}}
\setlength{\columnsep}{20pt}
\setlength{\columnseprule}{1pt}

\newcommand{\extraspace}{
\vspace{10pt}
\rule{0.8\columnwidth}{1pt}
\vspace{10pt}
}

\newcounter{tmpc}

\begin{document}

\begin{center}
{\LARGE Part Two --- Quantitative Reasoning}
\end{center}

\textbf{Directions:} Choose the best answer from the four choices given.

\hrulefill
%-----------        Questions           --------------% 
\begin{multicols}{2}
\begin{center}
\begin{tikzpicture}
\draw[] (0,0) ellipse (2 and 1);
\end{tikzpicture} 
\end{center}

\begin{tabularx}{\columnwidth}{YXX}
\multirow{2}{1cm}{
\begin{ptestlist}[series=ptest]
   \item
\end{ptestlist} 
\setcounter{tmpc}{\theptestlisti}
}
&\underline{Column A}& \underline{Column B} \\
& $ 5 + 2 \times ( 4 + 3 )$& $19$\\
\end{tabularx} 

\extraspace

\begin{center}
\begin{tikzpicture}
\draw[] (0,0) rectangle (2,2);
\end{tikzpicture} 
\end{center}

\begin{tabularx}{\columnwidth}{YXX}
\multirow{2}{1cm}{
\begin{ptestlist}[series=ptest]
\setcounter{ptestlisti}{\thetmpc}
   \item
   \item
\end{ptestlist} 
\setcounter{tmpc}{\theptestlisti}
}
&\underline{Column A}& \underline{Column B} \\
& $ 5 + 2 \times ( 4 + 3 )$& $19$\\
& $ 5 + 2 \times ( 4 + 3 )$& $19$\\
\end{tabularx} 

\extraspace

\begin{tabularx}{\columnwidth}{YXX}
\multirow{2}{1cm}{
\begin{ptestlist}[series=ptest]
\setcounter{ptestlisti}{\thetmpc}
   \item
   \item
\end{ptestlist} 
\setcounter{tmpc}{\theptestlisti}
}
&\underline{Column A}& \underline{Column B} \\
& new insert \\
& new insert
\end{tabularx} 

\extraspace

\begin{center}
\begin{tikzpicture}
\draw[] (0,0) grid (2,2);
\end{tikzpicture} 
\end{center}

\vspace{10pt}

\begin{tabularx}{\columnwidth}{YXX}
\multirow{2}{1cm}{
\begin{ptestlist}
\setcounter{ptestlisti}{\thetmpc}
   \item
   \item
   \item
\end{ptestlist} 
\setcounter{tmpc}{\theptestlisti}
}
&\underline{Column A}& \underline{Column B} \\
& $ 5 + 2 \times ( 4 + 3 )$& $19$\\
& $ 5 + 2 \times ( 4 + 3 )$& $19$\\
& $ 5 + 2 \times ( 4 + 3 )$& $19$\\
\end{tabularx}

\extraspace

\begin{tabularx}{\columnwidth}{YXX}
\multirow{2}{1cm}{
\begin{ptestlist}
\setcounter{ptestlisti}{\thetmpc}
   \item
   \item
\end{ptestlist} 
\setcounter{tmpc}{\theptestlisti}
}
&\underline{Column A}& \underline{Column B} \\
& follow up\\
& follow up\\
\end{tabularx}

\extraspace

\lipsum[1-2]
\end{multicols}
\end{document}

The error is due to the c specifier. A length should be given because its contents is an environment.

\multirow{2}{c}{contents}

Edit: As mentioned in karlkoeller's remark below, adding another tabularx with a resumed ptestlist inside, the numbering will be wrong. However, after reading the manual again, the numbering problem can be solved by using command below because enumitem will generate the corresponding counter parallel to enumi which is called ptestlisti in this example.

\setcounter{ptestlisti}{3}   % will continue counting with 4

enter image description here

Edit 2: Make the solution close to what the OP has posted. The macro extraspace is to add the horizontal lines and padding space between questions/tabular environmnts.

Code

\documentclass[letterpaper,twoside,openright]{memoir}

\usepackage{enumitem,tikz,lipsum}

\newlist{ptestlist}{enumerate}{2}
\setlist[ptestlist]{label={\arabic*.},itemsep=5mm,labelsep=3mm,
topsep=0cm,parsep=-0.5cm}

\usepackage{multirow}
\usepackage{multicol}
\usepackage{tabularx}
\renewcommand\tabularxcolumn[1]{m{#1}}
\newcolumntype{Y}{>{\raggedright\arraybackslash}m{0.1\columnwidth}}
\setlength{\columnsep}{20pt}
\setlength{\columnseprule}{1pt}

\newcommand{\extraspace}{
\vspace{10pt}
\rule{0.8\columnwidth}{1pt}
\vspace{10pt}
}

\begin{document}

\begin{center}
{\LARGE Part Two --- Quantitative Reasoning}
\end{center}

\textbf{Directions:} Choose the best answer from the four choices given.

\hrulefill
%-----------        Questions           --------------% 
\begin{multicols}{2}

\extraspace

\begin{center}
\begin{tikzpicture}
\draw[] (0,0) ellipse (2 and 1);
\end{tikzpicture} 
\end{center}

\begin{tabularx}{\columnwidth}{YXX}
\multirow{2}{1cm}{
\begin{ptestlist}[series=ptest]
   \item
   \item
   \item
\end{ptestlist} 
}
&\underline{Column A}& \underline{Column B} \\
& $ 5 + 2 \times ( 4 + 3 )$& $19$\\
& $ 5 + 2 \times ( 4 + 3 )$& $19$\\
& $ 5 + 2 \times ( 4 + 3 )$& $19$\\
\end{tabularx} 

\extraspace

\begin{center}
\begin{tikzpicture}
\draw[] (0,0) rectangle (2,2);
\end{tikzpicture} 
\end{center}

\begin{tabularx}{\columnwidth}{YXX}
\multirow{2}{1cm}{
\begin{ptestlist}[series=ptest]
\setcounter{ptestlisti}{3}
   \item
   \item
   \item
\end{ptestlist} 
}
&\underline{Column A}& \underline{Column B} \\
& $ 5 + 2 \times ( 4 + 3 )$& $19$\\
& $ 5 + 2 \times ( 4 + 3 )$& $19$\\
& $ 5 + 2 \times ( 4 + 3 )$& $19$\\
\end{tabularx} 

\extraspace

\begin{center}
\begin{tikzpicture}
\draw[] (0,0) grid (2,2);
\end{tikzpicture} 
\end{center}

\vspace{10pt}

\begin{tabularx}{\columnwidth}{YXX}
\multirow{2}{1cm}{
\begin{ptestlist}
\setcounter{ptestlisti}{6}
   \item
   \item
   \item
\end{ptestlist} 
}
&\underline{Column A}& \underline{Column B} \\
& $ 5 + 2 \times ( 4 + 3 )$& $19$\\
& $ 5 + 2 \times ( 4 + 3 )$& $19$\\
& $ 5 + 2 \times ( 4 + 3 )$& $19$\\
\end{tabularx}

\extraspace

\lipsum[1-2]
\end{multicols}
\end{document}
  • If you add another tabularx with a resumed ptestlist inside, the numbering is wrong, anyway. – karlkoeller Mar 28 '14 at 10:07
  • @karlkoeller -- Thank you very much for the comment which prompts me to read the manual again and the notion of \setcounter{ptestlisti}{a number} will work. To you, I am deeply appreciated. – Jesse Mar 28 '14 at 11:29
  • With this solution I would have to reset the counter for each section of questions right? So if I were to add questions in, after the initial coding, I would have to go back and count manually to set the counters correctly? I was hoping to get a running counter that would allow another user to input additional questions without messing with the overall code framework. Is this possible? – Calhistorian Mar 28 '14 at 23:15
  • @Calhistorian -- Yes, it can be done. Please see my update. – Jesse Mar 29 '14 at 6:53

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.