1

\leftmark and \rightmark aren't being set, so I manually do this:

\chapter*{Acknowledgements}
\fancyhf[HRE,HLO]{\nouppercase{Acknowledgements}}
\phantomsection
\input{Acknowledgements}

\fancyhf[HRE,HLO]{\nouppercase{Acknowledgements}} % Added just for kicks

Then below I can just:

\fancyhf{}
\fancyhf[HLE,HRO]{\thepage}
\fancyhf[HRE,HLO]{\nouppercase{\leftmark}}

\printacronyms

Unfortunately that last page preceding the acronyms is missing a chapter name (it just shows a page number).

Full runnable example:

\documentclass{book}

\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{fncychap}
\usepackage{fancyhdr}
\usepackage{hyperref}

\usepackage[acronym,xindy,toc,nomain]{glossaries}

\setlength{\headheight}{15.2pt}
\pagestyle{fancy}


\makeglossaries
%\setacronymstyle{long-sc-short}

\newacronym{AB}{AB}{Alpha Beta}

\begin{document}

\title{\LaTeX{}}
\author{Author's Name}

\maketitle

\chapter*{Acknowledgements}
\fancyhf[HRE,HLO]{\nouppercase{Acknowledgements}}
\phantomsection
Hello

\newpage
 world!
\fancyhf[HRE,HLO]{\nouppercase{Acknowledgements}}

\newpage

\fancyhf{}
\fancyhf[HLE,HRO]{\thepage}
\fancyhf[HRE,HLO]{\nouppercase{\leftmark}}
\printacronyms


\end{document}

Is there a non-hacky solution to this, i.e.: a proper way to set \leftmark when using \chapter*{}? - Or just a way to get the current version working?

5
  • Could you please post a short, but complete, compilable code demonstrating the problem?
    – Bernard
    Jan 12 '20 at 14:26
  • Okay, I have now done so.
    – A T
    Jan 12 '20 at 15:58
  • If you add \clearpage or \newpage before \printacronyms, that will avoid the resetting before it's too late. Jan 12 '20 at 16:01
  • I tried above, below, and in both places: \clearpage\newpage\fancyhf{} \fancyhf[HLE,HRO]{\thepage} \fancyhf[HRE,HLO]{\nouppercase{\leftmark}}\clearpage\newpage. In all cases the previous page header is missing "Acknowledgement".
    – A T
    Jan 12 '20 at 16:42
  • You do need the header settings before the \clearpage. So remove the first one. Jan 12 '20 at 17:27
2

You can use \markboth to set the marks manually:

\documentclass{book}
\usepackage{blindtext}% only for dummy text

\usepackage{fancyhdr}
\usepackage[acronym,xindy,toc,nomain]{glossaries}
\usepackage{hyperref}

\setlength{\headheight}{15.2pt}
\pagestyle{fancy}
\fancyhf{}
\fancyhf[HLE,HRO]{\thepage}
\fancyhf[HRE,HLO]{\nouppercase{\leftmark}}

\makeglossaries
%\setacronymstyle{long-sc-short}
\newacronym{AB}{AB}{Alpha Beta}

\begin{document}
\title{\LaTeX{}}
\author{Author's Name}
\maketitle

\chapter*{Acknowledgements}
\markboth{\MakeUppercase{Acknowledgements}}{}
\Blindtext
\gls{AB}

\printacronyms
\Blindtext
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.