> For the complete documentation index, see [llms.txt](https://ayakaleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ayakaleaf-pro.ayaka.space/latex/zh-cn/latex-ji-chu/03-bold-italics-and-underlining.md).

# 加粗、斜体与下划线

## 引言

简单的文本格式设置有助于突出文档中的重要概念，并使其更易读。使用斜体、粗体或带下划线的词语会改变读者的感知。

本文将介绍三种基本的文本格式工具：斜体、粗体和下划线。让我们从一个例子开始：

```latex
一些 \textbf{最伟大的}
在 \underline{科学} 中的发现
是由 \textbf{\textit{偶然}} 发现的。
```

[在 Overleaf 中打开此 LaTeX 片段。](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=text+formatting+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0ASome+of+the+%5Ctextbf%7Bgreatest%7D+%0Adiscoveries+in+%5Cunderline%7Bscience%7D+%0Awere+made+by+%5Ctextbf%7B%5Ctextit%7Baccident%7D%7D.%0A%5Cend%7Bdocument%7D)

下图显示了此 LaTeX 代码的输出——文档导言区会由 Overleaf 链接自动添加：

![斜体、粗体和下划线示例](/files/7e25e8e77154997629472f1f7e426ec2aed70fed)

如你所见，这里有三个基本命令，而且它们可以嵌套以获得组合效果。

注意：来自 plain TeX 的原始文本格式命令， `\it` （斜体）以及 `\bf` （粗体）在 LaTeX 文档中仍然可以使用，但不建议使用，因为它们不会保留先前的样式。例如，使用这些旧命令时，你不能同时应用斜体和粗体。

## 斜体文本

将文本设置为斜体很简单，使用 `\textit` (`\emph`）命令：

```latex
一些最伟大的
科学中的发现
是由 \textit{偶然} 发现的。
```

[在 Overleaf 中打开此 LaTeX 片段。](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=italic+text+formatting+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0ASome+of+the+greatest+%0Adiscoveries+in+science+%0Awere+made+by+%5Ctextit%7Baccident%7D.%0A%5Cend%7Bdocument%7D)

下图显示了此 LaTeX 代码的输出——文档导言区会由 Overleaf 链接自动添加：

![斜体文本示例](/files/b8f38b34a4ac2ba9f106e04cbff7f1f7662de86b)

## 粗体文本

将文本设置为粗体，请使用 `\textbf` 命令：

```latex
一些 \textbf{最伟大的}
科学中的发现
是偶然发现的。
```

[在 Overleaf 中打开此 LaTeX 片段。](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=bold+text+formatting+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0ASome+of+the+%5Ctextbf%7Bgreatest%7D+%0Adiscoveries+in+science+%0Awere+made+by+accident.%0A%5Cend%7Bdocument%7D)

下图显示了此 LaTeX 代码的输出——文档导言区会由 Overleaf 链接自动添加：

![Textformattingex3.png](/files/136b55d2aee66cfb751e50473194f3d208dbf3e9)

## 带下划线的文本

为文本添加下划线，请使用 `\underline` 命令：

```latex
一些最伟大的
在 \underline{科学} 中的发现
是偶然发现的。
```

[在 Overleaf 中打开此 LaTeX 片段。](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=underline+text+formatting+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0ASome+of+the+greatest+%0Adiscoveries+in+%5Cunderline%7Bscience%7D+%0Awere+made+by+accident.%0A%5Cend%7Bdocument%7D)

下图显示了此 LaTeX 代码的输出——文档导言区会由 Overleaf 链接自动添加：

![带下划线文本示例](/files/c6912984e745a2727e217235dbc004cde19aa22a)

## 强调文本

可以使用以下命令来强调文本 `\emph` 命令。有时该 `\emph` 命令的行为与 `\textit`，但并不完全相同：

```latex
一些最伟大的 \emph{发现}
在科学中
是偶然发现的。

\textit{一些最伟大的 \emph{发现}
在科学中
是偶然发现的。}

\textbf{一些最伟大的 \emph{发现}
在科学中
是偶然发现的。}
```

[在 Overleaf 中打开此 LaTeX 片段。](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=emphasizing+text+formatting+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0ASome+of+the+greatest+%5Cemph%7Bdiscoveries%7D+%0Ain+science+%0Awere+made+by+accident.%0A%0A%5Ctextit%7BSome+of+the+greatest+%5Cemph%7Bdiscoveries%7D+%0Ain+science+%0Awere+made+by+accident.%7D%0A%0A%5Ctextbf%7BSome+of+the+greatest+%5Cemph%7Bdiscoveries%7D+%0Ain+science+%0Awere+made+by+accident.%7D%0A%5Cend%7Bdocument%7D)

下图显示了此 LaTeX 代码的输出——文档导言区会由 Overleaf 链接自动添加：

![强调文本示例](/files/93ab1cfb1105531912a0354819074e60dac6fb24)

这个 `\emph` 命令实际上对其参数的处理取决于上下文——在普通文本中，强调的文本会以斜体显示，但如果在斜体文本中使用，则这种行为会反过来——见上面的示例。此外，一些宏包，例如 [Beamer](/latex/zh-cn/yan-shi-wen-gao/01-beamer.md)，会改变 `\emph` 该命令。

## 完整示例集

下面的示例汇集了本文中的各个代码片段，以便你可以在 Overleaf 中一次性打开它们。

```latex
第一个示例：粗体、斜体和下划线：

一些 \textbf{最伟大的} 发现是在 \underline{科学} 中由 \textbf{\emph{偶然}} 发现的。

\vspace{1.5cm}

斜体文本示例：

科学中的一些最伟大的发现是由 \emph{偶然} 发现的。

\vspace{1.5cm}

粗体文本示例：

科学中的一些 \textbf{最伟大的} 发现是偶然发现的。

\vspace{1.5cm}

带下划线文本示例：

一些最伟大的发现是在 \underline{科学} 中偶然发现的。

\vspace{1.5cm}

不同上下文中的强调文本示例：

科学中的一些最伟大的 \emph{发现} 是偶然发现的。

\textit{科学中的一些最伟大的 \emph{发现} 是偶然发现的。}

\textbf{科学中的一些最伟大的 \emph{发现} 是偶然发现的。}
```

[在 Overleaf 中打开此 LaTeX 代码。](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=text+formatting+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Ctitle%7BBold%2C+Italics+and+Underline%7D%0A%5Cauthor%7BAn+example+from+Overleaf%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cmaketitle%0AFirst+example%2C+bold%2C+italics+and+underline%3A%0A%0ASome+of+the+%5Ctextbf%7Bgreatest%7D+discoveries+in+%5Cunderline%7Bscience%7D+were+made+by+%5Ctextbf%7B%5Cemph%7Baccident%7D%7D.%0A%0A%5Cvspace%7B1.5cm%7D%0A%0AExample+of+italicized+text%3A+%0A%0ASome+of+the+greatest+discoveries+in+science+were+made+by+%5Cemph%7Baccident%7D.%0A%0A%5Cvspace%7B1.5cm%7D%0A%0AExample+of+boldface+text%3A%0A%0ASome+of+the+%5Ctextbf%7Bgreatest%7D+discoveries+in+science+were+made+by+accident.%0A%0A%5Cvspace%7B1.5cm%7D%0A%0AExample+of+underlined+text%3A%0A%0ASome+of+the+greatest+discoveries+in+%5Cunderline%7Bscience%7D+were+made+by+accident.%0A%0A%5Cvspace%7B1.5cm%7D%0A%0AExample+of+emphasized+text+in+different+contexts%3A%0A%0ASome+of+the+greatest+%5Cemph%7Bdiscoveries%7D+in+science+were+made+by+accident.%0A%0A%5Ctextit%7BSome+of+the+greatest+%5Cemph%7Bdiscoveries%7D+in+science+were+made+by+accident.%7D%0A%0A%5Ctextbf%7BSome+of+the+greatest+%5Cemph%7Bdiscoveries%7D+in+science+were+made+by+accident.%7D%0A%5Cend%7Bdocument%7D)

## 进一步阅读

更多信息请参见

* [段落和换行](/latex/zh-cn/latex-ji-chu/02-paragraphs-and-new-lines.md)
* [列表](/latex/zh-cn/latex-ji-chu/04-lists.md)
* [段落格式设置](/latex/zh-cn/ge-shi-hua/04-articles-how-to-change-paragraph-spacing-in-latex.md)
* [换行和空格](/latex/zh-cn/ge-shi-hua/05-line-breaks-and-blank-spaces.md)
* [LaTeX2ε 的不算太短的介绍](http://www.ctan.org/tex-archive/info/lshort/)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ayakaleaf-pro.ayaka.space/latex/zh-cn/latex-ji-chu/03-bold-italics-and-underlining.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
