[Tex/LaTex] Error in a long table : overfull\hbox

errorslongtable

I have made a long table, somehow it showed an error in the line where has a very short content (ShoL & shoulder left\).

I have checked similar questions from this forum. I can´t use tabularx under longtable environment, is that true? If yes, where should I put \begin{tabularx}? I have tried to put \begin{tabularx} after \begin{longtable} before \caption, with \usepackage:tabularx in preamble of course, but it turned out just more errors.

I have also tried the solution with \begin{sloppypar} \end{sloppypar}, also didn´t work.

The current error msg is:

! Undefined control sequence.
<argument> ...ibnameprefix {of}\isdot \ifprefchar
{} {} {\ifuseprefix {\bibn...
l.168

The control sequence at the end of the top line
of your error message was never `\def`'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
Overfull `\hbox` (81.02432pt too wide) in paragraph at lines 168--168

    \T1/lmr/m/n/12 (-20) [Ac-cessed on Septem-ber 20, 2016], Avail-able on : http:/
/www.sunyem.com/simulation/overview/.

My script is under, in order to present a short script, I have delete many lines from the table, so now it´s not that long :

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{array, booktabs, caption}
\usepackage{multicol}
\usepackage{multirow}
\usepackage{longtable}
\setlength{\tabcolsep}{10pt}
\renewcommand{\arraystretch}{1.5}

\begin{document}
\begin{longtable}{ll}
\caption{List}
\label{tab:Ch2VCOB}\\
\hline
\multicolumn{2}{l}{Components:} 
\endfirsthead

\multicolumn{2}{c}%
{{\tablename\ \thetable{} continued from previous page}} \\
\hline \multicolumn{1}{l}{}  
\endhead

\hline \hline
\endlastfoot
\multicolumn{1}{l}{Joints <joi>} 
\tabularnewline
Free    &       free - joint beween inertial and midhip\\
Navl    &       navel - joint between lower and middle\\& trunk\\
Subs    &       substernal - joint between middle and upper \\
        &       trunk\\
Cerv    &       cervicular - joint between neck and upper \\&trunk\\
Atls    &       atlas - joint between head and neck\\
ShoR    &       shoulder right\\
ElbR    &       elbow right\\
WriR    &       wrist right\\
ShoL    &       shoulder left\\
ElbL    &       elbow left\\
WriL    &       wrist left\\
HipR    &       hip right\\
KneR    &       knee right\\
AnkR    &       ankle right\\
HipL    &       hip left\\
KneL    &       knee left\\
AnkL    &       ankle left\\
\end{longtable}
\end{document}

Thank you in advance

Best Answer

Try

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{caption}
\usepackage{multicol}
\usepackage{array, booktabs, multirow, longtable}
\usepackage{ltablex} %  <-- added (as suggested by Bernard in his comment)
\keepXColumns
\setlength{\tabcolsep}{10pt}
\renewcommand{\arraystretch}{1.5}

\usepackage{lipsum} % <-- added for dummy text

\begin{document}

\begin{tabularx}{\textwidth}{lX} %  <-- changed from \begin{longtable}
    \caption{List}
\label{tab:Ch2VCOB}\\
    \toprule
\multicolumn{2}{l}{Components:}
\endfirsthead

\caption{continued from previous page} \\
    \toprule
\endhead

\bottomrule
    \endlastfoot
\multicolumn{1}{l}{Joints <joi>}
\tabularnewline
Free    &       free - joint beween inertial and midhip\\
Navl    &       navel - joint between lower and middle trunk\\
Subs    &       substernal - joint between middle and upper trunk\\
Cerv    &       cervicular - joint between neck and upper trunk\\
Atls    &       atlas - joint between head and neck\\
ShoR    &       shoulder right\\
    test    &   \lipsum[1]  \\  % added for test if long table works
ElbR    &       elbow right\\
WriR    &       wrist right\\
ShoL    &       shoulder left\\
ElbL    &       elbow left\\
WriL    &       wrist left\\
HipR    &       hip right\\
KneR    &       knee right\\
AnkR    &       ankle right\\
HipL    &       hip left\\
KneL    &       knee left\\
AnkL    &       ankle left\\
\end{tabularx}  %  <-- changed
\end{document}

enter image description here

For final table form you need to compile table twice.

Edit: Many people prefer ltxtable instead of ltablex because the later turns all tabularx tables environment to longtable. For use of ltablex see David Carlisle answer here.

Related Question