0

I am using scrbook and some of my section and subsection header have small math in them.

There is no problem doing this, other than I noticed the headers have bold font (which is good and I want that to make the header easier to see in the document), but the math itself in the header is still light weight, same as if it was in the main text.

This makes the headers that contain math not look as good, since part of the header is bold now and part is not.

Here is a MWE. I use only lualatex if it makes any difference.

\documentclass[11pt]{scrbook}%
\usepackage{amsmath}
\usepackage{lmodern}
\usepackage{hyperref}

\begin{document}
\tableofcontents

\chapter{My main Chapter is here}
\section{This solves $\int f(x) \,dx$ and more}
\subsection{This solves $u''(x)+u(x)=0$ for any $u(x)$ with initial conditions}
text here
\end{document}

When compiled using lualatex foo.tex, here is what the header look like

Mathematica graphics

My question is, what is the correct way to make the whole section or subsection header use the same weight font (same boldness), including any math in it?

TL 2019 on linux

  • if you really use only lualatex you shouldn't use T1-encoding. – Ulrike Fischer May 24 at 20:02
  • @UlrikeFischer OK. thanks. Will remove it then. – Nasser May 24 at 20:04
  • This would be totally misleading if your document uses any bold math variables or symbols to mean something different from the equivalent regular-weight characters. In other words, it isn't a good idea except in limited circumstances. – barbara beeton May 25 at 1:28
1

You can add \boldmath to the sectioning font:

\documentclass[11pt]{scrbook}%
\usepackage{amsmath}
\usepackage{hyperref}
\addtokomafont{sectioning}{\boldmath}
\begin{document}
\tableofcontents

\chapter{My main Chapter is here}
\section{This solves  $\int f(x) \,dx$ and more}
\subsection{This solves   $u''(x)+u(x)=0$ for any $u(x)$ with initial conditions}
text here
\end{document}

enter image description here

With unicode-math there is no bold version, then I would do something along the answer here https://tex.stackexchange.com/a/279931/2388.

  • The fonts XITS Math, Libertinus Math and Minion Math do have bold versions. The unicode-math package will set up \boldmath and \mathversion{bold} automatically if you load any of them with \setmathfont. – Davislor May 24 at 23:06
  • unicode-math also supports \setmathfont[version=bold]. Unfortunately, you cannot combine range= and version=, so you can’t map glyphs from your bold text font to your \boldmath font. – Davislor May 24 at 23:12

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.