> 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/shen-ru-wen-zhang/38-step-2-an-introduction-to-latex-fonts.md).

# 步驟 2：LaTeX 字型簡介

[簡介](https://www.overleaf.com/learn/latex/Articles/How_to_use_OpenType_variable_fonts_with_LaTeX?preview=true) [步驟 1](https://www.overleaf.com/learn/latex/Articles/Step_1:_Setting_up_an_Overleaf_project_to_use_variable_fonts?preview=true) [步驟 2](https://www.overleaf.com/learn/latex/Articles/Step_2:_An_introduction_to_LaTeX_fonts?preview=true) [步驟 3](https://www.overleaf.com/learn/latex/Articles/Step_3:_Replacing_LaTeX’s_default_fonts_with_variable_fonts?preview=true) [步驟 4](https://www.overleaf.com/learn/latex/Articles/Step_4:_How_to_configure_an_italic_variable_font_using_fontspec?preview=true) [步驟 5](https://www.overleaf.com/learn/latex/Articles/Step_5:_LaTeX_font_weights_and_named_instances_of_variable_fonts?preview=true) [步驟 6](https://www.overleaf.com/learn/latex/Articles/Step_6:_Using_variable_fonts_to_add_bold_fonts_to_an_Overleaf_project?preview=true) [步驟 7](https://www.overleaf.com/learn/latex/Articles/Step_7:_Using_Noto_Sans_and_Roboto_Mono_variable_fonts_with_LaTeX?preview=true) [步驟 8](https://www.overleaf.com/learn/latex/Articles/Step_8:_How_to_create_a_simple_LaTeX_package_to_configure_your_variable_fonts?preview=true) [範例與專案](https://www.overleaf.com/learn/latex/Articles/Overleaf_projects_showing_how_to_use_variable_fonts_with_LaTeX?preview=true)

這一步將介紹 LaTeX 的預設字型，並總結 LaTeX 用來分類字型屬性與定義「字型字形」的字型選擇機制。本文中討論的主題會在本教學的其餘部分反覆提及。花幾分鐘閱讀這一頁，將有助於你充分運用這系列教學。

### LaTeX 的預設文件文字字型

LaTeX 使用三組字型來排版任何文件的文字。這些字型組也稱為 *文件字型家族*；每個家族都包含一套具有共同設計特徵的字型：

* **主要文字家族**：用於文件主要文字的字型，通常採用 [襯線設計](https://en.wikipedia.org/wiki/Serif).
* [**無襯線**](https://en.wikipedia.org/wiki/Sans-serif) **家族**：常用於排版章節標題及其他醒目文字的字型。
* [**等寬**](https://en.wikipedia.org/wiki/Monospaced_font) **家族**：通常用於排版電腦程式碼及類似內容的字型。

預設情況下，LaTeX 使用來自 [Computer Moder](https://en.wikipedia.org/wiki/Computer_Modern)n 系列（適用於 pdfLaTeX），或 [Latin Modern](https://tug.org/FontCatalogue/latinmodernroman/) 系列（適用於 XeLaTeX 與 LuaLaTeX）。

### LaTeX 如何分類（組織）其字型

可供文字排版的字型選擇非常多，且為了滿足特定排版目標而創造出的設計也極為多樣。為了駕馭這種多樣性，任何靈活且合乎邏輯的字型選擇流程，都需要一套結構良好的系統，來依據設計特徵組織與分類字型。LaTeX 透過其新字型選擇機制（New Font Selection Scheme），現稱 NFSS2，來處理這個挑戰；它會依據五個參數為每個文字字型分類： *編碼*, *家族*, *系列*, *字形*、以及 *大小*.

以下是這五個參數的摘要。

* **編碼**：文字檔案中儲存的整數（字元編碼）值與其所要代表字元之間的對應關係。LuaLaTeX 與可變字型使用 Unicode 編碼，LaTeX 以「TU」表示。
* **家族**：一組具有共同設計的字型所給予的名稱。我們會在使用 fontspec 設定可變字型時探討字型家族。
* **系列**：系列值可識別字型的字重（粗細）與字寬（壓縮程度）。每個 LaTeX 字型系列值都定義為一個 `⟨字重⟩⟨字寬⟩` 的組合， *但* m 會被省略，除非字重與字寬皆為中等；在那種情況下，會使用單一個 `m` m。

下表列出 LaTeX 的標準字寬與字重識別碼。

|             |        |             |      |                          |
| ----------- | ------ | ----------- | ---- | ------------------------ |
| **字重**      | **字寬** |             |      |                          |
| *LaTeX 識別碼* | *名稱*   | *LaTeX 識別碼* | *名稱* | *「正常」寬度的百分比*<sup>†</sup> |
| ul          | 極細     | uc          | 超壓縮  | 50%                      |
| el          | 超細     | ec          | 極壓縮  | 62.5%                    |
| l           | 細      | c           | 壓縮   | 75%                      |
| sl          | 半細     | sc          | 半壓縮  | 87.5%                    |
| m           | 中等（一般） | m           | 中等   | 100%                     |
| sb          | 半粗     | sx          | 半展開  | 112.5%                   |
| b           | 粗體     | x           | 展開   | 125%                     |
| eb          | 超粗     | ex          | 極展開  | 150%                     |
| ub          | 極粗     | ux          | 超展開  | 200%                     |

<sup>†</sup>正如 LaTeX 官方文件所建議（見 `[fntguide.pdf](https://ctan.org/pkg/fntguide?lang=en)`).

以下是一些字型系列的範例：

* **m**：中等字重與中等字寬。
* **b**：粗體字重與中等字寬——理論上「應該」寫成 **bm** 但 **m** （表示中等字寬）被省略了。
* **c**：中等字重、壓縮字寬——理論上「應該」寫成 **mc** 但 **m** （表示中等字重）被省略了。
* **sb**：半粗字重、中等字寬——理論上「應該」寫成 **sbm** 但 **m** （表示中等字寬）被省略了。
* **bx**：結合了字重 **b** （粗體）與字寬 **x** （展開）。它用來選取目前字型家族中的粗展開字型（若此字型存在）。
* **sbc**：結合了字重 **sb** （半粗）與字寬 **c** （壓縮）。它用來選取目前字型家族中的半粗壓縮字型（若此字型存在）。
* **字形**：此參數用來選取字型形式（字形），例如斜體、傾斜、小型大寫與花體大寫。LaTeX 定義了一組標準字形：

|           |               |
| --------- | ------------- |
| **字形識別碼** | **字形名稱**      |
| n         | 正常字形（直立）      |
| it        | 斜體字形          |
| sl        | 傾斜（斜歪）字形      |
| sw        | 花體字形          |
| ui        | 直立斜體字形（罕見／特殊） |
| sc        | 小型大寫字形        |
| scit      | 斜體小型大寫字形      |
| scsl      | 傾斜小型大寫字形      |

* **大小**：字型使用時的大小。LaTeX 有幾個預先定義的大小命令，例如 `\tiny`, `\small`, `\normalsize`, `\large`, `\Large`，等等。你也可以使用 `\fontsize{size}{baselineskip}` 其中 `大小` 是字型大小，而 `baselineskip` 是行距。

### （可選閱讀）特殊系列與字形

這一節在第一次閱讀時可以略過。Overleaf 建立了一個 [專案，展示這些特殊系列與字形](https://www.overleaf.com/1941895198cqjzyhzvxhwz#794ae2) （見排版文件的第 6 節）。

#### 系列識別碼：m? 與 ?m

回想一下，每個系列識別碼都定義為一個 `⟨字重⟩⟨字寬⟩` 成對值，LaTeX 提供另外兩個識別碼，用於選取字重與字寬：

* `m?` 表示選取中等字重，但維持目前的字寬設定不變。
* `?m` 表示維持目前字重不變，但選取中等字寬。

#### 「虛擬」字形

LaTeX 支援兩種所謂的「虛擬」字形。所謂「虛擬」，是因為它們只打算作為 `\fontshape` 命令套用時的參數——這些字形並不存在為實際字型。

| **虛擬字形識別碼** | **動作**      | **命令**          | **宣告**      | **備註**                                                                            |
| ----------- | ----------- | --------------- | ----------- | --------------------------------------------------------------------------------- |
| `up`        | 回到直立字形。     | `\textup{...}`  | `\upshape`  | 它會將字形改為直立，但會保留小型大寫字形。例如，up 會將 `scit` 字形改為 `sc`。特例：如果目前字形是 `sc` 則 up 會變成正常字形（`n`). |
| `ucl`       | 回到大／小寫字母字形。 | `\textulc{...}` | `\uclshape` | 將字型字形變更為大／小寫，但不會改變斜體、傾斜或花體字形。                                                     |

## 在下一步

步驟 3 會示範如何以可變字型取代 LaTeX 的預設字型。

[簡介](https://www.overleaf.com/learn/latex/Articles/How_to_use_OpenType_variable_fonts_with_LaTeX?preview=true) [步驟 1](https://www.overleaf.com/learn/latex/Articles/Step_1:_Setting_up_an_Overleaf_project_to_use_variable_fonts?preview=true) [步驟 2](https://www.overleaf.com/learn/latex/Articles/Step_2:_An_introduction_to_LaTeX_fonts?preview=true) [步驟 3](https://www.overleaf.com/learn/latex/Articles/Step_3:_Replacing_LaTeX’s_default_fonts_with_variable_fonts?preview=true) [步驟 4](https://www.overleaf.com/learn/latex/Articles/Step_4:_How_to_configure_an_italic_variable_font_using_fontspec?preview=true) [步驟 5](https://www.overleaf.com/learn/latex/Articles/Step_5:_LaTeX_font_weights_and_named_instances_of_variable_fonts?preview=true) [步驟 6](https://www.overleaf.com/learn/latex/Articles/Step_6:_Using_variable_fonts_to_add_bold_fonts_to_an_Overleaf_project?preview=true) [步驟 7](https://www.overleaf.com/learn/latex/Articles/Step_7:_Using_Noto_Sans_and_Roboto_Mono_variable_fonts_with_LaTeX?preview=true) [步驟 8](https://www.overleaf.com/learn/latex/Articles/Step_8:_How_to_create_a_simple_LaTeX_package_to_configure_your_variable_fonts?preview=true) [範例與專案](https://www.overleaf.com/learn/latex/Articles/Overleaf_projects_showing_how_to_use_variable_fonts_with_LaTeX?preview=true)


---

# 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/shen-ru-wen-zhang/38-step-2-an-introduction-to-latex-fonts.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.
