How to have no pagebreak after \include in LaTeX

前端 未结 4 1361
星月不相逢
星月不相逢 2020-12-12 12:42

My LaTeX makes me pagebreaks after each subsection because my subsections are in separate files. I use the command \\include{file} which adds a pagebreak after

4条回答
  •  悲哀的现实
    2020-12-12 13:36

    You can stop pagebreaks caused by \include by placing \let\clearpage\relax before it. So,

    \let\clearpage\relax
    \include{file1}
    \include{file2}
    \include{file3}
    

    would put the contents of the three files (and any subsequently included files) together without a pagebreak between them. If you want to stop relaxing the \clearpage command, then wrap the files to include without pagebreaks within a group like this:

    \begingroup
    \let\clearpage\relax
    \include{file1}
    \include{file2}
    \endgroup
    \include{file3}
    

    This will stop a pagebreak between file1 and file2, but insert the normal pagebreak after file2. (Note: I do not know if this interferes with referencing and page numbering, though I imagine it should be OK.)

提交回复
热议问题