# [OS X TeX] Unwanted blank page

Ross Moore ross at ics.mq.edu.au
Tue Apr 25 01:44:35 CEST 2006

Hi Alain,

On 25/04/2006, at 6:31 AM, Alain Schremmer wrote:

> I am back with this issue even though the "include/don't include
> exercises" was solved to my entire satisfaction.
>
> Here is the new issue—and I didn't see how to apply the previous to
> the latter.
>
> I have a lot of very small, preamble-less files, 1, 2, 3 etc, in
> each of which are the variants of a given question of an exam.
>
> Once all done, they are used by a file with preamble using the
> package probsoln—very nice—but, to keep things straight as I write
> these files, I use a file with a preamble and
>
> Question 1: About Blah 1
> \include{1}
> Question 2: About Blah 2
> \include{2}
> Question 3: About Blah 3
> \include{3}
>
> etc
>
> This works well except that each "Question n: About Blah n" sits
> all by itself on the page with the corresponding file "n" on the
> next page whereas I would like it to be just after "Question 1:
> About Blah n".

LaTeX's  \include  is *not* the way to do this.
Instead I'd recommend the  {comment}  package,
where you can define your own named environments and specify
programatically whether they should be included or excluded.

Using a different master file, the same \input  source
(containing your data) can be used for different views
of the overall project.

>
> Someone once sent me off list a modified \include that did not
> insist that the included file be on a new page (the third line I
> assume):
>
>    \makeatletter
>    \def\@include#1 {%
>    %\clearpage
>    \if at filesw
>    \immediate\write\@mainaux{\string\@input{#1.aux}}%
>    \fi
>    \@tempswatrue
>    \if at partsw
>    \@tempswafalse
>    \edef\reserved at b{#1}%
>    \@for\reserved at a:=\@partlist\do
>    {\ifx\reserved at a\reserved at b\@tempswatrue\fi}%
>    \fi
>    \if at tempswa
>    \let\@auxout\@partaux
>    \if at filesw
>    \immediate\openout\@partaux #1.aux
>    \immediate\write\@partaux{\relax}%
>    \fi
>    \@input@{#1.tex}%
>    \clearpage
>    \@writeckpt{#1}%
>    \if at filesw
>    \immediate\closeout\@partaux
>    \fi
>    \else
>    \deadcycles\z@
>    \@nameuse{cp@#1}%
>    \fi
>    \let\@auxout\@mainaux}
>    \makeatother
>
> but someone else strongly advised against it when I mentioned it on
> list but, as I recall, didn't say why.

\include  is for including chapters of a large(ish) book or report,
or somesuch.
As well as starting a new page, it keeps separate .aux files for each
chapter. These contain sufficient information about the \label
commands (i.e., cross-reference anchors) and other meta-data
(e.g.  figure/table numbers, start/end page) for the chapter,
so that the \ref commands, etc. in other chapters can refer
to them correctly.

This allows you to do detailed work on the contents of just a few
chapters at a time, (using  \includeonly) and still have the correct
page numbering, and resolved cross-references, etc.

Now you can see why the new page is necessary:  without it,
the pagination coould change considerably in those sections
that you are not working on.

But there is another defect too.
The .aux files are written at the end of each \include'd segment.
This information can only be accurate if all the information
from that segment has been shipped-out (i.e. the relevant page
must have been built in its entirety, since otherwise the exact
page-number is not known yet.

It is *not* sufficient for the LaTeX source to have been processed
in terms of macro-expansions, and building tables, math-displays, etc.

Think also of floating environments. These must have been located
(within the chapter) and fully shipped-out.

Without *both* of the \clearpage commands, there will be trouble
with such things.

If you are building with small blocks, perhaps several to a page,
then none of this use of .aux files is of any use to you.
Besides, almost all of the information will be *just wrong*
because the correct pages will not have been built at the time
the page-counter is recorded.

>
> What would be the danger if the modified include was under another
> name, say, \xxxinclude?

You have to remove everything that makes the  \include  environment
useful,
so you might as well just define a new macro that does what you want,
and uses  \input  instead.

If you do this, don't use a name that looks like  "..include..",
because it'll have none of the characteristics of  \include
apart from the fact that it inputs more source from a different file.
In short,  "input"  is a more fundamental concept than  "include"
(which involves quite a few more features).

>
> Other than when keeping track of the questions and their variants,

> I would not use anywhere else.

Ahem.
Once you do this successfully in one project you will almost
certainly want to use and extend it for others.
Then you'll pass it around to collaborators and colleagues.
All this is as it should be --- but don't spread mis-information
by naming your special features according to the wrong concept.

>
> Regards
> --schremmer

Hope this helps,

Ross

------------------------------------------------------------------------
Ross Moore                                         ross at maths.mq.edu.au
Mathematics Department                             office: E7A-419
Macquarie University                               tel: +61 +2 9850 8955
Sydney, Australia  2109                            fax: +61 +2 9850 8114
------------------------------------------------------------------------

------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
& FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/



More information about the macostex-archives mailing list