2

I have the following piece of code using the memoir class from asudis:

\newcommand*{\pointsize}{12pt}
\documentclass[letterpaper,             % Use US letter-size paper
                       oneside,                 % No verso and recto differences
                       \pointsize]              % Uses the font size defined above
                       {memoir}
\usepackage{booktabs}
    
\usepackage{multirow}
\begin{document}    
\begin{table}
\begin{tabularx}{\textwidth}{@{} p{0.15\textwidth}p{0.15\textwidth}p{0.15\textwidth}p{0.2\textwidth}p{0.25\textwidth}@{}}
\toprule
Node name &
  Type &
  Conditional dependcy &
  States &
  Description \\ \midrule
Prior &
  \multirow{6}{*}{Initial ($t=0$)} &
  None &  11 states indicating score in the range {[}0-10{]} &
  A state of 0 denotes a student who scored a 0 in the pre-test while a state of 10 represents a student who scored 100\% in the pre-test \\ \cmidrule(r){1-1} \cmidrule(l){3-5} 
Knowledge0 &  & Prior &
  \multirow{10}{*}{True and False} &
  State of true denotes the possibility that the student has the required knowledge at timestep $t=0$ \\ \cmidrule(r){1-1} \cmidrule(lr){3-3} \cmidrule(l){5-5} 
Distractor00 & &
  \multirow{5}{*}{Knowledge0} &
 &
  \multirow{3}{*}{True denotes the evidence that the student has collected this distractor at timestep $t=0$} \\ \cmidrule(r){1-1}
Distractor01 & & & &
 \\ \cmidrule(r){1-1}
Distractor02 & & & &
 \\ \cmidrule(r){1-1} \cmidrule(l){5-5} 
Question0 & & & &
  True denotes the evidence that the student answered the quiz correctly at timestep $t=0$ \\ \cmidrule(r){1-2} \cmidrule(l){5-5} 
Knowledge1 &
  \multirow{5}{*}{Temporal ($t=1,2,3$)} & & &
  True denotes the possibility that the student has the required knowledge at timestep $t=1,2,3$ \\ \cmidrule(r){1-1} \cmidrule(lr){3-3} \cmidrule(l){5-5} 
Distractor10 & &
  \multirow{4}{*}{Knowledge1} & &
  \multirow{3}{*}{True denotes the evidence that the student has collected this distractor at timestep $t=1,2,3$} \\ \cmidrule(r){1-1}
Distractor11 & & & &
 \\ \cmidrule(r){1-1}
Distractor12 & & & &
 \\ \cmidrule(r){1-1} \cmidrule(l){5-5} 
Question1 & & & &
  True denotes the evidence that the student answered the quiz correctly at timestep $t=1,2,3$ \\ \bottomrule
\end{tabularx}
\end{table}
\end{document}

Which is rendering the table as follows. I have no idea why the text in the 3rd and 5th row of last column is not wrapping up like the rest of the rows above and below it.

Additionally, how do I make the 7th row 2nd column wrap like the others? enter image description here

18
  • 2
    not directly related but tabularx with no X column can not do anything useful, just use a normal tabular Feb 18, 2021 at 8:41
  • 1
    Your example generates errors, starting with ! Undefined control sequence.<argument> \pointsize Feb 18, 2021 at 8:44
  • 2
    yes of course you need to remove that argument as well (it is not being used in any case) , No sorry please supply a usable test file that produces the output you are asking about, do not make us guess what the code is that we have to correct. Feb 18, 2021 at 8:48
  • 1
    The code is still not compilable, at the least it's missing \begin{document} and \end{document}.
    – Skillmon
    Feb 18, 2021 at 8:51
  • 1
    The issue why there are no automatic linebreaks is because you're using \multirow.
    – Skillmon
    Feb 18, 2021 at 8:53

1 Answer 1

1

After making your document minimally compilable (e.g., by replacing the specious \pointsize option with 12pt), I determined that you (a) should get rid of all \multirow directives, (b) switch to a \small relative font size, and (c) reduce the value of \tabcolsep to 3pt (default: 6pt), and (d) reducing the widths of the first four rows and assigning the column type X to the final column in order to have a chance to make the table fit inside the text block.

That said, I can't figure out for the life of me what the various \cmidrule directives are supposed to accomplish. That's something for you to figure out.

enter image description here

\documentclass[letterpaper,             % Use US letter-size paper
               oneside,                 % No verso and recto differences
               12pt]                    % Use a specific font size
               {memoir}
\usepackage{booktabs,ragged2e,array}
\newcolumntype{P}[1]{>{\RaggedRight}p{#1}}
\newcolumntype{L}{>{\RaggedRight}X}

\begin{document}
\begin{table}
\small % switch to 11pt inside this 'table' env.
\setlength\tabcolsep{3pt} % default: 6pt

\begin{tabularx}{\textwidth}{@{} 
     P{0.12\textwidth}
     P{0.11\textwidth}
     P{0.13\textwidth}
     P{0.16\textwidth} 
     L   @{}} % use at least one column of (modified) type 'X'
\toprule
Node name &
  Type &
  Conditional dependcy &
  States &
  Description \\ 
\midrule
Prior &
  Initial ($t=0$) &
  None &  11 states indicating score in the range [0--10] &
  A state of 0 denotes a student who scored a 0 in the pre-test, while a state of 10 represents a student who scored 100\% in the pre-test \\ 
  \cmidrule(r){1-1} \cmidrule{3-5} 
Knowledge0 &  & Prior & True and False &
  State of true denotes the possibility that the student has the required knowledge at timestep $t=0$ \\ 
  \cmidrule(r){1-1} \cmidrule(r){3-3} \cmidrule{5-5} 
Distractor00 & &
  Knowledge0 & &
  True denotes the evidence that the student has collected this distractor at timestep $t=0$ \\ 
  \cmidrule(r){1-1}
Distractor01 & & & &
 \\ \cmidrule(r){1-1}
Distractor02 & & & &
 \\ \cmidrule(r){1-1} \cmidrule{5-5} 
Question0 & & & &
  True denotes the evidence that the student answered the quiz correctly at timestep $t=0$ \\ \cmidrule(r){1-2} \cmidrule{5-5} 
Knowledge1 &
  Temporal ($t=1,2,3$) & & &
  True denotes the possibility that the student has the required knowledge at timestep $t=1,2,3$ \\ 
  \cmidrule(r){1-1} \cmidrule(r){3-3} \cmidrule{5-5} 
Distractor10 & &
  Knowledge1 & &
  True denotes the evidence that the student has collected this distractor at timestep $t=1,2,3$ \\ 
  \cmidrule(r){1-1}
Distractor11 & & & &
 \\ \cmidrule(r){1-1}
Distractor12 & & & &
 \\ \cmidrule(r){1-1} \cmidrule{5-5} 
Question1 & & & &
  True denotes the evidence that the student answered the quiz correctly at timestep $t=1,2,3$ \\ 
\bottomrule
\end{tabularx}
\end{table}
\end{document}
10
  • How were you able to make this code work. it is giving me 51 errors if I just use this piece of code in a standalone tex file. one of them being \begin{document} command was found Feb 18, 2021 at 9:25
  • 1
    @vipin8169 it runs without error here. What is the first error you get (ignore later errors) Feb 18, 2021 at 9:27
  • 1
    Did you test the right file? The code you posted in the question was missing \begin{document} but Mico's answer has it on line 9 Feb 18, 2021 at 9:29
  • I pasted the Mico's answer in a single tex file and it gave me the error about missing begin>doc error among 51 errors. Feb 18, 2021 at 9:30
  • 2
    Try deleting your old aux file (clean project). Feb 18, 2021 at 22:13

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.