I have two side document(so I use twoside
option) in LaTeX. I need to keep some material (text, pictures...) on one double page. In another words I want to allow page break from odd to even page but I want to prohibit breaks from even to odd page.
I tried to write macro:
\newcommand{\nl}{
\\ \ifodd\c@page
\relax
\else
\nopagebreak
\fi}
and use it instead of \\
(I don't use any other line breaks commands in my document) but it does not work. Thanks for all answers.
EDIT: Thanks but Steves environment does not quite work for me. I tried to put my material into it but it does not cause it to fit on 2 pages, instead it says Overflow in twopage environment
.
I will try to formulate exactly what I need to do:
- Preferable an environment or a macro.
- If the current page is even it must prevent LaTeX from breaking the page(it may break if it is absolutely impossible to keep the material on even page, but I need it to try hard). This may by done by setting penalty to 20000 or by anything else - please suggest as dirty tricks as you can make up.
- If the current page is odd then the page break is allowed but not necessary.
- The code that will make use of this environment or macro will be generated by java program so there is no point in generating errors if the material just can't fit into page or double page. Java have no way to know about LaTeX error.
Thanks for all ideas
\textheight
s in the environment. You say you can't tolerate a LaTeX error, so you need to specify what behavior you want when there's too much material to fit. You say "it may break if it is absolutely impossible" - how do you define that? If I understand correctly, where your requirements differ is that you don't want a break before your twopage material. It sounds to me like a job for the output routine, though that's difficult to deal with. – Steve Apr 10 '10 at 7:471.2\textheight
tall twopage at the bottom of the right-hand page, what should happen? Should it give up and allow the page break? Should it do a preemptive break so that it has room on the next page? What tricks did you have in mind to make things fit? Most vertical glue on the page has zero shrinkability, though you could adjust \baselineskip or the other skips to something like \baselineskip=12pt minus 4pt, which is as much squashiness as will still allow readability, right at the beginning of the environment. Shrinking the text retroactively would be near impossible. – Steve Apr 10 '10 at 7:55