0

How to fix it?

I lost any & or newline ?

The error:

! Extra alignment tab has been changed to \cr.
<recently read> \endtemplate 

l.16            h1 &
         h2 & h3 \\

The code:

\documentclass[a4paper,12pt]{article}
\usepackage[]{booktabs}         % to improve tables
\usepackage{tabularx}           % to add width in tables
\usepackage{ltxtable}           % to mixing tabularx + longtable
\usepackage{longtable}          % to permit big tables over pages
\usepackage{multirow}           % to set multirows in tables

\begin{document}
    \begin{longtable}{cXX}
        \label{tab:qualityCriteria} \\
    \caption{Criteria to qualify.} \\
    \toprule

        h1 & h2 & h3 \\

    \midrule
    \endhead

        c1 & c2 & c3 \\

        c4 & c5 & c6 \\

    \bottomrule

\end{longtable}
\end{document}
0

I couldn't understand what's happening with ltxtable and longtable, but I suggest loading ltablex which seems to have the same functionality (extending the capabilities of longtable to tabularx), and allows your code to work:

\documentclass[a4paper,12pt]{article}
\usepackage{booktabs} % to improve tables
\usepackage{ltablex} % to mixing tabularx + longtable
\usepackage{multirow} % to set multirows in tables

\begin{document}

\begin{table}[!htp]\keepXColumns
  \begin{tabularx}{0.5\linewidth}{cXX}
    \label{tab:qualityCriteria} \\
    \caption{Criteria to qualify.} \\
    \toprule
    h1 & h2 & h3 \\
    \midrule
    \endhead
    c1 & c2 & c3 \\
    c4 & c5 & c6 \\
    \bottomrule
  \end{tabularx}
\end{table}

\end{document}

enter image description here

  • The better answer. Maybe the table enviroment can be deleted and, only use the second enviroment, the tabularx... – paulolimac Jun 25 '15 at 0:49
  • Another point that resolve my question was this: the ltxtable package should be used with 2 different texs files where, first is the main, and the second is the table itself. AND the main tex should refers to the table by the command \LTXtable – paulolimac Jun 25 '15 at 0:52

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.