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'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?

share|improve this question
6  
Try \input instead of \include, see e.g. tex.stackexchange.com/questions/246/… –  Torbjørn T. Aug 14 '12 at 10:32
    
Wonderful! Thank you very much! I wish you had answered this, so I could have accepted it! –  Rasmus Aug 14 '12 at 13:36

1 Answer 1

up vote 3 down vote accepted

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?

share|improve this answer

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.