1

I'd like to have a letter written in math mode and bold in a section title.

Running this

\documentclass[
    pdftex,a4paper,11pt,oneside,fleqn,
    bibliography=totoc,listof=totoc,
    headlines=2.1,headsepline,
    numbers=noenddot
]{scrreprt}

%%%----- PDF Format -----------------------------
\usepackage{float}
\usepackage[pdftex,pdfpagelabels,bookmarks,bookmarksopen,bookmarksnumbered,
    bookmarksopenlevel      = 1,
    pdfstartpage                    = 1,
    pdfstartview                    = FitV, 
    pdfpagelayout                   = SinglePage,
    plainpages                      = false,
    hypertexnames                   = false,
    colorlinks                      = true, 
    linkcolor                           = black,
    citecolor                           = black,
    urlcolor                            = black
]{hyperref}
    
%%%----- Mathe ----------------------------------
\usepackage{amsmath,amsfonts,amssymb,bm}
\usepackage[squaren,textstyle]{SIunits}
\usepackage{icomma}
    
\usepackage{mathtools}
\usepackage[makeroom]{cancel}
            
\begin{document}

\section{Filtered-$\boldsymbol{x}$-LMS (FxLMS)-Algorithmus}
blabla

\begin{align*}
    a \cdot b\\
    c {\cdot} d
\end{align*}

\end{document}

I get the following error: ! Illegal parameter number in definition of \BKM@title.

0

2 Answers 2

3

The code you show does not produce errors. But if I add

\usepackage{hyperref}
\usepackage{bookmark}

I get indeed

! Illegal parameter number in definition of \BKM@title.
<to be read again>
                   2
l.14 ...-$\boldsymbol{x}$-LMS (FxLMS)-Algorithmus}

The problem is that \boldsymbol does not survive the bookmark-making process. The standard way out is

\section{Filtered-\texorpdfstring{$\boldsymbol{x}$}{x}-LMS (FxLMS)-Algorithmus}

Complete code:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amsfonts,amssymb,bm}
\usepackage[squaren,textstyle]{SIunits}
\usepackage{icomma}

\usepackage{mathtools}
\usepackage[makeroom]{cancel}
\usepackage{hyperref}
\usepackage{bookmark}

\begin{document}

\section{Filtered-\texorpdfstring{$\boldsymbol{x}$}{x}-LMS (FxLMS)-Algorithmus}
blabla

\end{document}

enter image description here

A few notes.

Since some years, \usepackage[utf8]{inputenc} can be omitted.

The package SIunits is old and unmaintained. You should switch to siunitx which is much more powerful, maintained and developed.

You can use \bm instead of \boldsymbol: it's much shorter.

6
  • I edited my post.
    – Domi1908
    Commented Sep 27, 2022 at 17:22
  • 1
    @Domi1908 hyperref should almost always be loaded last; not that it matters much in the particular case, but it's a good rule to follow. Better also to load bookmark, but after hyperref (one of the few exceptions to the general rule).
    – egreg
    Commented Sep 27, 2022 at 17:25
  • But it solved my problem, thank you very much!
    – Domi1908
    Commented Sep 27, 2022 at 17:25
  • I have another question: How can I reduce the space around \cdot? With the code from above {\cdot} doesn't help.
    – Domi1908
    Commented Sep 27, 2022 at 20:15
  • @Domi1908 Sorry, but there's no \cdot to see.
    – egreg
    Commented Sep 27, 2022 at 20:44
1

As you are using a Koma-Script class (scrreprt), you can make all math in section titles bold by adding this line to the preamble:

\addtokomafont{sectioning}{\boldmath}

So, a modified MWE:

\documentclass[
    pdftex,a4paper,11pt,oneside,fleqn,
    bibliography=totoc,listof=totoc,
    headlines=2.1,headsepline,
    numbers=noenddot
]{scrreprt}

%%%----- PDF Format -----------------------------
\usepackage{float}
\usepackage[pdftex,pdfpagelabels,bookmarks,bookmarksopen,bookmarksnumbered,
    bookmarksopenlevel      = 1,
    pdfstartpage                    = 1,
    pdfstartview                    = FitV, 
    pdfpagelayout                   = SinglePage,
    plainpages                      = false,
    hypertexnames                   = false,
    colorlinks                      = true, 
    linkcolor                           = black,
    citecolor                           = black,
    urlcolor                            = black
]{hyperref}
    
%%%----- Mathe ----------------------------------
\usepackage{amsmath,amsfonts,amssymb,bm}
\usepackage[squaren,textstyle]{SIunits}
\usepackage{icomma}
    
\usepackage{mathtools}
\usepackage[makeroom]{cancel}

\addtokomafont{sectioning}{\boldmath}
            
\begin{document}

\section{Filtered-$x$-LMS (FxLMS)-Algorithmus}
blabla

\end{document}

Font sample

This mixes serif and sans-serif fonts, but you could also change the sectioning font, or choose a bold sans-serif math style for use in headers.

\documentclass[
    pdftex,a4paper,11pt,oneside,fleqn,
    bibliography=totoc,listof=totoc,
    headlines=2.1,headsepline,
    numbers=noenddot
]{scrreprt}

%%%----- PDF Format -----------------------------
\usepackage{float}
\usepackage[pdftex,pdfpagelabels,bookmarks,bookmarksopen,bookmarksnumbered,
    bookmarksopenlevel      = 1,
    pdfstartpage                    = 1,
    pdfstartview                    = FitV, 
    pdfpagelayout                   = SinglePage,
    plainpages                      = false,
    hypertexnames                   = false,
    colorlinks                      = true, 
    linkcolor                           = black,
    citecolor                           = black,
    urlcolor                            = black
]{hyperref}
    
%%%----- Mathe ----------------------------------
\usepackage{amsmath,amsfonts,amssymb,bm}
\usepackage[squaren,textstyle]{SIunits}
\usepackage{icomma}
    
\usepackage{mathtools}
\usepackage[makeroom]{cancel}

\DeclareMathVersion{boldsans}
\SetSymbolFont{operators}{boldsans}{OT1}{cmsmf} {bx}{n}
\SetSymbolFont{letters}  {boldsans}{OML}{cmssm} {b}{it}
\SetSymbolFont{symbols}  {boldsans}{OMS}{cmsssy}{b}{n}
\SetSymbolFont{largesymbols}{boldsans}{OMX}{cmssex}{m}{n}

\addtokomafont{sectioning}{\mathversion{boldsans}}
            
\begin{document}

\section{Filtered-$x$-LMS (FxLMS)-Algorithmus}
    {\mathversion{boldsans}
    \[ \int \frac{\sqrt{\epsilon}}{x} \mathop{\mathrm{d}x}{} = \sqrt{\epsilon} \ln x + C
    \]
    }

\end{document}

Sansmathfonts sample

You must log in to answer this question.

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