Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- \documentclass[twoside,openany]{book}
- \usepackage{lipsum}
- \usepackage[pagestyles]{titlesec}
- \renewpagestyle{plain}{
- \sethead[\firsttitlemarks\bfseries\ifnum\value{section}=0 \thechapter\else\thesection\fi][][]% even-left | even-center | even-right
- {}{}{\bottitlemarks\bfseries\ifnum\value{section}=0 \thechapter\else\thesection\fi}% odd-left | odd-center | odd-right
- \setfoot[\thepage][][]% even-left | even-center | even-right
- {}{}{\thepage}% odd-left | odd-center | odd-right
- \setheadrule{0.4pt}
- }
- \pagestyle{plain}
- \begin{document}
- \tableofcontents
- \chapter{Header Test}
- \section{Sec1}
- \lipsum[1]
- \section{Sec2}
- \lipsum[3-4]
- \section{Sec3}
- \lipsum[5]
- \section{Sec4}
- \lipsum[7]
- \chapter{New Chapter}
- \section{Sec5}
- \lipsum[2]
- \section{Sec6}
- \lipsum[6]
- \section{Sec7}
- \lipsum[8-9]
- \section{Sec8}
- \lipsum[10]
- \chapter{GAH}
- \lipsum[1-4]
- \chapter{New Chapter AAAA}
- \section{Sec5}
- \lipsum[2]
- \section{Sec6}
- \lipsum[6]
- \section{Sec7}
- \lipsum[8-9]
- \section{Sec8}
- \lipsum[10]
- \chapter{GAH1}
- \section{Sec8}
- \lipsum[10]
- \lipsum[1-4]
- \lipsum[1-4]
- \lipsum[1-4]
- \lipsum[1-4]
- \chapter{New CHAPTER AAAAA}
- \section{Sec5}
- \lipsum[2]
- \section{Sec6}
- \lipsum[6]
- \section{Sec7}
- \lipsum[8-9]
- \section{Sec8}
- \lipsum[10]
- \end{document}
Advertisement
Add Comment
Please, Sign In to add comment