55

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?

Dean
  • 1,455
  • 5
  • 15
  • 19

2 Answers2

118

Use \input instead of \include.

Gonzalo Medina
  • 505,128
  • 1
    Is there an equivalent of \includeonly for \input? – MDescamps May 26 '21 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... – Manuel Popp Jul 15 '22 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.

  • 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 Nov 06 '23 at 19:41