> 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/ge-shi-hua/01-lengths-in-latex.md).

# LaTeX 中的长度

在 LaTeX 中，有许多长度用于确定已排版文档的各种尺寸。例如，指定的尺寸参数可以描述 [字体](/latex/zh-cn/zi-ti/01-font-sizes-families-and-styles.md), [pages](/latex/zh-cn/ge-shi-hua/07-page-size-and-margins.md)，或 [段落](/latex/zh-cn/ge-shi-hua/04-articles-how-to-change-paragraph-spacing-in-latex.md).

## 单位

下面是 LaTeX 中可用单位的说明。

| 缩写     | 数值                                                                                    |
| ------ | ------------------------------------------------------------------------------------- |
| **pt** | point 大约等于 1/72.27 英寸，也就是说大约 0.0138 英寸或 0.3515 毫米（准确地说，point 被定义为美国 *印刷英尺* 的 249/250） |
| **mm** | 毫米                                                                                    |
| **cm** | 厘米                                                                                    |
| **在**  | 英寸                                                                                    |
| **ex** | 大致等于当前字体中一个 'x'（小写）的高度（这取决于所用字体）                                                      |
| **em** | 大致等于当前字体中一个 'M'（大写）的宽度（这取决于所用字体）                                                      |
| **mu** | 一种数学单位，等于 1/18 em，其中 em 取自数学符号字体族                                                     |
| **sp** | 所谓“特殊点”，一种底层计量单位，其中 65536sp=1pt                                                       |

下面是一个示例，展示 ex 和 em 单位之间的差异。

```latex
\documentclass[twocolumn]{article}
\usepackage{blindtext}
\usepackage{graphicx}

\setlength{\columnsep}{1in}

\begin{document}

\texttt{10ex} 的宽度会产生：

\includegraphics[width=10ex]{overleaf-logo}
\vspace{5mm}

\texttt{10em} 的宽度会产生：

\includegraphics[width=10em]{overleaf-logo}

\end{document}
```

![LengthsEx1OverleafUpdated.png](/files/f8d5fb076adb49001dd6505e49454b2c2ce74038)

[在 Overleaf 中打开示例](https://www.overleaf.com/project/new/template/19506?id=65960656\&templateName=Length+types+and+values+in+LaTeX\&latexEngine=pdflatex\&texImage=texlive-full%3A2020.1\&mainFile=)

## 长度

长度是相对于某些文档元素的距离单位。长度可以通过以下命令更改：

```latex
\setlength{\lengthname}{value_in_specified_unit}
```

例如，在双栏文档中，可以通过以下方式将栏间距设为 1 英寸：

```latex
\setlength{\columnsep}{1in}
```

![LengthsEx2.png](/files/b07468a12320d94f0ce46aca7354252931671672)

下面是一张包含一些最常见长度及其说明的表格

| 长度                | 说明                     |
| ----------------- | ---------------------- |
| `\baselineskip`   | 段落中各行之间的垂直距离           |
| `\columnsep`      | 栏与栏之间的距离               |
| `\columnwidth`    | 一栏的宽度                  |
| `\evensidemargin` | 偶数页的页边距，通常用于书籍等双面文档    |
| `\linewidth`      | 当前环境中该行的宽度。            |
| `\oddsidemargin`  | 奇数页的页边距，通常用于书籍等双面文档    |
| `\paperwidth`     | 页面宽度                   |
| `\paperheight`    | 页面高度                   |
| `\parindent`      | 段落缩进                   |
| `\parskip`        | 段落之间的垂直间距              |
| `\tabcolsep`      | 表格中各列之间的间距（tabular 环境） |
| `\\textheight`    | 页面中文本区域的高度             |
| `\textwidth`      | 页面中文本区域的宽度             |
| `\topmargin`      | 上边距的长度                 |

[在 Overleaf 中打开示例](https://www.overleaf.com/project/new/template/19506?id=65960656\&templateName=Length+types+and+values+in+LaTeX\&latexEngine=pdflatex\&texImage=texlive-full%3A2020.1\&mainFile=)

## 将长度用作单位

默认长度可以设置为任何所需值，最大约为 16384pt（或 5.75 米），这是 TeX 引擎内置的硬编码限制。LaTeX 的长度参数也可以作为单位，用于设置其他 LaTeX 元素的尺寸。例如，你可以将图像设置为总文本宽度的四分之一：

```latex
\includegraphics[width=0.25\textwidth]{overleaf-logo}
[...]
```

![LengthsEx3OverleafV2.png](/files/f8f0d8f863d45ace23a81d285eb7091c09db31fa)

在命令 `\includegraphics` 中，宽度被设置为整个文本区域宽度的 0.25 倍（有关此命令的更多信息请参见 [插入图片](/latex/zh-cn/geng-duo-zhu-ti/27-inserting-images.md) 。你可以使用任意长度，并将其乘以任意因子。

[在 Overleaf 中打开示例](https://www.overleaf.com/project/new/template/19506?id=65960656\&templateName=Length+types+and+values+in+LaTeX\&latexEngine=pdflatex\&texImage=texlive-full%3A2020.1\&mainFile=)

## 进一步阅读

更多信息请参见 [wikibooks 上关于长度的文章](http://en.wikibooks.org/wiki/LaTeX/Lengths).


---

# 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/ge-shi-hua/01-lengths-in-latex.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.
