Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am using the KOMA-Script scrbook class, and I want to have bold math in my section titles (to match the title text). For this I redefine \sectfont, and it works nicely.

\renewcommand{\sectfont}{\bfseries\sffamily\mathversion{bold}}

The section titles in the table of contents and the headers are not changed. However, sometimes I do erroneously get bold math in the headers.

I think the problem occurs when the double-page is just full, so that any more text would result in an overflow, and there has to be another section after the current page (so that the next page starts with a section header). Also it only happens when I use line numbers from \usepackage{lineno}.

Is lineno incompatible with KOMA-Script? Is there a better way to get bold math fonts in section titles (but not in the TOC and headers)?

I can of course just disable the line numbers as I will with my final document, but this bug makes me suspect I am doing something wrong, and something else might break. Also, I can just stuff \nolinenumbers into my \sectfont and it seems to work, but if I'm doing something wrong and fragile, then that would be just fixing the symptoms. A MWE is below (compare the top of page 6 with page 4 and 8):

\documentclass[paper=A4,11pt,headsepline,footsepline]{scrbook}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{blindtext}
\usepackage{lineno}

\renewcommand{\sectfont}{\bfseries\sffamily\mathversion{bold}}

\begin{document} 

\tableofcontents 
\cleardoublepage 

\linenumbers

\chapter{Title $xyz$ containing $\chi^2$ math}
\section{Section $A$}
% this double-page is probably not full enough, but
% one more \blindtext will make it overflow
\blindtext\blindtext\blindtext\blindtext
\blindtext\blindtext\blindtext

\section{Section $B$}
% this double-page exhibits the bug.
\blindtext\blindtext\blindtext\blindtext
\blindtext\blindtext\blindtext\blindtext

\section{Section $C$}
% this double-page is identical, but doesn't exhibit the bug,
% since there is no section after it (?)
\blindtext\blindtext\blindtext\blindtext
\blindtext\blindtext\blindtext\blindtext

% uncomment this and the bug appears for section C, too: 
%\section{Section $D$}
\end{document}
share|improve this question
1  
Add \mathversion{normal} to the head font, e.g. \renewcommand\headfont{\mathversion{normal}\normalfont}. –  Ulrike Fischer Mar 11 at 10:10
    
Thanks, that worked! If you post it as an answer I can accept it. I guess using \mathversion{bold} in sectfont causes undefined behavior because it may or may not be invoked on a page, but there is nothing by default that undoes it - unlike \bfseries which is undone by \normalfont. –  jdm Mar 11 at 10:31

1 Answer 1

up vote 3 down vote accepted

Add \mathversion{normal} to the head font, e.g. \renewcommand\headfont{\mathversion{normal}\normalfont}.

share|improve this answer
    
And quite probably \addtokomafont{pageheadfoot}{\mathversion{normal}\normalfont} would work, too? –  Speravir Mar 11 at 20:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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