# Bold math text in section names

I have problem with bold math text in sections and subsections. I want to bold this:

\subsubsection{Wyniki dla ${}^{222}\mathrm{Radon}$}


I tried \boldsymbol{} from THIS SOLUTION but it's not working properly because after that I have bolded text in my table of contents too. I want to remove bold mode in my table of contents. Any ideas how to make it?

• I think what you want is dla \textsuperscript{222}Radon not in math mode. – Sigur Mar 6 '18 at 16:15
• if you want to do this, you should modify your section heading code where it specifies \bfseries to also specify \boldmath – David Carlisle Mar 6 '18 at 16:16
• @Sigur, it works but how to get mathmode numbers and equal sign without "Z" letter in math mode there? \subsubsection{Wyniki dla pierwiastka o $\mathrm{Z}=123$} – Dawid Mar 6 '18 at 16:21
• So, in this case it would be better to edit your post and show explicitly a math example, like above. The one you gave suggested me only text content produced wrongly with math mode. – Sigur Mar 6 '18 at 16:22

\documentclass{article}

\makeatletter
% copied from article.cls, added \boldmath
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
{\normalfont\normalsize\bfseries\boldmath}}

\makeatother

\begin{document}

\tableofcontents
\section{zzz}
\subsection{zz}
\subsubsection{Wyniki dla ${}^{222}$Radon}

\end{document}


Just use \textsuperscript:

\documentclass{article}

\newcommand{\isotope}[2]{\textsuperscript{#1}#2}

\begin{document}

\tableofcontents

\end{document}


If you really want to embolden math in titles (you shouldn't, in my opinion), use sectsty:

\documentclass{article}
\usepackage{sectsty}

\allsectionsfont{\bfseries\boldmath}

\newcommand{\isotope}[2]{\textsuperscript{#1}#2}

\begin{document}

\tableofcontents

\section{Wyniki dla pierwiastka o $\mathrm{Z}=123$}

Wyniki dla pierwiastka o $\mathrm{Z}=123$

\end{document}


If you want bold math everywhere boldface is used:

\documentclass{article}
\usepackage{xpatch}

\xapptocmd\bfseries{\boldmath}{}{}

\newcommand{\isotope}[2]{\textsuperscript{#1}#2}

\begin{document}

\tableofcontents

\section{Wyniki dla pierwiastka o $\mathrm{Z}=123$}
Wyniki dla pierwiastka o $\mathrm{Z}=123$