Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include a file in LaTeX wihout causing a newpage

I hope, this question is not too offtopic.

I have a bigger school project which involves some documentation. The documentation is a LaTeX file, and looks like this:

...
some explanation

\section {someCode}
\include{someCode.hs}
some explanation
...

The files someCode.hs.tex are auto-genereated from their corresponding .hs-Files using Pygments and a Makefile.

The Problem is: Each time, I include something, a pagebreak is inserted before. This is neither expected nor wanted. I googled, but found no answer. Any ideas?

like image 997
fuz Avatar asked Oct 03 '10 06:10

fuz


People also ask

How do you stop page breaks in LaTeX?

\nopagebreak. The \nopagebreak command prevents LaTeX form breaking the current page at the point of the command. With the optional argument, number, you can convert the \nopagebreak command from a demand to a request. The number must be a number from 0 to 4.

How do I insert one file into another in LaTeX?

The standard tools to insert a LaTeX file into another are \input and \include . Use this command in the document body to insert the contents of another file named filename. tex ; this file should not contain any LaTeX preamble code (i.e. no \documentclass , \begin{document} or \end{document} ).

What is the difference between input and include LaTeX?

\input is a more lower level macro which simply inputs the content of the given file like it was copy&pasted there manually. \include handles the file content as a logical unit of its own (like e.g. a chapter) and enables you to only include specific files using \includeonly{filename,filename2,...} to save times.


1 Answers

Use \input instead of \include.

like image 84
emrea Avatar answered Oct 05 '22 17:10

emrea