[Tex/LaTex] How to boldface only a subsection number in amsart

amsartboldsectioning

If I use the code

\makeatletter
\renewcommand{\@secnumfont}{\bfseries}
\makeatother

from How to boldface a section header? (including title and number) it makes the number of sections bold as well. How to get a boldface number only for subsection? Looking into amsart.cls, it seems like there is not a specific command for sub(sub)sections or paragraphs.

Best Answer

Tapping into \@seccntformat you can format the section counter display to suit your needs based on the type of counter that is being used.

Below I've added a conditional that checks whether you're setting the subsection counter. If so, use \bfseries. Of course, this can be expanded to change other sectional counter setting as well by adding more conditions:

enter image description here

\documentclass{amsart}

\makeatletter
\def\@seccntformat#1{%
  \protect\textup{\protect\@secnumfont
    \ifnum\pdfstrcmp{subsection}{#1}=0 \bfseries\fi% subsection # in \bfseries
    \csname the#1\endcsname
    \protect\@secnumpunct
  }%
}  
\makeatother

\begin{document}
\section{A section}
\subsection{A subsection}
\subsubsection{A subsection}
\end{document}

This requires e-TeX due to \pdfstrcmp.

Related Question