tags:

views:

239

answers:

1

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

A: 

Try the code that Steve posted to a question of mine.

Charles Stewart
Thanks but it did not really solved my problem - I added some details to original question to make it clearer.
drasto
@drasto: You'll have to fiddle with spacing. A starting point is http://stackoverflow.com/questions/1966778/latex-template-or-example-for-personal-statement
Charles Stewart
I think I understand now what you meant. I'm to measure all the text in \vbox-es and decide if it will fit to pages correctly. If not than I may put it into minipage or something to prevent overflow from odd page to even. If nobody comes with better solution I will present this as an accepted answer to my question.
drasto