
我使用了以下脚本-
Let's consider That you are constructing \bf{rational numbers}for the first time using natural numbers and so we don't have any idea about the \bf{division operator}
产生的输出是 -
假设你正在构建第一次使用自然数来表示有理数,所以我们对除法运算符一无所知。
但我只想让 \bf{} 之间的字符使用粗体字体。怎么做?
答案1
\bf
永远不应该使用它,大约 25 年前它已被弃用。
无论如何,它的语法就像{\bf rational numbers}
,但是不做这个。
正确的语法是
\textbf{rational numbers}
仔细比较这三行代码(第一行代码表明了问题,因为\bf
它是一个声明,一直到它出现的作用域结束)。第二行和第三行稍有不同,但意义重大(最后一行是正确的)。
\documentclass{article}
\begin{document}
\begingroup % for scoping the issue
Some \bf{big stuff} here
\endgroup
Some {\bf big stuff} here
Some \textbf{big stuff} here
\end{document}
使用和也可以看到相同的效果,甚至可能更好(与\it
和\textit
相同):\bf
\textbf
\documentclass{article}
\begin{document}
\begingroup % for scoping the issue
Some \it{big stuff} here
\endgroup
Some {\it big stuff} here
Some \textit{big stuff} here
\end{document}