TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to show linenumbers for tables using lineno, i.e. edtable. The table is set using threeparttable and linenumbers work fine, but compilation fails when including a caption. The error message shown is you can't use \hrule here except with leaders. I use the caption package, but compilation also fails when using KOMA captions. The MWE illustrates the issue.



% That's the definition of caption@hrule from caption3.sty
% Redefine something here?
% \makeatletter
% \renewcommand*\caption@hrule{\hrule\@height\z@}
% \makeatother


\caption{A simple table}
                          & \multicolumn{1}{c}{(1)}   & \multicolumn{1}{c}{(2)}   & \multicolumn{1}{c}{(3)}   \\
Variable 1                &  1.85                     & 0.92                      & 1.11                      \\
                          & (0.34)                    & (0.24)                    & (0.14)                    \\

share|improve this question
Never an easy question? ;-) – egreg Dec 2 '12 at 16:45
@egreg Sorry ;-). Brilliant answer, as usual. – Jörg Dec 2 '12 at 17:09
up vote 3 down vote accepted

After some headaches:






\caption{A simple table}
           & \multicolumn{1}{c}{(1)} & \multicolumn{1}{c}{(2)} & \multicolumn{1}{c}{(3)} \\
Variable 1 &  1.85\tnote{1}          & 0.92                    & 1.11                    \\
           & (0.34)                  & (0.24)                  & (0.14)                  \\
\item[1] A note

  1. The edtable environment should be made known to threeparttable;

  2. however we can't pass it to the hooks, because edtable has an optional argument, so I use a "wrapper" for it;

  3. the command \resetlinenumber is not allowed in threeparttable, so I hide it in the new environment;

  4. a \@centercr emitted by edtable causes the infamous "Perhaps a missing \item" error, so I neutralize it;

  5. the \threeparttable environment is patched to made the etabular environment known to it (see this answer).

Similar patches are made for the etabular* environment that internally calls \begin{edtable}{tabular*}. One has to use \TPT@hookarg instead of \TPT@hookin, in this case, like for tabular*.

enter image description here

share|improve this answer
If anyone else wants to use this: As noted in the edtable style file, lineno does not support "sub"-linenumbers. This means that if you reset the linenumber for tables as in the answer above, the linenumber of the document will be reset as well from where the table is included. I solved this by creating a second set of lineno.sty and edtable.sty where all the relevant macros have new names. It works, but is not a very pretty solution. – Jörg Dec 5 '12 at 13:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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