LaTeX forum ⇒ Page LayoutUnnumbered section names in header: problem with \markright Topic is solved

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
JefVL
Posts: 13
Joined: Sat Mar 22, 2014 10:27 pm

Unnumbered section names in header: problem with \markright

Postby JefVL » Sun Mar 23, 2014 6:33 pm

Hi all,

I'm working on my thesis and there is a little issue that I can't seem to solve... I need to use unnumbered sections for my word of thanks and list of abbreviations, but I'd like the titles to show up in the header. I'm using the package "fancyhdr", which has already helped me a lot with my page numbering and my numbered sections, but for some weird reason these two unnumbered sections won't work properly. I've tried using the \markright{Word of thanks} command, but somehow it shows up on the left in the header. My list of abbreviations (which is right after my table of contents) does show up on the right, but it's showing "Contents" in the header instead of "Abbreviations". Any suggestions? Here's a MWE:

  1. \documentclass[11pt,a4paper,oneside]{article}
  2.  
  3. \usepackage{fancyhdr}
  4.  
  5. \pagestyle{fancy}
  6. \setlength{\headheight}{15pt}
  7.  
  8. \begin{document}
  9.  
  10. \section*{Word of thanks\markright{Word of thanks}} %% I've tried placing the \markright command on a separate line too, with no avail
  11. \thispagestyle{fancy}
  12. \cfoot[]{} %% Using these two commands to prevent page numbering showing up in my footer
  13. \rfoot[]{}
  14. \newpage
  15. \tableofcontents
  16. \lhead[]{}
  17. \cfoot[]{}
  18. \rfoot[]{}
  19. \newpage
  20. \section*{Abbreviations\markright{Abbreviations}}
  21. \thispagestyle{fancy}
  22. \cfoot[]{}
  23. \rfoot[]{}
  24.  
  25. \end{document}


Thanks in advance!

EDIT: trimmed the MWE a bit
Last edited by JefVL on Wed Mar 26, 2014 12:04 am, edited 1 time in total.

JefVL
Posts: 13
Joined: Sat Mar 22, 2014 10:27 pm

Postby JefVL » Wed Mar 26, 2014 12:02 am

Anyone? Please?

esdd
Posts: 36
Joined: Sat Jan 25, 2014 9:13 pm

Postby esdd » Wed Mar 26, 2014 9:35 pm

Here is a Suggestion:

  1. \documentclass[a4paper]{article}
  2.  
  3. \usepackage{fancyhdr}
  4.  
  5. \pagestyle{fancy}
  6. \fancyhf{}
  7. \rhead{\leftmark}
  8. %\rfoot{\thepage}
  9. \setlength{\headheight}{15pt}
  10.  
  11. \usepackage{blindtext}
  12.  
  13. \begin{document}
  14.  
  15. \section*{Word of thanks\markboth{\MakeUppercase{Word of thanks}}{}}
  16. \clearpage
  17. \tableofcontents
  18.  
  19. \clearpage
  20. \section*{Abbreviations\markboth{\MakeUppercase{Abbreviations}}{}}
  21.  
  22. \clearpage
  23. \blinddocument
  24. \end{document}


Best regards
Elke

JefVL
Posts: 13
Joined: Sat Mar 22, 2014 10:27 pm

Postby JefVL » Wed Mar 26, 2014 9:50 pm

Works like a charm, thanks a lot!


Return to “Page Layout”

Who is online

Users browsing this forum: No registered users and 3 guests