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

# LaTeX 中的長度

在 LaTeX 中，有許多長度用來決定已排版文件的各種尺寸。例如，指定的尺寸參數可用來描述 [字型](/latex/zh-tw/zi-xing/01-font-sizes-families-and-styles.md), [pages](/latex/zh-tw/ge-shi-hua/07-page-size-and-margins.md)，或 [段落](/latex/zh-tw/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/dd7e9e34ba8b21fc6eed64368f2bcff54c837bd7)

[在 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/9e3d66e1142208cf25a6aa765432ee536d7105c3)

以下是一些最常見長度及其說明的表格

| 長度                | 說明                      |
| ----------------- | ----------------------- |
| `\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/dad4c791e841d04d981c4e4ea3e9d697b403f830)

在指令 `\includegraphics` 中，寬度設定為整個文字區域寬度的 0.25（請參見 [插入圖片](/latex/zh-tw/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-tw/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.
