[comp.text.tex] LaTeX help clearing to a future recto page requested

pauld@cs.washington.edu (Paul Barton-Davis) (06/26/91)

I'm just wrapping up a major new documentstyle called STOP, based on
the Hughes model for user documentation (the so-called "STOP" format).
One of the last things I need to get wrapped up are a few of macros
that get LaTeX to a known verso or recto page, normally the next
one. However, the last macro shown below, \cleartonextrectopage, is a
little different, because instead of just moving onto the next recto
page, it moves the the next page that is not the current or immediate
next page. It gets used to flush one of the STOP format's 2 page
units.

I took the approach of clearing the next recto page, then testing the
page number, and if it only changed by 1, then call \clearpage twice,
putting empty \hboxes on each page to make sure LaTeX produces a blank
page.

The problem arises, as far as I can tell, when the first
\cleartorectopage gets called at the end of verso page. The first
\hbox results in a new page being created, which gets to be the first
recto page we encounter, and then, since we only went forward 1 page,
we flush 2 more pages. Net result is 3 empty pages, not 1.

Maybe I'm being dumb (probably, in fact), but can someone suggest a
nice way to "clear to the next recto (even numbered) page that is not
the current or next page" ? I tried lots of things - they all worked
less well than this ... :-( 

--------- existing macros ----------------------

%% \clearto[verso|recto|nextrecto]page - macros to flush to the
%%                       next page that meets some ``spread'' criteria
%%                       like verso-ness, recto-ness etc.

\def\cleartoversopage{\clearpage \ifodd\c@page \hbox{} \clearpage\fi}
\def\cleartorectopage{\clearpage \ifodd\c@page \clearpage \hbox{}\fi}

%% A tricky macro - flush to the next recto page that is not
%% the current or immediately facing recto page. Method: clear
%% to the first recto page. If that cleared more than one page,
%% OK; otherwise, clear two pages.
%%
%% NB: this is currently broken, and under a number of circumstances,
%%     will generate two extra blank pages. A method is needed to
%%     test whether or not the current page is empty.

\def\cleartonextrectopage{\@tempcnta\c@page
			  \hbox{}	%% make sure we flush a page
			  \cleartorectopage
			  \advance\@tempcnta by -\c@page
			  \ifnum\@tempcnta = -1 
				\hbox{}\clearpage
				\hbox{}\clearpage
			  \fi}

----------------------------------------------------------------------

ps. I'll post stop.sty when its done, and when its primary purpose (a new
book on X programming) is finished with it. If you want to see another
example of LaTeX that "doesn't look like LaTeX", try Niall Mansfield's
"The X Window System - A User's Guide" (Addison-Wesley). I'll post the
style for that one shortly, even though I think that the stipulations
A-W put on the style made it look AWFUL ...

Thanks, 
-- 
Paul Barton-Davis                                 <pauld@cs.washington.edu>

Man has survived because he did not know how to realize his wishes.
Now that he can realize them, he must either change them, or perish.