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 Answer
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}
{}
[]