3

When a sectioning starts with \Glsentrylong{SomeEntry}, I'm running into issue that the capitalization is not transferred to the header, while the sectioning is properly capitalized.

MWE:

\documentclass[twoside,11pt]{book}

\usepackage{fancyhdr}
\fancypagestyle{plain}{
    \fancyhf{}
    \fancyfoot[RO,LE]{\thepage}
    \renewcommand{\headrulewidth}{0pt}
}

\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}
\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ \thechapter.\ #1}{}}

\fancypagestyle{mystyle}{
    \fancyhf{}
    \fancyfoot[LE,RO]{\thepage}
    \fancyhead[RO]{\nouppercase{\rightmark}}
    \fancyhead[LE]{\nouppercase{\leftmark}}
    \renewcommand{\headrulewidth}{.4pt}
}
\usepackage{emptypage}

\usepackage[nopostdot,nonumberlist,section=paragraph]{glossaries}
\renewcommand*\glossaryname{}
\makeglossaries
\setglossarystyle{super}
\glstoctrue

\newacronym{ACR}{ACR}{acronym}

\usepackage{lipsum}

\title{Some title}
\begin{document}
\maketitle

\pagestyle{mystyle} % if this is commented out, the default section formating is capitalizing the first letter appropriately

\chapter{First chapter}
\section{\Glsentrylong{ACR}}

\lipsum[1-10]

\end{document}

I noticed the issue is with fancyhdr, as if the default book.cls header is used, the first letter of the section name in the header is properly capitalized.

s__C
  • 3,186

1 Answers1

1

The first letter uppercasing commands like \Glsentrylong use \MakeTextUppercase to convert the first letter to upper case, but this is counteracted by \nouppercase in the page style. A minor change to the \section in your MWE:

\section{\Glsentrylong{ACR} \MakeTextUppercase{s}ample}

illustrates this:

image of page header: 1.1 acronym sample

I think the only solution is to remove \nouppercase from the page style and prevent the book class from applying upper casing. I think it would be better to use a more flexible class (such as memoir or scrbook) but if you want to stick with book, here's a possibility.

Although you've redefined \sectionmark and \chaptermark to remove \MakeUppercase, from their definition, they are reset by the book page styles. If you add \show before and after the page style is set

\show\sectionmark
\show\chaptermark
\pagestyle{mystyle}

\show\sectionmark
\show\chaptermark

the transcript file will show this:

> \sectionmark=\long macro:
#1->\markright {\thesection .\ #1}.
l.36 \show\sectionmark

? 
> \chaptermark=\long macro:
#1->\markboth {\chaptername \ \thechapter .\ #1}{}.
l.37 \show\chaptermark

? 
> \sectionmark=macro:
#1->\markright {\MakeUppercase {\ifnum \c@secnumdepth >\z@ \thesection . \ \fi 
#1}}.
l.40 \show\sectionmark

? 
> \chaptermark=macro:
#1->\markboth {\MakeUppercase {\ifnum \c@secnumdepth >\m@ne \@chapapp \ \thecha
pter . \ \fi #1}}{}.
l.41 \show\chaptermark

If you move the redefinition of these commands to after the page style is set and remove \nouppercase from the page style, then the heading will be in lower case except for the \MakeTextUppercase parts.

\documentclass[twoside,11pt]{book}

\usepackage{fancyhdr}
\fancypagestyle{plain}{
    \fancyhf{}
    \fancyfoot[RO,LE]{\thepage}
    \renewcommand{\headrulewidth}{0pt}
}

\fancypagestyle{mystyle}{%
    \fancyhf{}%
    \fancyfoot[LE,RO]{\thepage}%
    \fancyhead[RO]{\rightmark}%
    \fancyhead[LE]{\leftmark}%
    \renewcommand{\headrulewidth}{.4pt}%
}
\usepackage{emptypage}

\usepackage[nopostdot,nonumberlist,section=paragraph]{glossaries}
\renewcommand*\glossaryname{}
\makeglossaries
\setglossarystyle{super}
\glstoctrue

\newacronym{ACR}{ACR}{acronym}

\usepackage{lipsum}

\title{Some title}
\begin{document}
\maketitle

\pagestyle{mystyle}
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}%
\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ \thechapter.\ #1}{}}%

\chapter{First chapter}
\section{\Glsentrylong{ACR} \MakeTextUppercase{s}ample}

\lipsum[1-10]

\end{document}

image of page header: 1.1 Acronym Sample

Nicola Talbot
  • 41,153