1

Ok, so what I want to do is a bit unusual for LaTeX, but I'll do my best to explain.

I'm working on a document that I will eventually produce into a book, and I want to organize it in such a way that each section (or subsection) takes no more than a two-page spread of space (i.e. an even and odd page). My goal is that when te reader opens the book to a particular section, all the information about that section is in that two page spread -- the reader doesn't have to flip pages back and forth. So I want to be able to control the layout of the two-page spread while writing the manuscript, so everything fits exactly right.

Now, I know I can do this manually: I can go and forth between writing and compiling, change everything accordingly so that the content fits exactly the amount of space I want. But I was wondering if there was an easier and more automated way to do this.

Basically what I'm looking for is a way to force a specified block of LaTeX code (either a section or an environment block, or something along those lines) to be confined to a single two-page spread, regardless of whether or not I exceed that space? Perhaps something that will give me a warning if the spread is under or overfilled, but will NOT make the content spill into the next page.

Here's a rudimentary a MWE:

\documentclass[twoside,10pt]{book}

\usepackage[
inner=2.1cm, outer=2.1cm,
top=2cm, bottom=3cm,
papersize={6.0in,9.0in}]{geometry}

\begin{document}

\chapter{Chapter 1...}

\section{Example Section 1}

Text, equations, and images go here, 
but no matter how much or little there is, 
it all remains confined to a single two-page spread. 
(Maybe with the option to change the size fixed space if necessary...)

\section{Example Section 2}

Same thing here....

\end{document}
  • 1
    It's not a good idea shrinking and stretching the text every two pages, and this will not rid you of be as brief and concise as needed, if you want a good quality result. There are several methods to adjust text (glues, microtype, orphan penalty, scaling boxes, etc.) But the parskip package, or microtype or whatever could do a good work fitting an excess of one or two lines. Ask for more is ask to ruin the typography of your book with spacing inconsistencies , or worse, font inconsistencies. – Fran Nov 2 '19 at 3:54
  • I'm afraid I did not make myself entirely clear. I have no intention of shrinking or stretching the text, or changing the typography in any way. What I'm asking for is more of an editing aide. Something that would make the process easier, if such a thing exist. I want to be able to write every section first, and then get an overall idea about how each of the sections fit in their respective two page spreads, and what I will have to change.... Instead of having to do it manually every step of the way. – johnymm Nov 2 '19 at 4:54
  • 1
    Without compiling, the best help is a text editor showing the number of lines and have line breaks similar to that obtained in the final PDF (e.g., for your MWE, set the text width so that a lore-ipsum text should break after "elit", "dictum", "vulputate", etc. so you can estimate approximately the final extension. Compiling a preview, the best help is use the lineno package with the pagewise option to see exactly how far you are of reach the 42th line (last possible line of the second page pf your MWE) . I can made a answer if you are interested in this approach. – Fran Nov 2 '19 at 11:39
  • Thank you. I will try this, but I'm afraid this won't work as well if the text contains images, tables, equations, and two-column layout. I will give it a shot though, see how it does. – johnymm Nov 2 '19 at 14:42
  • 1
    Then, also end the section with: \par You have written now \thelinenumber\ lines using \the\pagetotal\ of the \the\textheight. Note that \pagetotal is calculated with at the last paragraph end, so, \the\pagetotal does not work within a paragraph, but after. – Fran Nov 3 '19 at 4:44
1

This show how check both the number of line and the used vertical space as well as say if you have surpassed some page extent, whatever the contents are. Note that the all margin notes can be hidden with the option disable in todonotes package.

MWE

\documentclass[twoside,10pt]{book}
\usepackage[pagewise,switch*]{lineno}
\usepackage[textwidth=4.5em,textsize=tiny]{todonotes}
\usepackage{lipsum}
\usepackage[inner=2.1cm, outer=2.1cm,top=2cm, bottom=3cm, papersize={6.0in,9.0in}]{geometry}
\usepackage{graphicx}

\def\WARNING{\todo[color=yellow,inline]{ \ifdim\the\pagetotal>480pt 
WARNING: \bfseries JUST ONE MORE LINE   \else  \bfseries WRITE MORE!  \fi}}


\begin{document}
\linenumbers


\chapter{foo}
\lipsum[1][1-4]

\todo[color=green!20]{You have written now \thelinenumber\ lines  and  
\the\pagetotal\ of the \the\textheight.}


\section{Bah}

\lipsum[2][1-6]
\todo[color=red!20]{Wrong: \thelinenumber\ lines  and  
\the\pagetotal}
\lipsum[2][7-10]

\WARNING


\todo[color=green!20]{Right: \thelinenumber\ lines  and  
\the\pagetotal\ of the \the\textheight.}



\par You have written now \thelinenumber\ lines  and  \the\pagetotal\ of the \the\textheight.


\begin{figure}[h]
\centering
\includegraphics[width=1cm]{example-image.png}
\end{figure}

\lipsum[9][1-7]

\WARNING

\section{baz}
\lipsum[3-5]

\WARNING

\newpage\section{whatever}

\lipsum[3-6]
\lipsum[7][1-9]

\WARNING

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.