[comp.text.tex] \include with no \clearpage

mwg@cs.toronto.edu (Mark Giesbrecht) (11/27/90)

Does anyone out there have an \include macro which does not do
a \clearpage before the included file?  Simply removing the \clearpage's
in the standard definition of \include (actually \@include)
in latex.tex seems to cause errors when using \label and \ref.  
For instance, with this obvious (stupid?) approach, including a single file
with a \label{a} and a \ref{a} in it results in some macros being printed
out on the screen and the reference always being undefined. 
I'd like to know why this happens, but all I really want is a solution
to the original problem.  Thanks in advance, Mark

eijkhout@s41.csrd.uiuc.edu (Victor Eijkhout) (11/28/90)

mwg@cs.toronto.edu (Mark Giesbrecht) writes:

>Does anyone out there have an \include macro which does not do
>a \clearpage before the included file?  Simply removing the \clearpage's
If you can live with the fact that you can't \includeonly,
and that there is separate .aux file, you can just use
the primitive \input command of pure TeX. \include is an ingenious
sugarcoating of it.

>in the standard definition of \include (actually \@include)
>in latex.tex seems to cause errors when using \label and \ref.  
>For instance, with this obvious (stupid?) approach, including a single file
>with a \label{a} and a \ref{a} in it results in some macros being printed
>out on the screen and the reference always being undefined. 
This is probably because of the final \clearpage that you remove.
The labels have to be written to the .aux file during the output routine,
which is invoked when you \clearpage. If you remove that, the
.aux file for the \include-d file is closed before the labels
are written. Lacking a valid output stream, TeX just writes
the labels to your screen (and log file).

>I'd like to know why this happens, but all I really want is a solution
>to the original problem.  Thanks in advance, Mark
Hope this was of any help. Victor.