0

This question already has an answer here:

I am using the fancyhdr package to create nice headers for my thesis. I'm running into problems with a chemical formula that appears as a section name.

The chemical formula is capitalized when displayed in the header: enter image description here

However, I'd like to have it formatted like this: enter image description here

How can I make LaTeX to format the header correctly for this chemical formula without changing the uppercase conversion for other chapter / section names?

A minimal example of the code I used is:

\documentclass[twoside,openright]{report}

% Load all packages
%\input{preamble.tex}
\newcommand{\bisb}{Bi$_{1-x}$Sb$_{x}\,$}
\usepackage{blindtext} % For testing purposes

% Define the headers here
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE]{\textbf{\thepage}\quad\quad\quad \leftmark}
\fancyhead[RO]{\rightmark\quad\quad\quad \textbf{\thepage}}

\renewcommand{\headrulewidth}{1pt} 
\renewcommand{\footrulewidth}{0pt} 

\begin{document}
\chapter{One}
\section{\bisb}
\blindtext[20]

\end{document}

marked as duplicate by Johannes_B, Troy, CarLaTeX, Mike Renfro, TeXnician Aug 13 '17 at 12:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Welcome, \nouppercase{\leftmark} and \nouppercase{\rightmark}. This does not influence the chemical formula, but makes all header not use UPPERCASE. – Johannes_B Aug 13 '17 at 9:46
  • I am unable to replicate the issue you're reporting, using just the information you've provided so far. (I do get an error message about an option clash for the textcomp package, apparently related to the instruction \DeclareRobustCommand{\sustyle}....) Please post a fully compilable example that generates the issue you're looking to fix. – Mico Aug 13 '17 at 10:04
  • Hi Johannes, thanks for the answer. However, I'd like to have the other sections to appear in uppercase, so that does not fix the problem completely. – DaanMusic Aug 13 '17 at 10:14
  • Hi Mico, I have just updated the question with a new code snippet that I just ran. I hope this provides enough information. – DaanMusic Aug 13 '17 at 10:15
  • You should be using a proper package for chemistry support such as chemformula and chemmacros (my favourite) or mhchem (which is also good). – Johannes_B Aug 13 '17 at 10:15
0

Troy's answer has provided the right code to get what I want. By using

\section{\protect\bisb}

LaTeX no longer makes the formula appear in uppercase.

Thanks!

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