1

I use package longtable to make a table with some multirow. The lines about the multirow is as follows:

\documentclass{article}    
\usepackage{longtable}
\usepackage{caption}
\usepackage{chngcntr} 
\counterwithout{table}{section}
\begin{document}

\begin{longtable}{| p{0.05 \textwidth} | p{0.6 \textwidth} | p{0.1 \textwidth} | p{0.1 \textwidth} |}
\caption{\bf PS(V) 1.8c-12 vs PV 3.301-539} \label{appendix3} \\
\hline
   \multicolumn{1}{|c|}{\bf Steps}
      & \multicolumn{1}{c|}{\bf PS(V) 1.8c-12} 
         & \multicolumn{1}{c|}{\bf PV 3.301-539}
            & \multicolumn{1}{c|}{\bf PV 3.301-539} \\ 
      &  & \multicolumn{1}{c|}{\bf According to}
            & \multicolumn{1}{c|}{\bf According to} \\
      &  & \multicolumn{1}{c|}{\bf Gyaltsab}
            & \multicolumn{1}{c|}{\bf Kedrup}       \\
\hline\hline
\endfirsthead

   \multicolumn{4}{c}{{\bfseries \tablename\ \thetable{}: Outline of PS(V) 1.8c-12}} \\
\hline
   \multicolumn{1}{|c|}{\bf Steps}
      & \multicolumn{1}{c|}{\bf PS(V) 1.8c-12}
         & \multicolumn{1}{c|}{\bf PV 3.301-539}
            & \multicolumn{1}{c|}{\bf PV 3.301-539} \\
      &  & \multicolumn{1}{c|}{\bf According to}
            & \multicolumn{1}{c|}{\bf According to} \\
      &  & \multicolumn{1}{c|}{\bf Gyaltsab}
            & \multicolumn{1}{c|}{\bf Kedrup}       \\
\hline    
\endhead

\hline
   \multicolumn{4}{|r|}{{\tiny Continued on next page}} \\
\hline
\endfoot 

\hline \hline
\endlastfoot
   1111 & 222 & \multirow{2}{*}{multi row} & 4444 \\
\cline{1-2} \cline{4-4}
    111 & 222 &                            & 4444 \\
\hline
\end{longtable}
\end{document}

However, It turns out that a "2*" as the content in the cell, as follows.

enter image description here

Please tell me what's wrong with that.

closed as off-topic by egreg, Torbjørn T., user13907, lockstep, Mico Nov 27 '16 at 23:27

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    Please, make a complete example of code that we can play with. – egreg Oct 15 '16 at 17:50
  • @egreg the example is available. – King Chung Lo Oct 15 '16 at 18:06
  • 2
    Please, paste the code, select it and click on the {} button, rather than the one for block quotes. – egreg Oct 15 '16 at 18:14
  • 3
    The problem is simply that the line \usepackage{multirow} is missing in the preamble. And the problem is also that you don't check the log file for errors; there must be an error saying that \multirow is undefined. – gernot Oct 15 '16 at 18:42
  • 4
    I'm voting to close this question as off-topic because the issue is simply solved by adding \usepackage{multirow} – egreg Nov 27 '16 at 21:45
0

Basic problem of question is already solved with gernot comment above, so this answer focused on off-topic issues of question:

  • with makecell macro thead is simpler to define headers of columns
  • with proper calculation of column width the table width is accurate equal to text width

enter image description here

MWE:

\documentclass{article}
\usepackage{longtable, 
            makecell,   % <-- missed in question MWE, pointed in Gernot comment
            multirow}   % <-- added for columns headers
    \renewcommand\theadfont{\bfseries}
\usepackage{caption}
\usepackage{chngcntr}
\counterwithout{table}{section}

\usepackage{lipsum}

\begin{document}
\lipsum[2]
{\renewcommand\arraystretch{1.2}
    \begin{longtable}{| p{\dimexpr0.12\textwidth-2\tabcolsep-\arrayrulewidth\relax} 
                      | p{\dimexpr0.40\textwidth-2\tabcolsep-\arrayrulewidth\relax} 
                      | p{\dimexpr0.24\textwidth-2\tabcolsep-\arrayrulewidth\relax}  
                      | p{\dimexpr0.24\textwidth-2\tabcolsep-\arrayrulewidth\relax} |}
\caption{\bf PS(V) 1.8c-12 vs PV 3.301-539} 
    \label{appendix3}                                           \\
    \hline
\thead[b]{Steps}
    &   \thead[b]{PS(V) 1.8c-12}
         &  \thead[b]{PV 3.301-539\\ According to\\ Gyaltsab}    
            &   \thead[b]{PV 3.301-539\\ According to\\ Kedrup} \\
    \hline\hline
\endfirsthead
\caption{\bf PS(V) 1.8c-12 vs PV 3.301-539 (cont.)}            \\ % <--changed 
    \hline
\thead[b]{Steps}
    &   \thead[b]{PS(V) 1.8c-12}
         &  \thead[b]{PV 3.301-539\\ According to\\ Gyaltsab}
            &   \thead[b]{PV 3.301-539\\ According to\\ Kedrup} \\
    \hline
\endhead
    \hline
\multicolumn{4}{|r|}{\tiny Continued on next page}              \\
    \hline
\endfoot
    \hline \hline
\endlastfoot
% table contents
1111    &   222     &   \multirow{2}{=}{multi row}  &   4444    \\
    \cline{1-2} \cline{4-4}
111     &   222     &                               &   4444    \\
    \end{longtable}
}
\end{document}

In the case, that the text width is wider than considered in above MWE, you can accommodate column width accordingly.

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