5

I'm preparing a large document using the book class. I want my chapter, section, subsection, etc headings to appear either flushed left or right depending on whether they appear on an even or odd page, respectively. What I'm looking for is a way of doing this automatically, as the document is rather large and a minor addition/substraction of content could change the pages where many headings fall.

2

The package titlesec provides \titleformat command with possible even/odd specification.

The package has many options and a full answer cannot be provided without your example of the desired output.. For the usage see the titlesec documentation

So just a short example (put into your preamble)

\usepackage{titlesec}
\titleformat{name=\section,page=even}{\filleft\Large\scshape}{\thesection}{.5em}{}
\titleformat{name=\section,page=odd}{\filright\Large\scshape}{\thesection}{.5em}{}

Notice that this requires two pases to stabilize.

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.