2

I have smallcaps headers. With sections names and chapter and the left and right marks. In some cases I have vector bold in the section names. This creates a problem for headers of these sections. The smallcaps conversion of the section name does not go well with the vector bold (it changes the case) and renders is as a small letter instead of a capital one. For example the image below shows the header rendering for \section{Magnetic Field $\vb{B}$}. Can we make an exception for mathematical expressions in the headers? Any other ideas how to implement this?

section title with vector bold

section header

MWE

\documentclass[11pt,twoside]{book}

\usepackage[tracking=smallcaps]{microtype}

\usepackage{relsize}

 \usepackage{fancyhdr}

 \pagestyle{fancy}
 \setlength{\headheight}{15pt}
 \renewcommand{\headrulewidth}{0pt}
 \renewcommand{\chaptermark}[1]{%
 \markboth{#1}{}}

 \renewcommand{\sectionmark}[1]{\markright{ #1}}
 \fancyhf{}

 \fancyhead[RO]{\textsc{\smaller{\MakeLowercase\rightmark}}}


 \fancyhead[L]{\smaller\thepage}

\makeatletter
\fancyhead[RE]{\if@mainmatter \fi \textsc{\smaller{\MakeLowercase\leftmark}}}
\makeatother

\usepackage{physics}

\usepackage{lipsum}

\begin{document}

\chapter{one}
\section{Magnetic Field $\vb{B}$}
\lipsum
\lipsum

\end{document}  
6
  • You could declare a separate math version for headers, or just use a different symbol.
    – Davislor
    Nov 19, 2022 at 9:30
  • I, personally, would be confused to see the same vector called B in the section title and b in the text. Are you sure that’s a good idea?
    – Davislor
    Nov 19, 2022 at 9:31
  • @davislor that is precisely the problem. The text has bold B from \vb{B} whereas the header, due to makelowercase and smallcaps has converted the capital boldface B it to smallcase bold b
    – Damitr
    Nov 19, 2022 at 10:39
  • 1
    No, there is no typo. I meant \vb{B} in the main text. Which is not displaying correctly in the header.
    – Damitr
    Nov 19, 2022 at 10:52
  • Ah, I see now, pardon. Was not able to reproduce your bug and got confused.
    – Davislor
    Nov 19, 2022 at 10:54

1 Answer 1

2

With a current LaTeX you get

enter image description here

if updating is not an option, you can use \MakeTextLowercase from the textcase package.

Note \textsc has no effect on math, but you need a version of MakeLowercase that skips math

2
  • Ok, I will update and try textcase as suggested, PS: I had forgotten about 22 release!
    – Damitr
    Nov 19, 2022 at 11:59
  • I just changed the header to all caps (removing \textsc )using \MakeTextUppercase to have consistency with capital bold math. Thanks for the suggestion
    – Damitr
    Nov 23, 2022 at 17:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .