# Choose the start page of a material

I prepare a book of short stories. There are no too long texts, each story takes no more than two pages. The customer asks to layout two-paged stories in such a way that they would be placed starting from an even page.

Now I've written a command that layouts a box of the title of a story and a box of full text of the story. The if their total height is greater than the height of the page, the current page number is checked and a page is skipped if necessary. Afterwards, the material is put: for the title its box is used, but the text is made up again.

In this scheme, the text is made up twice: at first, when I compute the height it takes, and at second, when it actually prepared for layout. Is it possible to optimize the process somehow?

You can check the value of the page number, and add blank pages as needed.

\documentclass{article}

\usepackage{lipsum}

\newcommand{\storytitle}[1]{%
\clearpage% Move to next page
\ifodd\value{page} \mbox{}\clearpage\fi% If page is odd, move to next page
}

\begin{document}

\storytitle{First story}
\lipsum[1-7]

\storytitle{Second story}
\lipsum[8-10]

\storytitle{Third story}
\lipsum[11-16]

\storytitle{Last story}
\lipsum[17-24]

\end{document}

• Would it not be better to use either \clearpage or \cleardoublepage in the if? – Oleg Lobachev Dec 17 '17 at 20:13
• @OlegLobachev: If you're using the twoside option, then the pages will be cleared to an odd page. So you'll have to do some work correcting for that either way. – Werner Dec 17 '17 at 20:27