Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a bizarre problem with a customised table wrapper in conjunction with booktabs and svn-multi. The MWE below illustrates the issue.

The wrapper myTable works fine if:

  • either booktabs is not used (comment \bottomrule)
  • or the options table,subgroups,groups of svn-multi are not activated

But if both are used, I get the error:

Misplaced \noalign.
\bottomrule ->\noalign 
                       {\ifnum 0=`}\fi \@aboverulesep =\aboverulesep \global...
\myTable{\input{tabletest.tex}}{4}{c}

To add to the confusion, if you just include all the information from the \myTable wrapper into the document and include the table content manually (and not via \input) everything works fine, with both booktabs and the svn-multi options.

Is something wrong with the \myTable command, or is that a bug in booktabs/svn-multi?

\documentclass{article}
\usepackage{booktabs}
\usepackage[%
    table,subgroups,groups% Either one this together with booktabs breaks my custom-table command
    ]{svn-multi}

\begin{filecontents}{tabletest.tex}
label 1 & label 2 & label 3 & label 4 \\
item 1  & item 2  & item 3  & item 4  \\ 
\end{filecontents}

\DeclareRobustCommand{\myTable}[3]{%
\begin{tabular}{l*{#2}{#3}}
#1%
\bottomrule%
\end{tabular}}%

\begin{document}

%This breaks if something from booktabs is included together with either one of the svn-multi options "table", "subgroups" or "groups" 
\myTable{\input{tabletest.tex}}{4}{c}

%This compiles fine although the content is identical to the one above.
\begin{tabular*}{\textwidth}{@{\hskip\tabcolsep\extracolsep\fill}l*{4}{c}}%
label 1 & label 2 & label 3 & label 4 \\
item 1  & item 2  & item 3  & item 4  \\ 
\bottomrule%
\end{tabular*}%

\end{document}
share|improve this question

1 Answer 1

up vote 2 down vote accepted

The problem here is \input inside a tabular (or similar). svn-multi does execute some code at the begin and end of every file, which is here executed in the first cell of the tabular. The error is caused because \bottomrule does not follow directly a \\, i.e. isn't at the begin of a cell, because some un-expandable code is inserted there by svn-multi with the used package options.

You can avoid this by using a different form of \input, i.e. use \input tabletest.tex (note the trailing space; .tex is optional) instead of \input{tabletest}. This uses the plain-TeX version of \input and bypasses the svn-multi code.

See also Cannot use \toprule when doing \input inside tabular — why? which is very much related.

share|improve this answer
    
Yes, that solves the issue, thanks. I guess this could be closed as a duplicate (although I did my best to find an answer yesterday...). –  Jörg Jun 26 '12 at 7:59

Your Answer

 
discard

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.