![如何重新定义 \emph 以获得带有粗体数学符号的粗体文本?](https://linux22.com/image/307815/%E5%A6%82%E4%BD%95%E9%87%8D%E6%96%B0%E5%AE%9A%E4%B9%89%20%5Cemph%20%E4%BB%A5%E8%8E%B7%E5%BE%97%E5%B8%A6%E6%9C%89%E7%B2%97%E4%BD%93%E6%95%B0%E5%AD%A6%E7%AC%A6%E5%8F%B7%E7%9A%84%E7%B2%97%E4%BD%93%E6%96%87%E6%9C%AC%EF%BC%9F.png)
这个问题解释如何重新定义\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}
我的问题是:如何进一步重新定义\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}