我使用\boldmath
命令将章节标题中的数学符号加粗。此外,我使用该scrlayer-scrpage
包将章节标题写入页眉。问题是页眉中的数学符号也是粗体。有办法防止这种情况吗?
以下是 MWE:
\documentclass[10pt, twoside]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{lmodern}
\usepackage{scrlayer-scrpage}
\usepackage{nameref}
\pagestyle{scrheadings}
\clearpairofpagestyles
\chead{\headmark}
\automark[section]{section}
\automark*[subsection]{}
\cfoot{\pagemark}
\usepackage{blindtext}
\usepackage{hyperref}
\begin{document}
\section{I want {\boldmath$x$} in bold type}
\subsection{Or Greek letters {\boldmath$\alpha$}}
\Blindtext
\subsection{Another Greek letter {\boldmath$\beta$}}
\Blindtext
\subsection{And a third one: {\boldmath$\gamma$}}
\blindtext
\end{document}
答案1
如何使标题中的数学加粗在 KOMA-Script wiki 中建议,例如,
\documentclass[10pt, twoside]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{lmodern}
\usepackage{scrlayer-scrpage}
\usepackage{nameref}% Note: You don't need this, because you are using hyperref.
\pagestyle{scrheadings}% Note: Not needed, because default after loading scrlayer-scrpage
\clearpairofpagestyles
\chead{\headmark}
\automark[section]{section}% Note: Option automark would be an alternative.
\automark*[subsection]{}
\cfoot{\pagemark}% Note: I would recommend to use \cfoot*{\pagemark}. Otherwise the plain pages would be without pagination.
\addtokomafont{disposition}{\boldmath}% add \boldmath to all headings
\usepackage{blindtext}
\usepackage{hyperref}
\begin{document}
\section{I want $x$ in bold type}
\subsection{Or Greek letters $\alpha$}
\Blindtext
\subsection{Another Greek letter $\beta$}
\Blindtext
\subsection{And a third one: $\gamma$}
\blindtext
\end{document}
但它也解释了许多其他的替代方案,以及为什么添加\boldmath
并非在所有情况下都有帮助,例如\sum
。