For a poetry book I would like to typeset all text on even pages \raggedleft and all text on odd pages \raggedright, including headings. Poems can span across multiple pages, so the change of text alignment should happen automatically at page breaks. Ideally this would work also with the verse package.

The intended result would be something like this: intended result text alignment on even/odd pages

Here's the spaghetti code for the example above:

\setlength{\leftmargini}{0em} % no indentation for verses


\raggedleft\textbf{A Limerick}
  There was an old party of Lyme \\
  Who married three wives at one time. \\
  When asked: ‘Why the third?’ \hspace{1em}\strut \\
  He replied: ‘One’s absurd, \hspace{1em}\strut \\
  And bigamy, sir, is a crime.’


\raggedright\textbf{Love's lost}
  I used to love my garden \\
  \hspace{1em} But now my love is dead \\
  For I found a bachelor’s button \\
  \hspace{1em} In black-eyed Susan’s bed.


I had a look at the following questions/answers but couldn't figure out how to solve my problem:

Maybe there is a low-level hack to switch the orientation of everything according to even/odd pages?

  • That does not seem to be easy: the \raggedleft/\raggedright setting is relevant in the phase in which TeX is breaking a paragraph into lines; if one paragraph is split across two pages, you cannot automatically have the first half (on the first page) typeset \raggedleft and the second half typeset \raggedright. You need to interrupt the paragraph at the right spot, which is difficult to automate. – GuM Jul 19 '15 at 12:14
  • Addendum: the trick explained in The TeXbook, Appendix D, section 7 is not applicable here, because we do not know at which point in the paragraph the switch between ragged right and ragged left setting should occur—or do we? – GuM Jul 19 '15 at 12:23
  • We knew if we counted the number of lines we have on the respective page, this will be constant throughout the book. Unfortunately the trick in The TeXbook is beyond my (La)TeX-skills. – Matthias Jul 20 '15 at 23:22
  • I was reflecting that perhaps you do not need to have ragged left and ragged right margins in the same paragraph: usually, when typesetting a poem, each stanza makes a paragraph by itself. Now, is it possible to introduce the constraint that each stanza must be confined to a single page? That is, that a page break cannot occur between two lines of the same stanza? – GuM Jul 21 '15 at 19:07
  • For most poems this constraint would be acceptable. But in this book there are a few with very long stanzas that do not fit on one page, so there will be a page break somewhere. – Matthias Jul 23 '15 at 7:28

Your Answer

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

Browse other questions tagged or ask your own question.