2

I have a project with lots of large files that is not working correctly. It is to large to bugfix here, but perhaps I would know were to look If I learn the cause of some odd behavior in a simpler piece of code.

I have two files, a.tex and b.tex b.tex gets included in a.tex but the \clearpage is annoying and therefore 'relaxed'.

a.tex:

\documentclass{scrartcl}
\usepackage{import} 
\begin{document}
\begingroup
\let\clearpage\relax
\tableofcontents
\include{b}
\endgroup
\end{document}

b.tex (the vspace is to replace the effect of a large amount of text)

\section{Scalarfields}
\subsection{Child 1}
Test
\subsection{Child 2}
Test
\vspace{900pt}
\subsubsection{Childchild}

Now for some reason the Childchild subsubsection is not showing op in my toc. Any of you have a clue as to why not? I am using MikTeX with all packages installed and updated (a few days ago).

Edit: I heard a lot of comments saying the \include command needs the \clearpage, so relaxing it is a bad idea. If so I should indeed consider using \input. Is there is no way to have the separate aux files and something like the \includeonly for the input command? (didn't think so) Because that's the reason I am using \include

Fictional
  • 369

1 Answers1

7

If you want to input another file without a forced page break use

\input{b}

Redefining \clearpage to \relax is inherantly dangerous (it would be quite likely to make latex never terminate) but in particular here it breaks the \include mechanism completely.

David Carlisle
  • 757,742
  • ok, so I'd either learn to live with the pagebreak, or use \input and forget about the benefits of \include? – Fictional Jun 05 '13 at 21:01
  • @Fictional yes. – David Carlisle Jun 05 '13 at 21:02
  • I read somewhere about that the \include* from the newclude package does not use a \clearpage. It seems however like a backwards com­pat­i­bility thingy. Would it we 'wise' at all to use this package? – Fictional Jun 05 '13 at 21:14
  • @Fictional sorry can't comment on packages I haven't seen:-) – David Carlisle Jun 05 '13 at 21:18
  • @Fictional The package is not developed since November 1999 (and the author says it's under development). Maybe it works, maybe not. But I doubt that a scrartcl document benefits from \include. – egreg Jun 05 '13 at 21:32
  • @egreg Why whould a scrartcl not benefit from \includes then? – Fictional Jun 06 '13 at 08:04
  • This work with 1 input file, for me it doesn't work with 2 or more input files. Do you maybe know why? – Surb Jan 22 '19 at 11:27
  • @Surb don't ask a new question on a comment on an ancient answer, impossible to say. \input is more or less transparent, tex just acts as if the input text had been copied to that place. If it doesn't work, make a small example that shows the problem and ask a new question. – David Carlisle Jan 22 '19 at 11:43
  • @DavidCarlisle Sorry for asking new question in comment and thanks replying. While preparing the minimal example I found where was the mistake. There was a \stop in one of my files. – Surb Jan 22 '19 at 12:40
  • @Surb no harm done:-) – David Carlisle Jan 22 '19 at 13:24