56

Possible Duplicate:
Page break with \include

I have got my LaTeX documents split in to several files, but when I input them in to my main document it starts the content on a new page. How can I stop this from happening? Here is what's going on:
outputFromLatex

In my separate files I start each with:

\subsubsection{Sub-Sub-Section Title}

And in my main document i'm inputting the files by saying:

\include{resonantCircuits}

Is there anyway I can get it to continue on the same page instead of having this page break?

6
  • 5
    The title says \input, but the question body says \include? Commented Nov 25, 2011 at 19:21
  • Sorry I was originally using \input then tried \include and I had just copied and pasted from my document. I have changed it now.
    – Dean
    Commented Nov 25, 2011 at 19:24
  • 2
    And it typesets correctly. This question is redundant now.
    – Dean
    Commented Nov 25, 2011 at 19:28
  • 3
    On an un-related note, a lot of folks put Table captions above the table, and avoid vertical lines. Have a look at the booktabs documentation for more details
    – cmhughes
    Commented Nov 25, 2011 at 20:11
  • 1
    I have changed the question so that it states \include instead of \input. Otherwise it won't make any sense. I did this because future visitors to this question (with a similar problem) won't understand it otherwise.
    – topskip
    Commented Nov 25, 2011 at 21:22

2 Answers 2

120

Use \input instead of \include.

2
  • 1
    Is there an equivalent of \includeonly for \input?
    – MDescamps
    Commented May 26, 2021 at 23:55
  • I just switched from \input to \include in order to be able to remove all figures from a manuscript before compiling it via Pandoc to create a .docx without images in the text. Now some images appear like [!p] despite other options are set and it was not this way with \include. However, I'd like the functionality of excluding them in the preamble... Commented Jul 15, 2022 at 11:19
3

If you really want this, you can try with:

\makeatletter
\def\@include#1 {%
%  \clearpage % This was removed from latex.ltx definition
  \if@filesw
    \immediate\write\@mainaux{\string\@input{#1.aux}}%
  \fi
  \@tempswatrue
  \if@partsw
    \@tempswafalse
    \edef\reserved@b{#1}%
    \@for\reserved@a:=\@partlist\do
      {\ifx\reserved@a\reserved@b\@tempswatrue\fi}%
  \fi
  \if@tempswa
    \let\@auxout\@partaux
    \if@filesw
      \immediate\openout\@partaux #1.aux
      \immediate\write\@partaux{\relax}%
    \fi
    \@input@{#1.tex}%
    \clearpage
    \@writeckpt{#1}%
    \if@filesw
      \immediate\closeout\@partaux
    \fi
  \else
    \deadcycles\z@
    \@nameuse{cp@#1}%
  \fi
  \let\@auxout\@mainaux}
\makeatother

However, this will cause problems because the page numbers will probably be wrong when \includeonly-ing some parts of the document.

I wouldn't do that, and stick to \input.

1
  • It is so ugly that it works 10 years later, copied from /usr/share/texlive/texmf-dist/tex/latex/base/latex.ltx. Thank you @jean-christophe-dubacq!
    – Tinmarino
    Commented Nov 6, 2023 at 19:41

Not the answer you're looking for? Browse other questions tagged .