TeX - LaTeX Asked on February 8, 2021
I have a problem with the footer ruler on the first page of each chapter, it doesn’t show whilst for the the second and following page of each chapter the ruler occurs.
I found the answer: https://tex.stackexchange.com/a/344092/44119 but this is for a scrreprt
and I use book
. In book
the chapterpagestyle
does not exist.
The first page:
The subsequent pages:
My MWE:
documentclass[twoside]{book}
usepackage{lipsum}
usepackage{fancyhdr}
pagestyle{fancyplain}
fancyhead[LE]{fancyplain{}{bfseriesthepage}}
fancyhead[CE]{fancyplain{}{}}
fancyhead[RE]{fancyplain{}{bfseriesleftmark}}
fancyhead[LO]{fancyplain{}{bfseriesrightmark}}
fancyhead[CO]{fancyplain{}{}}
fancyhead[RO]{fancyplain{}{bfseriesthepage}}
fancyfoot[LE]{fancyplain{bfseriesthepage}{bfseriesthepage}}
fancyfoot[CE]{fancyplain{}{}}
fancyfoot[RE]{fancyplain{bfseriesscriptsize Generated }{bfseriesscriptsize Generated }}
fancyfoot[LO]{fancyplain{bfseriesscriptsize Generated }{bfseriesscriptsize Generated }}
fancyfoot[CO]{fancyplain{}{}}
fancyfoot[RO]{fancyplain{bfseriesthepage}{bfseriesthepage}}
renewcommand{footrulewidth}{0.4pt}
begin{document}
chapter{My Chapter}
lipsum[1]
newpage
lipsum[1]
newpage
lipsum[1]
end{document}
So my question is how to solve this:
chapterpagestyle
in book
or
As the first page of a chapter is in the plain style, you have to redefine it. I took the opportunity to simplify the code for the fancyplain style:
documentclass[twoside]{book}
usepackage{lipsum}
usepackage{fancyhdr}
pagestyle{fancyplain}%
renewcommand{footrulewidth}{0.4pt}
%%%
fancypagestyle{fancyplain}{%
fancyhf{}
fancyhead[LE, RO]{bfseriesthepage}
fancyhead[LO]{bfseriesrightmark}
fancyhead[RE]{bfseriesleftmark}
fancyfoot[LE, RO]{bfseriesthepage}
fancyfoot[LO, RE]{bfseriesscriptsize Generated}
}
%%%
fancypagestyle{plain}{%
fancyhf{}
fancyfoot[LE, RO]{textbf{thepage}}
fancyfoot[LO, RE]{bfseriesscriptsize Generated}
renewcommand{headrulewidth}{0pt}}
pagestyle{fancyplain}%
begin{document}
chapter{My Chapter}
lipsum[1]
newpage
lipsum[1]
newpage
lipsum[1]
end{document}
Answered by Bernard on February 8, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP