如何重新定义 \emph 以获得带有粗体数学符号的粗体文本?

如何重新定义 \emph 以获得带有粗体数学符号的粗体文本?

这个问题解释如何重新定义\emph命令以使文本加粗。当数学文本包含强调文本时,我一直使用以下解决方案:

\documentclass{report}
\usepackage{bm}

\DeclareTextFontCommand{\emph}{\bfseries}

\begin{document}

\noindent Here the mathematical text is not bold: \\

\noindent An \emph{$n$-dimensional chart} of a topological space $M$ is a pair
$(U,\mathbf{x})$,  where $U$ is an open subset of $M$ and $\mathbf{x}: M \supset U 
\to \mathbf{x}(U)\subset \mathbf{R}^n$ is a homeomorphism. \\

\noindent Here is the corrected version: \\

\noindent An \emph{$\bm{n}$-dimensional chart} of a topological space $M$ is a pair 
$(U,\mathbf{x})$, where $U$ is an open subset of $M$ and $\mathbf{x}: M \supset U \to 
\mathbf{x}(U)\subset \mathbf{R}^n$ is a homeomorphism. 

\end{document}

MWE 的输出

我的问题是:如何进一步重新定义\emph以便数学文本自动变为粗体\bm

答案1

只需添加\boldmath

\documentclass{report}

\DeclareTextFontCommand{\emph}{\boldmath\bfseries}

\begin{document}

Here the mathematical text is bold:

An \emph{$n$-dimensional chart} of a topological space $M$ is a pair $(U,\mathbf{x})$,
where $U$ is an open subset of $M$ and $\mathbf{x}: M \supset U \to \mathbf{x}(U)\subset
\mathbf{R}^n$ is a homeomorphism.

\end{document}

在此处输入图片描述

现在您知道了如何做,请不要使用粗体来强调,特别是在其中使用数学时。

\\您似乎有在段落末尾使用的习惯:避免使用它。

答案2

您甚至不需要加载bm,只要\emph在数学模式之外使用即可:

\documentclass{report}
\usepackage{bm}

\DeclareTextFontCommand{\emph}{\bfseries\boldmath}

\begin{document}

\noindent Here the mathematical text is bold: \\

\noindent An \emph{$n$-dimensional chart} of a topological space $M$ is a pair $(U,\mathbf{x})$,
where $U$ is an open subset of $M$ and $\mathbf{x}: M \supset U \to \mathbf{x}(U)\subset
\mathbf{R}^n$ is a homeomorphism. \\

\noindent To compare with the hand-made version: \\

\noindent An \emph{$\bm{n}$-dimensional chart} of a topological space $M$ is a pair $(U,\mathbf{x})$,
where $U$ is an open subset of $M$ and $\mathbf{x}: M \supset U \to \mathbf{x}(U)\subset
\mathbf{R}^n$ is a homeomorphism.

\end{document} 

在此处输入图片描述

相关内容