> 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/07-page-size-and-margins.md).

# ページサイズと余白

## はじめに

LaTeX文書のページ寸法は非常に柔軟に設定でき、 [`geometry` パッケージ](https://ctan.org/pkg/geometry?lang=en) 紙のサイズ、余白、脚注、ヘッダー、向きなど、さまざまな要素の長さとレイアウトを変更する簡単な方法を提供します。

### 例

A4サイズの用紙を使い、文字領域が幅6インチ、高さ8インチを超えない文書を作成する必要があるとします。LaTeXのプリアンブルに次の行を追加するだけで、そのような文書を簡単に作成できます。

```latex
\usepackage[a4paper, total={6in, 8in}]{geometry}
```

\usepackageに渡す `geometry` パッケージは、必要なレイアウトを生成します。この場合、 `a4paper` が希望するA4用紙サイズを設定し、\usepackageに与える値が `総` パラメータは文字領域のサイズを決定します。Overleafは欧州版のLaTeX配布を使用しており、既定ではA4サイズの文書が生成されることに注意してください。

```latex
\documentclass{article}
\usepackage{blindtext}
\usepackage[a4paper, total={6in, 8in}]{geometry}

\begin{document}
\section{導入}
これは、A4サイズの用紙とユーザー定義の文字領域を使用するテスト文書です。
\subsection{ダミーテキスト}
\blindtext[8]

\end{document}
```

[Overleaf でこの例を開く](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Basic+geometry+package+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bblindtext%7D%0A%5Cusepackage%5Ba4paper%2C+total%3D%7B6in%2C+8in%7D%5D%7Bgeometry%7D%0A%0A%5Cbegin%7Bdocument%7D%0A%5Csection%7BIntroduction%7D%0AThis+is+a+test+document+which+uses+A4-sized+paper+and+the+user-defined+text+area.+%0A%5Csubsection%7BSome+dummy+text%7D%0A%5Cblindtext%5B8%5D%0A%0A%5Cend%7Bdocument%7D)

## 用紙サイズ、向き、余白

文書の用紙サイズ、向き、余白を変更することは一般的な要件であり、\usepackage{geometry}パッケージを使えば簡単に実現できます。 `geometry` 希望する値を設定する方法は2つあります。

* 上の例のように `\usepackage` ステートメントの引数として指定するか、または
* 次を使います `\geometry` をプリアンブルで使います。

例えば、リーガルサイズの用紙、横向き、2インチの余白を持つ文書を作成してみましょう。

```latex
\usepackage[legalpaper, landscape, margin=2in]{geometry}
```

同じことを少し違う方法でも実現できます。

```latex
\usepackage{geometry}
\geometry{legalpaper, landscape, margin=2in}
```

ご覧のとおり、パラメータはコンマで区切ります。定義済みの用紙サイズの完全な一覧については、 [リファレンスガイド](#reference-guide)を参照してください。2番目のパラメータは向きで、既定値は `縦向き`です。最後に、各 `余白` は `2in`.

## LaTeXのページ寸法を細かく調整する

### レイアウトの可視化

この [`レイアウト` パッケージ](https://ctan.org/pkg/layout?lang=en) を視覚化するための非常に便利な解決策を提供します *視覚化* 。文書の現在のレイアウトと、そのレイアウトを決定するさまざまなLaTeXパラメータの値を表示できます。コマンドは2つあります。 `レイアウト` や `layout*` で、現在のレイアウトを表す図を描画します。スター付きバージョン（`layout*`）は図を描画するために使われる内部値を再計算します。LaTeXのページレイアウト・パラメータを変更した場合に便利です。例を示します。

```latex
\documentclass{article}
\usepackage{layout}
\begin{document}
\section{デフォルトの \LaTeX{} レイアウト}
これが既定のレイアウトです。

\vspace{10pt}
\layout
\section{いくつか変更する}
marginparの設定を変更し、\verb|layout*|コマンドを使ってページレイアウト図を再描画します。
\vspace{10pt}
\setlength{\marginparwidth}{0pt}
\setlength{\marginparsep}{0pt}

\layout*
\end{document}
```

[結果を見るには、この例をOverleafで開いてください！](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Using+the+layout+package\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Blayout%7D%0A%5Cbegin%7Bdocument%7D%0A%5Csection%7BDefault+%5CLaTeX%7B%7D+layout%7D%0AHere%27s+the+default+layout%3A%0A%0A%5Cvspace%7B10pt%7D%0A%5Clayout%0A%5Csection%7BMake+some+changes%7D%0AMake+changes+to+the+margin+paragraph+settings+and+use+the+command+%5Cverb%7Clayout%2A%7C+to+redraw+the+page+layout+diagram%3A%0A%5Cvspace%7B10pt%7D%0A%5Csetlength%7B%5Cmarginparwidth%7D%7B0pt%7D%0A%5Csetlength%7B%5Cmarginparsep%7D%7B0pt%7D%0A%0A%5Clayout%2A%0A%5Cend%7Bdocument%7D)

次の画像は、\usepackage{layout}で生成される図の例を示しています。 `レイアウト` xr

![Layout-dimensions.png](/files/a3a16323b2b90a23f45d2d2b8a1077741cd9ee81)

### geometryパッケージのレイアウトパラメータの使用

この `geometry` パッケージは、直感的な名前のパラメータを使ってページ寸法を変更するためのインターフェースを提供します。パラメータは次の形式で記述する必要があります `parameter=value`。標準のLaTeX単位（mm、cm、pt、in）を使用します。以下の一覧は、前の節で示したページレイアウト図を参照しています。

**textwidth**

図の要素8に対応します。

**textheight**

図の要素7です。

**総**

他のパラメータに依存し、既定では本文の寸法を定義しますが、includehead、includefoot、includeheadfoot、includempコマンドと組み合わせることで、ヘッダー、本文、フッター、傍注の寸法をまとめて変更できます。

**left, lmargin, inner**

これら3つのパラメータは左余白の長さを変更します。図の要素1と3を合わせたものです。

**right, rmargin, outer**

これら3つのパラメータは右余白の長さを変更します。図の要素9と10を合わせたものです。

**top, tmargin**

これら2つのパラメータは、図の要素2と6を合わせたものです。

**bottom, bmargin**

これら2つのパラメータは、文書下端から基準線までの距離を設定します。

**headheight**

ヘッダーの高さ

**headsep**

ヘッダー（基準線）と本文との間隔。図の要素6。

**footnotesep**

本文下部（基準線）と脚注テキスト上端との間隔。

**footskip**

本文最終行の基準線とフッターの基準線との間隔。

**marginparwidth, marginpar**

傍注の幅。図の要素10。

用紙サイズは、コマンド `papersize={⟨width⟩,⟨height⟩}`.

前述のオプションのいくつかを使った例を見てみましょう。

```latex
\documentclass{article}
\usepackage{blindtext}
\usepackage{geometry}
 \geometry{
 a4paper,
 total={170mm,257mm},
 left=20mm,
 top=20mm,
 }
\begin{document}
\section{ダミーテキスト}
\blindtext[10]
\end{document}
```

[Overleaf でこの例を開く](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Using+the+geometry+package+layout+parameters\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bblindtext%7D%0A%5Cusepackage%7Bgeometry%7D%0A+%5Cgeometry%7B%0A+a4paper%2C%0A+total%3D%7B170mm%2C257mm%7D%2C%0A+left%3D20mm%2C%0A+top%3D20mm%2C%0A+%7D%0A%5Cbegin%7Bdocument%7D%0A%5Csection%7BSome+dummy+text%7D%0A%5Cblindtext%5B10%5D%0A%5Cend%7Bdocument%7D)

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

![geometryパッケージの使用](/files/705043eb4fe727058b832fff9defe47b118bf817)

ここでは文字領域、左余白、上余白が設定されています。右余白と下余白は、ページに収まるように自動的に計算されます。

## リファレンスガイド

| パラメータ     | 説明           | 値                                                                                                                                                                                                                                                                                                                              |
| --------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| papersize | 用紙のサイズを決定します | a0paper, a1paper, a2paper, a3paper, a4paper, a5paper, a6paper,b0paper, b1paper, b2paper, b3paper, b4paper, b5paper, b6paper,c0paper, c1paper, c2paper, c3paper, c4paper, c5paper, c6paper,b0j, b1j, b2j, b3j, b4j, b5j, b6j,ansiapaper, ansibpaper, ansicpaper, ansidpaper, ansiepaper,letterpaper, executivepaper, legalpaper |

## さらに読む

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

* [LaTeX における長さ](/latex/ja/shu-shi-she-ding/01-lengths-in-latex.md)
* [ヘッダーとフッター](/latex/ja/shu-shi-she-ding/02-headers-and-footers.md)
* [複数カラム](/latex/ja/shu-shi-she-ding/09-multiple-columns.md)
* [脚注](/latex/ja/shu-shi-she-ding/14-footnotes.md)
* [ページ番号](/latex/ja/shu-shi-she-ding/03-page-numbering.md)
* [テキスト配置](/latex/ja/shu-shi-she-ding/06-text-alignment.md)
* [ハイパーリンク](/latex/ja/wen-shu-gou-zao/09-hyperlinks.md)
* [パッケージとクラスファイルの理解](/latex/ja/kurasufairu/01-understanding-packages-and-class-files.md)
* [独自のパッケージを書く](/latex/ja/kurasufairu/03-writing-your-own-package.md)
* [独自のクラスを書く](/latex/ja/kurasufairu/04-writing-your-own-class.md)
* [geometryパッケージのドキュメント](http://mirrors.ctan.org/macros/latex/contrib/geometry/geometry.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/07-page-size-and-margins.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.
