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

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

## 引言

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

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

```latex
这是一个简单示例，{\tiny this will show different font sizes} 以及 \textsc{different font styles}。
```

[在 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 huge font size}` 声明大括号中的文本必须格式化为 *huge* 字号。有关可用字号的完整列表，请参见 [参考指南](#reference-guide).

```latex
在这个示例中，{\huge huge font size} 被设置，并且
the {\footnotesize Foot note size also}. 还有一个相当
大的字号集合。
```

[在 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{A command is used to change the style
of a sentence}.

\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{in a different
字体样式} 以突出显示它。
```

[在 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}
%Example of different font sizes and types
这是一个简单示例，{\tiny this will show different font sizes} 以及 \textsc{different font styles}。

\vspace{1cm}

%Example of different font sizes and types
在这个示例中，{\huge huge font size} 被设置，并且 {\footnotesize Foot note size also} 也被设置。字号范围相当大。

\vspace{1cm}

%Example of different font sizes and types
在这个示例中，使用了一个命令和一个切换命令。 \texttt{A command is used to change the style of a sentence}.

\sffamily
一个切换命令会将样式从这一点更改到文档末尾，除非使用另一个切换命令。
\rmfamily

\vspace{1cm}

%Example of different font sizes and types
这段文本的一部分写成了 \textsl{in different font style} 以突出显示它。
\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{Sample Text 0123}` | `\rmfamily` | ![F-textrm.png](/files/94e261d5137134d08067f897ec99cb5e3c558bf1) |
| 无衬线体     | `\textsf{Sample Text 0123}` | `\sffamily` | ![F-textsf.png](/files/72937fad49530ee954fa5db98ddb12755152ed59) |
| 打字机体（等宽） | `\texttt{Sample Text 0123}` | `\ttfamily` | ![F-texttt.png](/files/549d749c7c93a796746631a1c8d0a75517b7af58) |

**字体样式**

| style | 命令                          | 切换命令        | 输出                                                                |
| ----- | --------------------------- | ----------- | ----------------------------------------------------------------- |
| 中等    | `\textmd{Sample Text 0123}` | `\mdseries` | ![F-textmd.png](/files/c9619d63d93d71249ece3e632bbb6464afb6572b)  |
| 粗体    | `\textbf{Sample Text 0123}` | `\bfseries` | ![F-textbf.png](/files/205dc7bb8d6c8778dbcddd75fbd782e166b018c1)  |
| 直立    | `\textup{Sample Text 0123}` | `\upshape`  | ![F-textrm.png](/files/94e261d5137134d08067f897ec99cb5e3c558bf1)  |
| 斜体    | `\textit{Sample Text 0123}` | `\itshape`  | ![F-textit2.png](/files/e87e56c1a8c69047e31fdbbd031fc9ff693654d0) |
| 倾斜    | `\textsl{Sample Text 0123}` | `\slshape`  | ![F-textsl.png](/files/3c9f99ab56686280fa0d7e45c5bf31b21e2e7a53)  |
| 小型大写  | `\textsc{Sample Text 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://ayakaleaf-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.
