原 文:Bold, italics and underlining
譯 者:Xovee
翻譯時間:2020年5月25日
LaTeX 中的粗體、斜體、下劃線
在一個文檔中,簡單的文字排版可以對某些概念進行重點描述,增強其可讀性。使用粗體、斜體、或者下劃線,可以帶給讀者不同的感覺。
介紹
在這篇文章中,我們將會學習三種不同的基礎文字排版:斜體、粗體、下劃線。讓我們首先看一個例子:
Some of the \textbf{greatest}
discoveries in \underline{science}
were made by \textbf{\textit{accident}}.
你可以看到,我們使用了三種基礎指令,它們可以互相嵌套來產生不同的效果。注意:命令\it
和\bf
也可以用來生成粗體、斜體,不過我們並不推薦使用它們,因爲它們不能處理文字之前的樣式。這意味着,你不能同時定義一個粗斜體。
斜體
使用斜體是非常簡單的,使用\emph
或者\textit
命令:
Some of the greatest
discoveries in science
were made by \emph{accident}.
粗體
使用\textbf
指令來對文字進行加粗:
Some of the \textbf{greatest}
discoveries in science
were made by accident.
下劃線
使用\underline
來對文字添加下劃線:
Some of the greatest
discoveries in \underline{science}
were made by accident.
強調文字
你可以使用\emph
命令來強調文字,有時候\emph
的行爲與\textbf
一樣,它們還有一些差異:
Some of the greatest \emph{discoveries}
in science
were made by accident.
\textit{Some of the greatest \emph{discoveries}
in science
were made by accident.}
\textbf{Some of the greatest \emph{discoveries}
in science
were made by accident.}
\emph
命令的實際行爲取決於它所處的環境,在正常文本中,它會讓文字變成斜體,而如果在斜體文字中,它會讓文字變成正常。
有些包,例如beamer
,會改變\emph
指令的默認行爲。