> 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/06-text-alignment.md).

# テキストの配置

## はじめに

既定では、LaTeX は本文を両端揃えで組版しますが、細い段組内の文章のように、左揃えや「右端が不揃い」の文章（右から左へ書く言語向け）のほうが適している場合もあります。この記事では、LaTeX の標準機能とパッケージを使って、文書の一部または全体の文字揃えを変更する方法を説明します `ragged2e`.

## 標準の LaTeX コマンドと環境

LaTeX には、本文の組版上の揃えを変更するための標準コマンドがあります：

* 右端不揃い（`\raggedright`)
* 左端不揃い（`\raggedleft`)
* 中央揃え（`\centering`)

対応する環境とともに：

* 右端不揃い（`flushleft` 環境）
* 左端不揃い（`flushright` 環境）
* 中央揃え（`centering` 環境）

しかし、 [`ragged2e` パッケージ](https://ctan.org/pkg/ragged2e?lang=en) これらの標準 LaTeX コマンドや環境を改良した、いくつかの洗練された機能を提供します。

## パッケージ ragged2e の使用

まず、以下は次を使った例です： `ragged2e` パッケージとその `[document]` オプションを使って *文書全体の本文を* 右端不揃い（左揃え）として組版します。サンプルコードでは次の行を追加しています：

```latex
\usepackage[document]{ragged2e}
```

を文書のプリアンブルに：

```latex
\documentclass{article}
\usepackage[document]{ragged2e}

\begin{document}
\section{Heading on Level 1 (section)}
こんにちは、意味のないテキストです。このテキストは、印刷されたテキストがこの場所でどのように見えるかを示すはずです。このテキストを読んでも、情報は得られません。本当に？情報はないのでしょうか？このテキストと、まったくのナンセンスのようなものとの間に違いはないのでしょうか！このようなダミーテキストは、選択したフォント、文字の書き方、見た目の印象についての情報を与えてくれます。
\end{document}
```

[これを開く `ragged2e` Overleafでの例](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Example+using+ragged2e+package\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%5Bdocument%5D%7Bragged2e%7D%0A%0A%5Cbegin%7Bdocument%7D%0A%5Csection%7BHeading+on+Level+1+%28section%29%7D%0AHello%2C+here+is+some+text+without+a+meaning.+This+text+should+show+what+a+printed+text+will+look+like+at+this+place.++If+you+read+this+text%2C+you+will+get+no+information.++Really%3F++Is+there+no+information%3F++Is+there+a+difference+between+this+text+and+some+nonsense+like+not+at+all%21++A+blind+text+like+this+gives+you+information+about+the+selected+font%2C+how+the+letters+are+written+and+an+impression+of+the+look.%0A%5Cend%7Bdocument%7D)

この例では、次の出力が生成されます:

![Ragged2eOLV21.png](/files/8816bec0640c53c5f63965eed01c9a32e9e72ff6)

## \raggedright（LaTeX）と \RaggedRight（ragged2e）の比較

LaTeX コマンド `\raggedright` は、結果が「不揃いすぎる」ように見えることがあります。パッケージ `ragged2e` は、行が短すぎる場合にハイフネーションを許可することでこの問題に対処し、より均一な右端不揃いの本文端を生成します。次の例は、LaTeX コマンドで生成した右端不揃いの文章を示し、 `\raggedright` 比較のため、同じテキストを次を使って組版したものを示します： `\RaggedRight` コマンドを提供する `ragged2e`:

```latex
\documentclass{article}
\usepackage[english]{babel}
\usepackage{ragged2e}
\usepackage{blindtext}

\begin{document}
\setlength{\hsize}{0.9\hsize}% emphasize effects

次を使った左揃えの例：
\texttt{\string\raggedright}\\（標準 \LaTeX{} コマンド）
\raggedright\blindtext[2]\par

\texttt{\string\RaggedRight}\\（\texttt{ragged2e} コマンド）を使った左揃えの例：
\RaggedRight\blindtext[2]\par
\end{document}
```

[この例をOverleafで開く](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Demonstrating+left-aligned+text\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%5Benglish%5D%7Bbabel%7D%0A%5Cusepackage%7Bragged2e%7D%0A%5Cusepackage%7Bblindtext%7D%0A%0A%5Cbegin%7Bdocument%7D%0A%5Csetlength%7B%5Chsize%7D%7B0.9%5Chsize%7D%25+emphasize+effects%0A%0A%5Csubsection%2A%7BLeft-aligned+example+with+%0A%5Ctexttt%7B%5Cstring%5Craggedright%7D%5C%5C+%28standard+%5CLaTeX%7B%7D+command%29%7D%0A%5Craggedright%5Cblindtext%5B2%5D%5Cpar%0A%0A%5Csubsection%2A%7BLeft-aligned+example+with+%5Ctexttt%7B%5Cstring%5CRaggedRight%7D%5C%5C+%28%5Ctexttt%7Bragged2e%7D+command%29%7D%0A%5CRaggedRight%5Cblindtext%5B2%5D%5Cpar+%0A%5Cend%7Bdocument%7D)

![Leftaligncompare2.png](/files/30639797363d4fc13983fa6f9ab66c27931a9ee6)

で述べたように `ragged2e` [パッケージドキュメントに記載されているオプションがあります](https://mirror.ox.ac.uk/sites/ctan.org/macros/latex/contrib/ragged2e/ragged2e.pdf), `ragged2e` 文字揃えを変更するための代替コマンドと環境を提供しており、そのいくつかを見ていきます。

## 右端不揃い（左揃え）テキストのための環境

右端不揃いのテキストを生成する既定の LaTeX 環境は `flushleft`。これに対応する `ragged2e` は `FlushLeft` （大文字小文字に注意）。以下の例では、これらの環境の出力を比較します：

```latex
\documentclass{article}
\usepackage[english]{babel}
\usepackage{ragged2e}
\usepackage{blindtext}
\begin{document}
\setlength{\hsize}{0.9\hsize}% emphasize effects

\subsection*{\texttt{flushleft} 環境：（標準 \LaTeX{}）}

\begin{flushleft}
\blindtext[1]
\end{flushleft}

\subsection*{\texttt{FlushLeft} 環境：（\texttt{ragged2e}）}

\begin{FlushLeft}
\blindtext[1]
\end{FlushLeft}

\end{document}
```

[この例をOverleafで開く](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Demonstrating+left-aligned+text\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%5Benglish%5D%7Bbabel%7D%0A%5Cusepackage%7Bragged2e%7D%0A%5Cusepackage%7Bblindtext%7D%0A%5Cbegin%7Bdocument%7D%0A%5Csetlength%7B%5Chsize%7D%7B0.9%5Chsize%7D%25+emphasize+effects%0A%0A%5Csubsection%2A%7B%5Ctexttt%7Bflushleft%7D+environment%3A+%28standard+%5CLaTeX%7B%7D%29%7D%0A%0A%5Cbegin%7Bflushleft%7D%0A%5Cblindtext%5B1%5D%0A%5Cend%7Bflushleft%7D%0A%0A%5Csubsection%2A%7B%5Ctexttt%7BFlushLeft%7D+environment%3A+%28%5Ctexttt%7Bragged2e%7D%29%7D%0A%0A%5Cbegin%7BFlushLeft%7D%0A%5Cblindtext%5B1%5D%0A%5Cend%7BFlushLeft%7D%0A%0A%5Cend%7Bdocument%7D)

![Flcompare.png](/files/3791b86226a8455d7c5d09b8b57e1b4569427915)

## 左端不揃い（右揃え）テキストのための環境

左端不揃い（右揃え）のテキストを生成する既定の LaTeX 環境は `flushright`。これに対応する `ragged2e` は `FlushRight` （大文字小文字に注意）。以下の例では、これらの環境の出力を比較します：

```latex
\documentclass{article}
\usepackage[english]{babel}
\usepackage{ragged2e}
\usepackage{blindtext}
\begin{document}
\setlength{\hsize}{0.9\hsize}% emphasize effects

\subsection*{\texttt{flushright} 環境：（標準 \LaTeX{}）}

\begin{flushright}
\blindtext[1]
\end{flushright}

\subsection*{\texttt{FlushRight} 環境：（\texttt{ragged2e}）}

\begin{FlushRight}
\blindtext[1]
\end{FlushRight}

\end{document}
```

[この例をOverleafで開く](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Demonstrating+right-aligned+text\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%5Benglish%5D%7Bbabel%7D%0A%5Cusepackage%7Bragged2e%7D%0A%5Cusepackage%7Bblindtext%7D%0A%5Cbegin%7Bdocument%7D%0A%5Csetlength%7B%5Chsize%7D%7B0.9%5Chsize%7D%25+emphasize+effects%0A%0A%5Csubsection%2A%7B%5Ctexttt%7Bflushright%7D+environment%3A+%28standard+%5CLaTeX%7B%7D%29%7D%0A%0A%5Cbegin%7Bflushright%7D%0A%5Cblindtext%5B1%5D%0A%5Cend%7Bflushright%7D%0A%0A%5Csubsection%2A%7B%5Ctexttt%7BFlushRight%7D+environment%3A+%28%5Ctexttt%7Bragged2e%7D%29%7D%0A%0A%5Cbegin%7BFlushRight%7D%0A%5Cblindtext%5B1%5D%0A%5Cend%7BFlushRight%7D%0A%0A%5Cend%7Bdocument%7D)

![FRcompare.png](/files/47788207f72cb20aa7b8ac8261e78f22693dc195)

## テキストを中央揃えにする環境

中央揃えのテキストを生成する既定の LaTeX 環境は `center`。これに対応する `ragged2e` は `Center` （大文字小文字に注意）。以下の例では、これらの環境の出力を比較します：

```latex
\documentclass{article}
\usepackage[english]{babel}
\usepackage{ragged2e}
\usepackage{blindtext}
\begin{document}
\setlength{\hsize}{0.9\hsize}% emphasize effects

\subsection*{\texttt{center} 環境：（標準 \LaTeX{}）}

\begin{center}
\blindtext[1]
\end{center}

\subsection*{\texttt{Center} 環境：（\texttt{ragged2e}）}
\begin{Center}
\blindtext[1]
\end{Center}
\end{document}
```

[この例をOverleafで開く](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Demonstrating+right-aligned+text\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%5Benglish%5D%7Bbabel%7D%0A%5Cusepackage%7Bragged2e%7D%0A%5Cusepackage%7Bblindtext%7D%0A%5Cbegin%7Bdocument%7D%0A%5Csetlength%7B%5Chsize%7D%7B0.9%5Chsize%7D%25+emphasize+effects%0A%0A%5Csubsection%2A%7B%5Ctexttt%7Bcenter%7D+environment%3A+%28standard+%5CLaTeX%7B%7D%29%7D%0A%0A%5Cbegin%7Bcenter%7D%0A%5Cblindtext%5B1%5D%0A%5Cend%7Bcenter%7D%0A%0A%5Csubsection%2A%7B%5Ctexttt%7BCenter%7D+environment%3A+%28%5Ctexttt%7Bragged2e%7D%29%7D%0A%5Cbegin%7BCenter%7D%0A%5Cblindtext%5B1%5D%0A%5Cend%7BCenter%7D%0A%5Cend%7Bdocument%7D)

![Centrecompare.png](/files/19d821aac9caf84f158ef437a9d7079799ff3d7f)

## 両端揃えのテキスト

パッケージ `ragged2e` コマンドを提供します `\justifying` を以下の例のように使用できます：

```latex
\documentclass{article}
\usepackage[english]{babel}
\usepackage{ragged2e}
\usepackage{blindtext}
\begin{document}
\setlength{\hsize}{0.9\hsize}% emphasize effects

\Centering
\blindtext[1]

\vspace{5mm}
\justifying
\blindtext[1]
\end{document}
```

[この例をOverleafで開く](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Demonstrating+justification+with+ragged2e\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%5Benglish%5D%7Bbabel%7D%0A%5Cusepackage%7Bragged2e%7D%0A%5Cusepackage%7Bblindtext%7D%0A%5Cbegin%7Bdocument%7D%0A%5Csetlength%7B%5Chsize%7D%7B0.9%5Chsize%7D%25+emphasize+effects%0A%0A%5CCentering%0A%5Cblindtext%5B1%5D%0A%0A%5Cvspace%7B5mm%7D%0A%5Cjustifying%0A%5Cblindtext%5B1%5D+%0A%5Cend%7Bdocument%7D)

![Justifyingdemo.png](/files/8dc9a1138ddb70de75d7da92e950f72e4402b00b)

## リファレンスガイド

**テキスト揃えのための環境とコマンドのまとめ**

| 揃え   | 環境           | 切り替えコマンド       | ragged2e の環境 | ragged2e の切り替えコマンド |
| ---- | ------------ | -------------- | ------------ | ------------------ |
| 左    | `flushleft`  | `\raggedright` | `FlushLeft`  | `\RaggedRight`     |
| 右    | `flushright` | `\raggedleft`  | `FlushRight` | `\RaggedLeft`      |
| 中央   | `center`     | `\centering`   | `Center`     | `\Centering`       |
| 両端揃え |              |                | `justify`    | `\justifying`      |

## 参考文献

詳細は次をご覧ください：

* [段落と改行](/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/latexno/03-bold-italics-and-underlining.md)
* [フォントサイズ、ファミリー、スタイル](/latex/ja/fonto/01-font-sizes-families-and-styles.md)
* [フォント書体](/latex/ja/fonto/02-font-typefaces.md)
* [XeLaTeX で現代的なフォントをサポートする](/latex/ja/fonto/03-xelatex.md)
* [改行と空白](/latex/ja/shu-shi-she-ding/05-line-breaks-and-blank-spaces.md)
* [リスト](/latex/ja/latexno/04-lists.md)
* [セクションと章](/latex/ja/wen-shu-gou-zao/01-sections-and-chapters.md)
* [複数列](/latex/ja/shu-shi-she-ding/09-multiple-columns.md)
* [片面印刷と両面印刷の文書](/latex/ja/shu-shi-she-ding/08-single-sided-and-double-sided-documents.md)
* [LaTeX2ε へのそれほど短くない入門](http://www.ctan.org/tex-archive/info/lshort/)
* [ragged2e パッケージのドキュメント](http://mirror.hmc.edu/ctan/macros/latex/contrib/ms/ragged2e.pdf)


---

# 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/06-text-alignment.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.
