# noalign and \include

I have reduced my code to the following lines:

\documentclass[9pt,letterpaper,oneside]{amsart}
\usepackage{graphicx}
\usepackage[table, dvipsnames]{xcolor}
\usepackage{longtable}
\usepackage[top=0.2in, bottom=0in, left=1in, right=1in]{geometry}
\usepackage[labelformat=empty]{caption}
\begin{document}

\renewcommand*\rmdefault{ppl}
\textrm{%
\begin{table}[ht]
\centering
\caption{Blabla}
{\tiny
\begin{tabular}{llrrr}
\hline
\rowcolor[gray]{0.65} A & B & C & D & E \\
\hline
\emph{ }
\end{tabular}
}
\end{table}}
\end{document}


This code does exactly what I want, but when I replace the line

\rowcolor[gray]{0.65} A & B & C & D & E \\


(which resembles a bigger table) with

\include{TableTest}


where TableTest.tex only contains

\rowcolor[gray]{0.65} A & B & C & D & E \\


I get an error message:

! Misplaced \noalign.
\rowcolor ->\noalign
{\ifnum 0=}\fi \global \let \CT@do@color \CT@@do@color...
l.3 \rowcolor
[gray]{0.65} A & B & C & D &


I use R/Sweave and xtable to make this table, and a similar problem (+ solution) is found here. Only this solution (i.e. replace \input with \expandableinput) does not work for me! That is

\documentclass[9pt,letterpaper,oneside]{amsart}
\usepackage{graphicx}
\usepackage[table, dvipsnames]{xcolor}
\usepackage{longtable}
\usepackage[top=0.2in, bottom=0in, left=1in, right=1in]{geometry}
\usepackage[labelformat=empty]{caption}
\usepackage{booktabs}
\begin{document}

\renewcommand*\rmdefault{ppl}
\textrm{%
\begin{table}[ht]
\centering
\caption{Blabla}
{\tiny
\begin{tabular}{llrrr}
\hline
\expandableinput TableTest.tex
\hline
\emph{ }
\end{tabular}
}
\end{table}}
\end{document}


gives error message

! Undefined control sequence.

l.25       \end{table}}


Question: how can I overcome the problem of importing the table from TableTest.tex into the LaTeX code?

• You didn't copy the definition of expandableinput from the answer that you reference: \makeatletter\let\expandableinput\@@input\makeatother – David Carlisle Feb 25 '14 at 13:45
• Don't do \renewcommand{\rmdefault}{ppl}, but rather \usepackage{mathpazo} – egreg Feb 25 '14 at 13:47
• Please clarify: \input or \include? The title says \input, while the question says \include. – Martin Schröder Feb 25 '14 at 15:28
• You are right Martin. I have changed it. – Jaap Paap Feb 26 '14 at 10:40

You can not have non expandable commands before \rowcolor. Instead of \include (which always forces a page break and is unsuitable for use anywhere in a table) use the expandable input command as defined in the referenced question.
  \makeatletter\let\expandableinput\@@input\makeatother
`