> 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/geng-duo-zhu-ti/37-line-breaks-and-blank-spaces-es.md).

# 換行與空白字元 es

除非你正在 [撰寫巨集](/latex/zh-tw/lei-bie-dang/03-writing-your-own-package.md)。不過，有時仍需要對文件的整體排版有更多控制；因此本文將說明如何插入手動換行、分頁與空白。

## 簡介

插入換行非常容易，雙反斜線即可搞定

```latex
\documentclass{article}
\usepackage[utf8]{inputenc}

\begin{document}
本文件中的某些內容。這個段落沒有任何資訊
而其目的在於提供一個如何插入空白
與換行的範例。\\
當插入換行時，文字不會縮排，還有
幾個額外的命令可用來換行。
\end{document}
```

![LineBreaksEx1.png](/files/119e5c444f98788b7e5a08d27237127df26081bd)

這並不是插入換行的唯一命令，在 [下一節中](#saltos-de-lnea) 還會介紹另外兩個。

[在 Overleaf 中開啟範例](https://www.sharelatex.com/project/new/template?zipUrl=/project/5352974bc52fabc07908a43a/download/zip\&templateName=BreakLines\&compiler=pdflatex)

## 換行

如前所述，插入換行不只一種方法。

```latex
\documentclass{article}
\usepackage[utf8]{inputenc}

\begin{document}
本文件中的某些內容。這個段落沒有任何資訊
而其目的在於提供一個如何插入空白
與換行的範例。\\
當插入換行時，文字不會縮排，還有
幾個額外的命令可用來換行。 \newline
本段落完全沒有提供任何資訊。我們正在探討
換行。 \hfill \break
以及結合兩個命令
\end{document}
```

![LineBreaksEx2.png](/files/08adfdc96db8336789195ef6ca244558e6e91210)

這裡有三個命令在範例中執行相同的功能：

* `\\` （兩個反斜線）
* `\newline`
* `\hfill \break`

若要查看更多插入換行的命令，請參考 [參考指南](#gua-de-referencia).

[在 Overleaf 中開啟範例](https://www.sharelatex.com/project/new/template?zipUrl=/project/5352974bc52fabc07908a43a/download/zip\&templateName=BreakLines\&compiler=pdflatex)

## 分頁

有兩個命令可用來插入分頁， `clearpage` 和 `newpage`。接下來是一個使用 `clearpage`.

```latex
\documentclass{article}
\usepackage[utf8]{inputenc}

\begin{document}
本文件中的某些內容。這個段落沒有任何資訊，而且
其目的在於提供一個如何插入空白
與換行的範例。\\
當插入換行時，文字不會縮排，還有幾個
額外的命令可用來換行。 \newline
本段落完全沒有提供任何資訊。我們正在探討
換行。 \hfill \break
以及結合兩個命令

\begin{figure}
\centering
\includegraphics[width=4cm]{lion-logo}
\caption{ShareLaTeX 標誌}
\end{figure}

哈囉，  這裡  有  一些  沒有  意義...
\clearpage
```

![LineBreaksEx3.png](/files/07ad179e5204de89c9dc4ada703ee157e8fb91f2)

如果使用命令 `clearpage` 而且若有排隊中的浮動元素，例如表格和圖形，所有這些元素都會在開始新頁面之前先插入。在前面的範例中，同一張圖片被插入了三次。由於分頁是在三張圖片出現在文件中之前插入的，因此缺少的圖片會先被插入到一個空白頁面上，然後才繼續分頁之後的文字。

如果這不是你需要的，你可以改用 `\newpage` 來看看一個範例：

```latex
\documentclass{article}
\usepackage[utf8]{inputenc}

\begin{document}
本文件中的某些內容。這個段落沒有任何資訊，而且
其目的在於提供一個如何插入空白
與換行的範例。\\
當插入換行時，文字不會縮排，還有幾個
額外的命令可用來換行。 \newline
本段落完全沒有提供任何資訊。我們正在探討
換行。 \hfill \break
以及結合兩個命令

\begin{figure}
\centering
\includegraphics[width=4cm]{lion-logo}
\caption{ShareLaTeX 標誌}
\end{figure}

哈囉，  這裡  有  一些  沒有  意義...
\newpage
```

![LineBreaksEx4.png](/files/34ddfeb90cf1bba54fb4fa85b0f15b60f3c6bdd1)

在這種情況下，圖片會被放到新頁面上，但仍盡量融入文字流程中。

[在 Overleaf 中開啟範例](https://www.sharelatex.com/project/new/template?zipUrl=/project/5352974bc52fabc07908a43a/download/zip\&templateName=BreakLines\&compiler=pdflatex)

## 水平空白

可使用命令插入任意長度的水平空白 `\hspace`.

```latex
可手動插入水平空白 \hspace{1cm}。這對於
控制圖片版面的精細調整很有用。

左側 \hfill 右側
```

![LineBreaksEx5.png](/files/19584402754d3bae16f2ed1233792cd17c5cf154)

在這個範例中，有兩個命令會插入空白：

**\hspace{1cm}**

插入長度為 1cm 的水平空白。這個命令也可搭配其他長度單位使用。

**\hfill**

插入一個會動態擴展、以佔滿所有可用空間的空白。

命令 `\hrulefill` 和 `\dotfill` 具有與 `\hfill` 相同的功能，但不是插入空白，而是分別插入一條水平線或一串點。

[在 Overleaf 中開啟範例](https://www.sharelatex.com/project/new/template?zipUrl=/project/5352974bc52fabc07908a43a/download/zip\&templateName=BreakLines\&compiler=pdflatex)

## 垂直空白

插入垂直空白時，語法與水平空白相同。

```latex
頁面頂端的文字。頁面頂端的文字。
頁面頂端的文字。頁面頂端的文字。
頁面頂端的文字。頁面頂端的文字。
頁面頂端的文字。

\vspace{5mm} %5mm 垂直空白

這段文字仍在頁面頂端，位於第一段下方 5mm 處。

\vfill

頁面底部的文字。
```

![LineBreaksEx6.png](/files/5bb5d26e83689ec81ac01d2b06d4c02fd64b6603)

讓我們看看這個範例中插入垂直空白的兩個命令。

**\vspace{5mm}**

插入長度為 5mm 的垂直空白。可使用其他長度單位。

**\vfill**

插入一個會動態擴展以填滿頁面上所有可用垂直空間的空白。這就是為什麼「Text at the bottom of the page.」這一行會被移到最底部，因為其餘空間已經被「填滿」了。

另外還有一些為了方便而常用來插入垂直空白的命令。

**\smallskip**

新增一個大小為 3pt、上下浮動 1pt 的空白，視其他因素（文件類型、可用空間等）而定。

**\medskip**

新增一個大小為 6pt、上下浮動 2pt 的空白，視其他因素（文件類型、可用空間等）而定。

**\bigskip**

新增一個大小為 12pt、上下浮動 4pt 的空白，視其他因素（文件類型、可用空間等）而定

[在 ShareLaTeX 中開啟範例](https://www.sharelatex.com/project/new/template?zipUrl=/project/5352974bc52fabc07908a43a/download/zip\&templateName=BreakLines\&compiler=pdflatex)

## 參考指南

**額外的換行命令**

* ```latex
   \\*
  ```

  （兩個反斜線和一個星號）

在該處插入換行，並且禁止在此換行之後再插入分頁。

* ```latex
  \break
  ```

在不填滿目前行剩餘可用空間的情況下插入換行。若不使用下一行所示之類的命令填補剩餘空間，通常會造成很差的排版。

* ```latex
  \hfill\break
  ```

產生與 *\newline* 和 *\\\\*.

此外，LaTeX 還提供以下進階的換行命令。

* ```latex
  \lineabreak[number]
  ```

此命令會在出現的位置插入換行。額外參數 *number* 代表 0 到 4 的優先級。0 表示此命令很容易被忽略，而 4 表示無論如何都會插入換行。使用這個選項時，LaTeX 會盡力產生最佳的換行效果。

## 延伸閱讀

更多資訊請參閱：

* [LaTeX 中的長度](/latex/zh-tw/ge-shi-hua/01-lengths-in-latex.md)
* [段落與換行](/latex/zh-tw/latex-ji-chu/02-paragraphs-and-new-lines.md)
* [段落格式設定](/latex/zh-tw/ge-shi-hua/04-articles-how-to-change-paragraph-spacing-in-latex.md)
* [文字對齊](/latex/zh-tw/ge-shi-hua/06-text-alignment.md)
* [粗體、斜體與底線](/latex/zh-tw/latex-ji-chu/03-bold-italics-and-underlining.md)
* [清單](/latex/zh-tw/latex-ji-chu/04-lists.md)
* [單面與雙面文件](/latex/zh-tw/ge-shi-hua/08-single-sided-and-double-sided-documents.md)
* [多欄排版](/latex/zh-tw/ge-shi-hua/09-multiple-columns.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-tw/geng-duo-zhu-ti/37-line-breaks-and-blank-spaces-es.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.
