[Tex/LaTex] Using \include with in Tabular / Array

includetables

I'm doing graphics using PStricks, writing each figure in it's own sub-file.
I would like to order two of these figure vertically with a symbol in between.

To that end, I've tried using a tabular and arrays environments. This, however, produces and error, even when the sub-file is empty.

For PStricks, I compile using xelatex on Ubuntu.

A minimal working example is

\documentclass{beamer}
\begin{document}
\begin{frame}

\begin{tabular}{ccc}
\include{test} & b & c\tabularnewline
\end{tabular}

\end{frame}
\end{document}

Here, the error is produced at \end{frame}. test.tex is empty and is in the same folder as the main file.

Is there away to solve this problem?

Best Answer

Use \input{test} instead of \include{test}. The former gives the same as typing the contents of test.tex into your main file, while the latter inserts \clearpage before and after, as well as doing some trickery to write a separate .aux file for each included file.

\include is useful for e.g. the case where you divide a text into chapters, with one chapter in each file, but for cases such as this, where you want to put the code for a pstricks drawing in a separate file, \input should be used.

For more details see When should I use \input vs. \include?