> 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-cn/zi-ti/01-font-sizes-families-and-styles.md).

# 字体大小、字体族和样式

## 引言

LaTeX 通常会根据文档的逻辑结构（例如各章节）选择合适的字体和字号。在某些情况下，你可能希望手动设置字体和大小。

下面的示例展示了如何在 LaTeX 中使用最小可用字号（`\tiny`）以及小型大写字母（`\textsc{...}`）字体样式：

```latex
这是一个简单的示例，{\tiny 这将显示不同的字号}，同时也会显示 \textsc{不同的字体样式}。
```

[在 Overleaf 中打开此示例](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Font+sizes+and+styles\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0AThis+is+a+simple+example%2C+%7B%5Ctiny+this+will+show+different+font+sizes%7D+and+also+%5Ctextsc%7Bdifferent+font+styles%7D.%0A%5Cend%7Bdocument%7D)

下图显示了上述示例生成的输出： ![FontStyles.png](/files/f39ee322f9c07299c0bd2c5cc6bc3088f5aad13e)

## 字号

字号由特殊名称标识，实际大小不是绝对的，而是相对于在 `\documentclass` 语句中声明的字号（见 [在 LaTeX 中创建文档](/latex/zh-cn/latex-ji-chu/01-learn-latex-in-30-minutes.md)).

在下面的示例中， `{\huge 超大字号}` 声明大括号中的文本必须排版为 *超大* 字号。有关可用字号的完整列表，请参见 [参考指南](#reference-guide).

```latex
在这个示例中设置了 {\huge 超大字号}，并且
还设置了 {\footnotesize 脚注大小}。可用的字号种类相当
丰富。
```

[在 Overleaf 中打开此示例](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Huge+font+size\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0AIn+this+example+the+%7B%5Chuge+huge+font+size%7D+is+set+and+%0Athe+%7B%5Cfootnotesize+Foot+note+size+also%7D.+There%27s+a+fairly+%0Alarge+set+of+font+sizes.%0A%5Cend%7Bdocument%7D)

下图显示了上述示例生成的输出： ![FontSizesOLV2.png](/files/1cdcaabe3f42cc5c6f87a8fd078a74f1d0dcee0c)

## 字体族

默认情况下，在标准 LaTeX 类中，文本的默认样式通常是罗马体（直立）衬线字体。要使用其他样式（**字体族**）例如无衬线、打字机体（等宽）等，你需要使用一些特定的 LaTeX 命令，如下例所示：

```latex
在这个示例中，使用了一个命令和一个切换。
\texttt{使用一个命令来改变句子的样式
。}

\sffamily
切换会从这一点开始改变样式，直到
文档结束，除非使用了另一个切换。
```

[在 Overleaf 中打开此示例](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Choosing+type+styles\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0AIn+this+example%2C+a+command+and+a+switch+are+used.+%0A%5Ctexttt%7BA+command+is+used+to+change+the+style+%0Aof+a+sentence%7D.%0A%0A%5Csffamily%0AA+switch+changes+the+style+from+this+point+to+%0Athe+end+of+the+document+unless+another+switch+is+used.%0A%5Cend%7Bdocument%7D)

下图显示了上述示例生成的输出：

![UsingFontStyles2.png](/files/6f7340bc65061a8e8d2b2560c516be4cc428740b)

你可以通过使用以下命令，将无衬线字体设置为 LaTeX 文档中的默认字体：

```latex
 \renewcommand{\familydefault}{\sfdefault}
```

同样地，要将罗马字体设为默认字体：

```latex
 \renewcommand{\familydefault}{\rmdefault}
```

## 字体样式

LaTeX 中最常见的字体样式是 [粗体、斜体和下划线](/latex/zh-cn/latex-ji-chu/03-bold-italics-and-underlining.md)，但还有其他一些。

在下面的示例中， `\textsl` 命令将文本设置为 *倾斜* 样式，这会使文本看起来有点像 *斜体*，但又不完全一样。请参见 [参考指南](#reference-guide) 以获取字体样式的完整列表。

```latex
这段文本的一部分写成了 \textsl{不同的
字体样式}，以突出显示它。
```

[在 Overleaf 中打开此示例](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Using+slanted+text\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0APart+of+this+text+is+written+%5Ctextsl%7Bin+a+different+%0Afont+style%7D+to+highlight+it.%0A%5Cend%7Bdocument%7D)

下图显示了上述示例生成的输出：

![UsingSlantedText.png](/files/6d35cdc2e1885f257a44e095b5eada210c51cc4a)

如果你想切换回“正常”字体样式（你所使用的 LaTeX 类的默认样式），可以使用 `\textnormal{...}` 命令或 `\normalfont` 切换命令。

## 综合起来

下面的示例将本文中使用的各种 LaTeX 代码片段组合在一起。

```latex
\documentclass{article}
\begin{document}
%不同字号和字体类型的示例
这是一个简单的示例，{\tiny 这将显示不同的字号}，同时也会显示 \textsc{不同的字体样式}。

\vspace{1cm}

%不同字号和字体类型的示例
在这个示例中设置了 {\huge 超大字号}，并且也设置了 {\footnotesize 脚注大小}。可用的字号种类相当丰富。

\vspace{1cm}

%不同字号和字体类型的示例
在这个示例中，使用了一个命令和一个切换。 \texttt{使用一个命令来改变句子的样式}。

\sffamily
切换会从这一点开始改变样式，直到文档结束，除非使用了另一个切换。
\rmfamily

\vspace{1cm}

%不同字号和字体类型的示例
这段文本的一部分写成了 \textsl{不同的字体样式}，以突出显示它。
\end{document}
```

[在 Overleaf 中打开此示例](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Example+using+font+styles%2C+sizes+and+famlies\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0A%25Example+of+different+font+sizes+and+types%0AThis+is+a+simple+example%2C+%7B%5Ctiny+this+will+show+different+font+sizes%7D+and+also+%5Ctextsc%7Bdifferent+font+styles%7D.+%0A%0A%5Cvspace%7B1cm%7D%0A%0A%25Example+of+different+font+sizes+and+types%0AIn+this+example+the+%7B%5Chuge+huge+font+size%7D+is+set+and+the+%7B%5Cfootnotesize+Foot+note+size+also%7D.+There%27s+a+fairly+large+set+of+font+sizes.%0A%0A%5Cvspace%7B1cm%7D%0A%0A%25Example+of+different+font+sizes+and+types%0AIn+this+example%2C+a+command+and+a+switch+are+used.+%5Ctexttt%7BA+command+is+used+to+change+the+style+of+a+sentence%7D.%0A%0A%5Csffamily%0AA+switch+changes+the+style+from+this+point+to+the+end+of+the+document+unless+another+switch+is+used.%0A%5Crmfamily%0A%0A%5Cvspace%7B1cm%7D%0A%0A%25Example+of+different+font+sizes+and+types%0APart+of+this+text+is+written+%5Ctextsl%7Bin+different+font+style%7D+to+highlight+it.%0A%5Cend%7Bdocument%7D)

## 参考指南

**字号**

| 命令            | 输出                                                                     |
| ------------- | ---------------------------------------------------------------------- |
| \tiny         | ![F-tiny.png](/files/2c075cfb4b3f920c4d68b9fd828f31fb46692b38)         |
| \scriptsize   | ![F-scriptsize.png](/files/11b2c98f23dc917e7f041f6f987fe3059aa61738)   |
| \footnotesize | ![F-footnotesize.png](/files/fbdcf30e3c2549e7643a67f8bd84728511c1f0db) |
| \small        | ![F-small.png](/files/f741c2b31e42b1ca3d8d2d8d942e17485474eb87)        |
| \normalsize   | ![F-normalsize.png](/files/8cd22484eebf3b70942e4e665628913dbf90f98b)   |
| \large        | ![F-large.png](/files/8125ec4f52bf9f6ebcd45c4f0caf893fe7ba1cec)        |
| \Large        | ![F-large2.png](/files/fa72c0fd780670442cdf82c2abccd43be0efa87f)       |
| \LARGE        | ![F-large3.png](/files/27635511164f2ff7ee6fcfb2c8ab2ebb0bb2ad40)       |
| \huge         | ![F-huge.png](/files/b130cad9510709da40f20922a6ee267be048cd07)         |
| \Huge         | ![F-huge2.png](/files/cbd462922278de58c991ffe734a7bbc22dfaddf7)        |

**默认字体族**

| 字形 = 字族  | 命令                   | 切换命令        | 输出                                                               |
| -------- | -------------------- | ----------- | ---------------------------------------------------------------- |
| 衬线体（罗马体） | `\textrm{示例文本 0123}` | `\rmfamily` | ![F-textrm.png](/files/94e261d5137134d08067f897ec99cb5e3c558bf1) |
| 无衬线      | `\textsf{示例文本 0123}` | `\sffamily` | ![F-textsf.png](/files/72937fad49530ee954fa5db98ddb12755152ed59) |
| 打字机体（等宽） | `\texttt{示例文本 0123}` | `\ttfamily` | ![F-texttt.png](/files/549d749c7c93a796746631a1c8d0a75517b7af58) |

**字体样式**

| 样式     | 命令                   | 切换命令        | 输出                                                                |
| ------ | -------------------- | ----------- | ----------------------------------------------------------------- |
| 中等     | `\textmd{示例文本 0123}` | `\mdseries` | ![F-textmd.png](/files/c9619d63d93d71249ece3e632bbb6464afb6572b)  |
| 粗体     | `\textbf{示例文本 0123}` | `\bfseries` | ![F-textbf.png](/files/205dc7bb8d6c8778dbcddd75fbd782e166b018c1)  |
| 直立     | `\textup{示例文本 0123}` | `\upshape`  | ![F-textrm.png](/files/94e261d5137134d08067f897ec99cb5e3c558bf1)  |
| 斜体     | `\textit{示例文本 0123}` | `\itshape`  | ![F-textit2.png](/files/e87e56c1a8c69047e31fdbbd031fc9ff693654d0) |
| 倾斜     | `\textsl{示例文本 0123}` | `\slshape`  | ![F-textsl.png](/files/3c9f99ab56686280fa0d7e45c5bf31b21e2e7a53)  |
| 小型大写字母 | `\textsc{示例文本 0123}` | `\scshape`  | ![F-textsc.png](/files/820883dc456ccc6a80188bb98a2ebdf2eba9f9b4)  |

## 进一步阅读

更多信息请参见：

* [字体字形](/latex/zh-cn/zi-ti/02-font-typefaces.md)
* [使用 XeLaTeX 支持现代字体](/latex/zh-cn/zi-ti/03-xelatex.md)
* [加粗、斜体和下划线](/latex/zh-cn/latex-ji-chu/03-bold-italics-and-underlining.md)
* [文本对齐](/latex/zh-cn/ge-shi-hua/06-text-alignment.md)
* [多栏](/latex/zh-cn/ge-shi-hua/09-multiple-columns.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)
* [国际语言支持](/latex/zh-cn/yu-yan/03-international-language-support.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-cn/zi-ti/01-font-sizes-families-and-styles.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.
