> 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/ja/shu-shi-she-ding/05-line-breaks-and-blank-spaces.md).

# 改行と空白

LaTeX で文書の流れを中断するのは、あなたが [マクロを作成している場合は](/latex/ja/kurasufairu/03-writing-your-own-package.md)。とはいえ、文書のレイアウトをより細かく制御する必要があることもあります。そのため、この記事では改行、改ページ、任意の空白の挿入方法を説明します。

## はじめに

改行する最も標準的な方法は、新しい段落を作成することです。これはコード内に空行を 1 行入れることで行います。

```latex
\documentclass{article}
\begin{document}
この段落には情報がありません
そして、その目的は新しい段落を開始する方法の例を示すことです。
ご覧のとおり、
1 行の
コード内の改行
は、テキスト中では空白として扱われます。

しかし、空行を入れると新しい段落が始まります。
\end{document}
```

[この例をOverleafで開く](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=New+paragraph\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0AThis+paragraph+contains+no+information%0Aand+its+purpose+is+to+provide+an+example+on+how+to+start+a+new+paragraph.%0AAs+you+can+see%2C%0Asingle+line%0Abreak+in+the+code%0Aacts+as+a+space+in+text.%0A%0AHowever%2C+leaving+an+empty+line+starts+a+new+paragraph.%0A%5Cend%7Bdocument%7D)

![LineBreaksEx1aupdated.png](/files/9b0902c2b502a3e1bc35649f6454410a7bdc846d)

改行を挿入するコマンドはこれだけではありません。 [次のセクションで](#line-breaks) さらに 2 つ紹介します。

## 改行

前述のとおり、改行を挿入する方法は 1 つではありません。

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

\begin{document}
この文書の中の何か。この段落には情報がありません
そして、その目的は空白を挿入する方法の例を示すことです
および改行を挿入する方法の例を示すことです。\\
改行が挿入されると、テキストは字下げされず、
改行を行うための追加コマンドがいくつかあります。 \newline
この段落にはまったく情報がありません。私たちは
改行について確認しています。 \hfill \break
そして、2 つのコマンドを組み合わせると
\end{document}
```

[この例をOverleafで開く](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Another+line+break+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%5Butf8%5D%7Binputenc%7D%0A%0A%5Cbegin%7Bdocument%7D%0ASomething+in+this+document.+This+paragraph+contains+no+information+%0Aand+its+purposes+is+to+provide+an+example+on+how+to+insert+white+%0Aspaces+and+lines+breaks.%5C%5C%0AWhen+a+line+break+is+inserted%2C+the+text+is+not+indented%2C+there+%0Aare+a+couple+of+extra+commands+do+line+breaks.+%5Cnewline%0AThis+paragraph+provides+no+information+whatsoever.+We+are+exploring+%0Aline+breaks.+%5Chfill+%5Cbreak%0AAnd+combining+two+commands%0A%5Cend%7Bdocument%7D)

![LineBreaksEx2new.png](/files/b1e136f67dbbf1f321b2a4870af396a8e03e7167)

この例では、同じように機能するコマンドが 3 つあります:

* `\\` （バックスラッシュ 2 つ）
* `\newline`
* `\hfill \break`

その他の改行コマンドについては、 [リファレンスガイド](#reference-guide).

## 改ページ

改ページを挿入するコマンドは 2 つあります、 `clearpage` と `newpage`。以下は `clearpage`.

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

\begin{document}
この文書の中の何か。この段落には情報がなく、
その目的は空白を挿入する方法の例を示すことです
および改行を挿入する方法の例を示すことです。\\
改行が挿入されると、テキストは字下げされず、
改行を行うための追加コマンドがいくつかあります。 \newline
この段落にはまったく情報がありません。私たちは
改行について確認しています。 \hfill \break
そして、2 つのコマンドを組み合わせると
...
...

\begin{figure}
\centering
\includegraphics[width=3cm]{overleaf-logo}
\caption{Overleaf のロゴ}
\end{figure}

こんにちは、意味のないテキストがいくつかあります...
\clearpage
```

![LineBreaksEx3OverleafNew.png](/files/5d81d969fff2d7291a46187efc24e794732e96fb)

コマンド `\clearpage` が使用され、表や図などの積み重なった浮動要素がある場合、それらは新しいページを開始する前にすべて出力されます。上の例では同じ画像が 3 回挿入されています。改ページはすべての図が表示される前に挿入されるため、残りの画像は、区切り位置の下のテキストを続ける前に空白ページに挿入されます。

これが目的と違う場合は、 `\newpage` 代わりに

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

\begin{document}
\documentclass{article}
\usepackage[utf8]{inputenc}

\begin{document}
この文書の中の何か。この段落には情報がなく、
その目的は空白を挿入する方法の例を示すことです
および改行を挿入する方法の例を示すことです。\\
改行が挿入されると、テキストは字下げされず、
改行を行うための追加コマンドがいくつかあります。 \newline
この段落にはまったく情報がありません。私たちは
改行について確認しています。 \hfill \break
そして、2 つのコマンドを組み合わせると
...
...

\begin{figure}
\centering
\includegraphics[width=3cm]{overleaf-logo}
\caption{Overleaf のロゴ}
\end{figure}

こんにちは、意味のないテキストがいくつかあります...
\newpage
```

![LineBreaksEx4Overleaf.png](/files/bd223a8e159dc56ad9b4b17f5c8a5894c598fabd)

この場合、画像はテキストの流れに収まるように新しいページに配置されます。

[Overleaf で開く](https://www.overleaf.com/project/new/template/19338?id=65200057\&templateName=\&latexEngine=\&texImage=texlive-full%3A2020.1\&mainFile=)

## 水平の空白

任意の長さの水平スペースは次のコマンドで挿入できます： `\hspace`.

```latex
水平スペース \hspace{1cm} は手動で挿入できます。役立つのは
画像のレイアウトの微調整を制御することです。

左側 \hfill 右側
```

[この例をOverleafで開く](https://www.overleaf.com/docs?engine=\&snip_name=Horizontal+spaces\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0A%0AHorizontal+%5Chspace%7B1cm%7D+spaces+can+be+inserted+manually.+Useful+%0Ato+control+the+fine-tuning+in+the+layout+of+pictures.%0A%0ALeft+Side+%5Chfill+Right+Side%0A%0A%5Cend%7Bdocument%7D)

![LineBreaksEx5.png](/files/4788a7c7d837b51731026b39154ed11573407604)

この例で水平の空白を挿入するコマンドは 2 つあります:

**\hspace{1cm}**

長さが 1cm の水平スペースを挿入します。このコマンドでは他の LaTeX 単位も使用できます。

**\hfill**

利用可能なスペースを埋めるように、それに応じて伸縮する空白を挿入します。

コマンド `\hrulefill` と `\dotfill` と同じことをします `\hfill` が、空白の代わりに、それぞれ横罫線と点線を挿入します。

## 縦の空白

縦の空白は、水平のものと同じ構文です。

```latex
ページ上部のテキスト。ページ上部のテキスト。
ページ上部のテキスト。ページ上部のテキスト。
ページ上部のテキスト。ページ上部のテキスト。
ページ上部のテキスト。

\vspace{5mm} %5mm vertical space

このテキストはまだ上部にあり、最初の段落から 5mm 下にあります。

\vfill

ページ下部のテキスト。
```

[この例をOverleafで開く](https://www.overleaf.com/docs?engine=\&snip_name=Vertical+blank+spaces\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0A%0AText+at+the+top+of+the+page.+Text+at+the+top+of+the+page.+%0AText+at+the+top+of+the+page.+Text+at+the+top+of+the+page.+%0AText+at+the+top+of+the+page.+Text+at+the+top+of+the+page.+%0AText+at+the+top+of+the+page.%0A%0A%5Cvspace%7B5mm%7D+%255mm+vertical+space%0A%0AThis+text+still+at+the+top%2C+5mm+below+the+first+paragraph.%0A%0A%5Cvfill%0A%0AText+at+the+bottom+of+the+page.%0A%0A%5Cend%7Bdocument%7D)

![LineBreaksEx6.png](/files/a2a6eeb5321d565a592c9af90ebf855475aa7349)

縦の空白を挿入する 2 つのコマンドを見てみましょう。

**\vspace{5mm}**

長さが 5mm の縦スペースを挿入します。このコマンドでは他の LaTeX 単位も使用できます。

**\vfill**

利用可能な縦方向のスペースを埋めるように伸縮する空白を挿入します。そのため、「ページ下部のテキスト。」の行が下に移動し、残りのスペースが埋められます。

縦の空白を挿入するためによく使われるコマンドは他に 3 つあります

**\smallskip**

他の要因（文書の種類、利用可能なスペースなど）に応じて、3pt の空白を ±1pt 加えます

**\medskip**

他の要因（文書の種類、利用可能なスペースなど）に応じて、6pt の空白を ±2pt 加えます

**\bigskip**

他の要因（文書の種類、利用可能なスペースなど）に応じて、12pt の空白を ±4pt 加えます

## リファレンスガイド

**追加の改行コマンド**

* ```latex
   \\*
  ```

  （バックスラッシュ 2 つとアスタリスク 1 つ）

コマンドの位置で改行し、さらに強制改行の後の改ページを禁止します。

* ```latex
   \break
  ```

現在の行を埋めずに改行します。自分で行を埋めないと、書式が非常に悪くなります。行を埋めるには、以下のように使用できます。

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

これは次と同じ結果になります *\newline* と *\\\\*.

さらに、LaTeX では改行のために次の高度なオプションが用意されています。

* ```latex
   \linebreak[number]
  ```

コマンドの位置で改行します。 *number* 引数として指定する値は、0 から 4 の範囲でコマンドの優先度を表します。（0 は簡単に無視されることを意味し、4 はそれでも実行することを意味します。）この改行オプションを使用すると、LaTeX は可能な限り最適な改行を生成しようとします。

## 参考文献

詳細は以下を参照してください:

* [LaTeX における長さ](/latex/ja/shu-shi-she-ding/01-lengths-in-latex.md)
* [段落と改行](/latex/ja/latexno/02-paragraphs-and-new-lines.md)
* [段落の書式設定](/latex/ja/shu-shi-she-ding/04-articles-how-to-change-paragraph-spacing-in-latex.md)
* [テキストの配置](/latex/ja/shu-shi-she-ding/06-text-alignment.md)
* [太字、斜体、下線](/latex/ja/latexno/03-bold-italics-and-underlining.md)
* [リスト](/latex/ja/latexno/04-lists.md)
* [片面印刷と両面印刷の文書](/latex/ja/shu-shi-she-ding/08-single-sided-and-double-sided-documents.md)
* [複数列](/latex/ja/shu-shi-she-ding/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/ja/shu-shi-she-ding/05-line-breaks-and-blank-spaces.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.
