# Boldsymbol in subsection title

I'm using the following command in my text and there is no problem, but it doesn't work in the subsection title,

\boldsymbol{\mathrm{tr}}


\documentclass[10pt, twocolumn, twoside, journal]{IEEEtran}
\usepackage{amsmath, amsfonts, amssymb, color, enumerate, amsthm, graphicx, arydshln, algorithm}
\begin{document}
\section{Main}
My contents ...
\subsection{Trace ($\boldsymbol{\mathrm{tr}}(W_c)$)}
\end{document}

• "doesn't work" is not very definite, show the error message that you get, it runs without error and makes a bold tr in texlive 2109 (you could simply use \mathbf rather than \boldsymbol{\mathrm – David Carlisle May 11 '19 at 20:02
• For me, this code works. Just in case, try a simpler \mathbf{tr}which produces the same result. – Bernard May 11 '19 at 20:02
• Thanks guys. I get this error: TeX capacity exceeded, sorry [input stack size=5000]. T – Mohammad May 11 '19 at 20:08
• that's very weird, you get that error on the document exactly as posted above? I tried in texlive 2016 and 2019 with no error. – David Carlisle May 11 '19 at 20:41
• @DavidCarlisle Yes, I also use texlive 2016. – Mohammad May 11 '19 at 21:14

I wouldn't make "tr" bold. The IEEEtran document class doesn't typeset subsection-level headers in bold; why use bold for parts of the formula, then? Instead, I'd define (and use) a math operator called \tr.

If you simply must typeset "tr" in bold, I suggest you change \DeclareMathOperator{\tr}{tr} to \DeclareMathOperator{\tr}{\mathbf{tr}}.

\documentclass[10pt, twocolumn, twoside, journal]{IEEEtran}
\usepackage{amsmath, amssymb, xcolor, enumerate,
amsthm, graphicx, arydshln, algorithm}
\DeclareMathOperator{\tr}{tr}
\usepackage{newtxtext,newtxmath} % optional

\begin{document}
\section{Main}
My contents \dots
\subsection{Trace of the Controllability Gramian Matrix, $\tr(W_{\!c})$}
\end{document}