0

I'm using book and have openany set. I'd like to get the chapter titles to by symmetrical--always to the inside or always to the outside of the page. I'm using titlesec. I've looked into an ifthen statement, but failed to get it to work. I know that memoir has an option for this, but if possible I'd like to stay with book so I don't have start over. I'm to the point of thinking this will be more complicated than it's worth and just centering the title.

1
  • This question could use a MWE to clarify what does not work based on what was tried and more specific clarity as to what is the desired outcome.
    – Leucippus
    Jan 30, 2021 at 6:58

1 Answer 1

1

First solution

Using the page option of \titleformat. Note that you have to redeclare the chapter "class":

\titleclass{\chapter}{top}
\titleformat{name=\chapter,page=odd}[display]
  {\filright\bfseries\Huge}
  {\chaptertitlename\ \thechapter:ODD}
  {2ex}
  {}
\titleformat{name=\chapter,page=even}[display]
  {\filleft\bfseries\Huge}
  {\chaptertitlename\ \thechapter:EVEN}
  {2ex}
  {}

Second solution

Using the \ifodd conditional:

\titleformat{\chapter}[display]
  {\ifodd\thepage\filleft\else\filright\fi
   \bfseries\Huge}
  {\chaptertitlename\ \thechapter}
  {2ex}
  {}
  []
1
  • The second worked perfectly. Thank you! Jan 31, 2021 at 15:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .