> For the complete documentation index, see [llms.txt](https://overleaf-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://overleaf-pro.ayaka.space/latex/zh-tw/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/f4ce69681e21ae2bffb270ff738dc54860710555)

如你所見，這裡有三個基本指令，而且它們可以巢狀使用以得到組合效果。

注意：來自 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/21c33b5e4f9a5c591d04c45a23d6d83bd91bf7b8)

## 粗體文字

要將文字設為粗體，使用 `\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/5cbf7f5e5bd18bd320a863e60a341eebea5a35f0)

## 底線文字

要為文字加上底線，使用 `\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/c0d5485931852ef958325dbc8747404faa6e4c54)

## 強調文字

可以使用 `\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/15c48b4f091b8890c1622daddff1ca21c6b8cd52)

這個 `\emph` 指令實際上如何處理其參數取決於上下文——在一般文字中，強調文字會以斜體顯示，但若在斜體文字中使用，則此行為會相反——見上例。此外，有些套件，例如 [Beamer](/latex/zh-tw/jian-bao/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-tw/latex-ji-chu/02-paragraphs-and-new-lines.md)
* [清單](/latex/zh-tw/latex-ji-chu/04-lists.md)
* [段落格式](/latex/zh-tw/ge-shi-hua/04-articles-how-to-change-paragraph-spacing-in-latex.md)
* [換行與空白](/latex/zh-tw/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://overleaf-pro.ayaka.space/latex/zh-tw/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.
