TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 2 down vote accepted

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)


Notice that this requires two pases to stabilize.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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