LaTeX forum ⇒ Page LayoutUnexpected result of redefining plain style

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
ariel67
Posts: 5
Joined: Wed Nov 30, 2016 1:43 pm

Unexpected result of redefining plain style

Postby ariel67 » Tue Mar 07, 2017 11:46 am

I'm writing a book, sectioned in several chapters. I'm using the fancyhdr package. I would like the first page to each chapter looks different from others, in particular I don't want header on it. So, I've tried to redefine the "plain" style, but it seems to be ignored. Here a compilable exemple:

  1. \documentclass[12pt, openright, twoside, a4paper]{report}
  2. \usepackage{subfiles}
  3. \usepackage{lipsum}
  4. \usepackage{fancyhdr}
  5. \pagestyle{fancy}
  6. \fancyhf{} % supprime les en-têtes et pieds de page
  7. \renewcommand{\chaptermark}[1]{\markboth{\thechapter. \ #1}{}} % Ceci permet d'avoir les noms de chapitre et de section
  8. \renewcommand{\sectionmark}[1]{\markright{\thesection. \ #1}{}} % en minuscules :
  9. \fancyhead[RO,LE]{{\bfseries \leftmark} \\ \rightmark}
  10. \renewcommand{\headrulewidth}{0.5pt}% filet en haut de page
  11. \renewcommand{\footrulewidth}{0.5pt} % filet en bas
  12. \fancyfoot[RO,LE]{\thepage}
  13. \fancypagestyle{plain}{%
  14. \fancyfoot[RO,LE]{\thepage}
  15. %\addtolength{\headheight}{0.5pt} % espace pour le filet
  16. \renewcommand{\footrulewidth}{0.5pt} % filet en bas
  17. }
  18. \begin{document}
  19. \chapter{First}
  20. \thispagestyle{plain}
  21. \lipsum[1]
  22. \lipsum[2]
  23. \lipsum[3]
  24. \lipsum[2]
  25. \chapter{Second}
  26. \lipsum[1]
  27. \lipsum[2]
  28. \lipsum[3]
  29. \lipsum[2]
  30.  
  31. \end{document}


There is no difference between the layout of the first pages of the two chapters: both have an header. Where am I wrong?

Tags:

Return to “Page Layout”

Who is online

Users browsing this forum: No registered users and 5 guests