> 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/wen-shu-gou-zao/01-sections-and-chapters.md).

# セクションと章

## はじめに

文書には通常、「論理構造」があります。内容を整理するために、章、節、小節などに分けられます。LaTeX は文書構造の作成をサポートし、節区切りや番号付けのカスタマイズも可能にします。文書を整理するために利用できるコマンドは、使用する文書クラスに依存しますが、最も単純な整理方法である節区切りは、すべての形式で利用できます。

## 基本例

まず、基本例を使って、 `\section{*節タイトル*}` というコマンドを示します。これは、新しい節の開始を示すもので、節の名前は `*節タイトル*`です。節番号は自動で付けられ、カスタマイズしたり無効にしたりできます。

```latex
\documentclass{article}
\usepackage{blindtext}

\\title{節と章}
\author{Overleaf}
\date{\today}

\begin{document}
\maketitle
\section{導入}

これは最初の節です。

\blindtext

\\section{Second Section}
これは第2節です

\blindtext
\end{document}
```

[この例を Overleaf で開く。](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Basic+document+structure+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bblindtext%7D%0A%0A%5Ctitle%7BSections+and+Chapters%7D%0A%5Cauthor%7BOverleaf%7D%0A%5Cdate%7B%5Ctoday%7D%0A%0A%5Cbegin%7Bdocument%7D%0A%5Cmaketitle%0A%5Csection%7BIntroduction%7D%0A%0AThis+is+the+first+section.%0A%0A%5Cblindtext%0A%0A%5Csection%7BSecond+Section%7D%0AThis+is+the+second+section%0A%0A%5Cblindtext%0A%5Cend%7Bdocument%7D)

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

![節と章の例](/files/56312d641f584cef16ed53caf366e0fccfdcb141)

## 文書の節区切り

LaTeX では、文書の章や節を整理し、番号を付け、索引を作成できます。文書クラスに応じて、節を定義できる深さは最大7階層です。

|    |                                  |
| -- | -------------------------------- |
| -1 | `\\part{part}`                   |
| 0  | `\\chapter{chapter}`             |
| 1  | `\\section{section}`             |
| 2  | `\\subsection{subsection}`       |
| 3  | `\\subsubsection{subsubsection}` |
| 4  | `\\paragraph{paragraph}`         |
| 5  | `\\subparagraph{subparagraph}`   |

通常、 `\section` は、ほとんどの文書で最上位の文書コマンドです。ただし、レポートや書籍、同様の長文文書では、これに相当するのは `\\chapter` または `\part`.

## 番号付き節と無番号節

番号のない章、節、小節などを作るには、コマンドの末尾、開き波括弧の前にアスタリスク（`*`）を追加します。これらは目次に入りません。以下は最初の例（上記）ですが、今回は `\section*` の代わりに `\section`:

```latex
\documentclass{article}
\usepackage{blindtext}

\\title{節と章}
\author{Overleaf}
\date{\today}

\begin{document}
\maketitle
\section*{はじめに}

これは最初の節です。

\blindtext

\section*{第2節}
これは第2節です

\blindtext
\end{document}
```

[この例を Overleaf で開く。](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Example+with+unnumbered+sections\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bblindtext%7D%0A%0A%5Ctitle%7BSections+and+Chapters%7D%0A%5Cauthor%7BOverleaf%7D%0A%5Cdate%7B%5Ctoday%7D%0A%0A%5Cbegin%7Bdocument%7D%0A%5Cmaketitle%0A%5Csection%2A%7BIntroduction%7D%0A%0AThis+is+the+first+section.%0A%0A%5Cblindtext%0A%0A%5Csection%2A%7BSecond+Section%7D%0AThis+is+the+second+section%0A%0A%5Cblindtext%0A%5Cend%7Bdocument%7D)

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

![無番号節の例](/files/19a6f432c4859213325b931471399f9bb8c0f959)

### 目次内の無番号節

目次に無番号節を追加するには、 `\\addcontentsline` コマンドを次のように使います：

```latex
\addcontentsline{toc}{section}{節のタイトル}
```

以下に `\\addcontentsline` を使った例を示しますが、記事 [目次](/latex/ja/wen-shu-gou-zao/02-table-of-contents.md) を参照してください。

```latex
\documentclass{article}
\\title{節と章}
\author{Overleaf}
\date{\today}

\begin{document}
\maketitle
\tableofcontents

\newcommand\shortlorem{Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.}

\section{導入}
これは最初の節（番号付き）です。

\shortlorem
\\addcontentsline{toc}{section}{番号なしの節}
\\section*{Unnumbered Section}
番号なしの節

\shortlorem

\section{第2節}
第2の番号付き節。

\shortlorem
\end{document}
```

[この例を Overleaf で開く。](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Example+of+unnumbered+sections+in+the+TOC\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Ctitle%7BSections+and+Chapters%7D%0A%5Cauthor%7BOverleaf%7D%0A%5Cdate%7B%5Ctoday%7D%0A%0A%5Cbegin%7Bdocument%7D%0A%5Cmaketitle%0A%5Ctableofcontents%0A%0A%5Cnewcommand%5Cshortlorem%7BLorem+ipsum+dolor+sit+amet%2C+consectetur+adipiscing+elit%2C+sed+do+eiusmod+tempor+incididunt+ut+labore+et+dolore+magna+aliqua.+Ut+enim+ad+minim+veniam%2C+quis+nostrud+exercitation+ullamco+laboris+nisi+ut+aliquip+ex+ea+commodo+consequat.%7D%0A%0A%5Csection%7BIntroduction%7D%0AThis+is+the+first+section+%28numbered%29.%0A%0A%5Cshortlorem%0A%5Caddcontentsline%7Btoc%7D%7Bsection%7D%7BUnnumbered+Section%7D%0A%5Csection%2A%7BUnnumbered+Section%7D%0AAn+unnumbered+section%0A%0A%5Cshortlorem%0A%0A%5Csection%7BSecond+section%7D%0AThe+second+numbered+section.%0A%0A%5Cshortlorem%0A%5Cend%7Bdocument%7D)

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

![目次内の無番号節](/files/cb77b5286cbee5e18f1199dcd0fe2fd4614588cd)

## 書籍/レポートにおける文書の章と節

前述のとおり、 `\\chapter` は書籍やレポートで使用できます。

### レポートクラス

以下に例を示します `レポート` Overleaf の記事のテキストを使った [LuaTeX入門（第1部）：それは何で、何がそんなに違うのか？](/latex/ja/xiang-xi-ji-shi/07-an-introduction-to-luatex-part-1-what-is-it-and-what-makes-it-so-different.md)

```latex
\documentclass{report}
\\title{節と章}
\author{Overleaf}
\date{\today}
\begin{document}
\maketitle
\tableofcontents
\chapter{Lua\TeX入門}

\section{それは何で、何がそんなに違うのか？}
Lua\TeX{} は \textit{ツールキット}です。高度なソフトウェアツールやコンポーネントが含まれており、それらを使って幅広い文書を作成（組版）できます。この記事のサブタイトルでは Lua\TeX について2つの問いも投げかけています。つまり、それは何か、そして何がそんなに違うのか、です。「それは何か？」への答えは明白に思えるかもしれません。「\TeX{} の組版エンジンです！」そのとおりです。しかし、より広い見方、そしてこの著者も支持する見方では、Lua\TeX{} は非常に多用途な、\TeX ベースの文書構築・工学システムです。

\subsection{Lua\TeXの説明：どこから始める？}
LuaTeX に関するこの最初の記事の目的は、この TeX エンジンが何を提供するのか、そしてその設計がなぜ／どのように、複雑な組版やデザインの問題に対する幅広い解決策をユーザーが構築／設計／作成できるようにするのかを理解するための文脈を与えることです。さらに、ある程度の「将来への備え」も提供するかもしれません。

\chapter{Lua\TeX: 背景と歴史}
\section{導入}
Lua\TeX{} は、10年以上にわたって活発に開発されてきたにもかかわらず、\TeX{} の世界では「登場したばかりの新顔」です。

\subsection{Lua\TeX: \TeX の「ブラックボックス」を開く}
Knuth の元の \TeX{} プログラムは、今日使われているすべての現代的な \TeX{} エンジンの共通祖先であり、Lua\TeX{} は実質的にはその最新の進化形です。pdf\TeX{} プログラムをベースに、さらに多くの機能をもたらす強力なソフトウェアコンポーネントが追加されています。
\end{document}
```

[この例を Overleaf で開く（ `lualatex`)](<https://www.overleaf.com/docs?engine=lualatex\&snip_name=Example+of+a+LaTeX+report\&snip=\documentclass{report}&#xA;\title{Sections+and+Chapters}&#xA;\author{Overleaf}&#xA;\date{\today}&#xA;\begin{document}&#xA;\maketitle&#xA;\tableofcontents&#xA;\chapter{An+Introduction+to+Lua\TeX}&#xA;&#xA;\section{What+is+it—and+what+makes+it+so+different?}&#xA;Lua\TeX{}+is+a+\textit{toolkit}—it+contains+sophisticated+software+tools+and+components+with+which+you+can+construct+(typeset)+a+wide+range+of+documents.+The+sub-title+of+this+article+also+poses+two+questions+about+Lua\TeX:+What+is+it—and+what+makes+it+so+different?+The+answer+to+“What+is+it?”+may+seem+obvious:+“It’s+a+\TeX{}+typesetting+engine!”+Indeed+it+is,+but+a+broader+view,+and+one+to+which+this+author+subscribes,+is+that+Lua\TeX{}+is+an+extremely+versatile+\TeX-based+document+construction+and+engineering+system.&#xA;&#xA;\subsection{Explaining+Lua\TeX:+Where+to+start?}&#xA;The+goal+of+this+first+article+on+Lua\TeX{}+is+to+offer+a+context+for+understanding+what+this+TeX+engine+provides+and+why/how+its+design+enables+users+to+build/design/create+a+wide+range+of+solutions+to+complex+typesetting+and+design+problems—perhaps+also+offering+some+degree+of+“future+proofing”+&#xA;&#xA;\chapter{Lua\TeX:+Background+and+history}&#xA;\section{Introduction}&#xA;Lua\TeX{}+is,+in+\TeX{}+terms,+“the+new+kid+on+the+block”+despite+having+been+in+active+development+for+over+10+years.&#xA;&#xA;\subsection{Lua\TeX:+Opening+up+\TeX’s+“black+box”}&#xA;Knuth’s+original+\TeX{}+program+is+the+common+ancestor+of+all+modern+\TeX{}+engines+in+use+today+and+Lua\TeX{}+is,+in+effect,+the+latest+evolutionary+step:+derived+from+the+pdf\TeX{}+program+but+with+the+addition+of+some+powerful+software+components+which+bring+a+great+deal+of+extra+functionality.&#xA;\end{document}>)

この例では次の出力が生成されます。ここではページ2～4を示しており、説明を見やすくするためにページ画像を重ね合わせています：

![典型的な LaTeX レポート](/files/98b3c0ae02d8f89a138e62d79d98b07d2531a71f)

### book クラス

以下の例は `レポート` のテキストを再現しますが、 `\documentclass{book}`、パート、章、節、小節、小小節を含みます。例を Overleaf で開くと、 `\subsubsection` すでに *実際の* は番号付きです。これは `book` クラスの設計によるものです。これを変更したい場合は、文書のプリアンブルに次のコマンドを追加してください：

```latex
\setcounter{secnumdepth}{3}
```

```latex
\documentclass{book}
\\title{節と章}
\author{Overleaf}
\date{\today}
\begin{document}
\maketitle
\tableofcontents
\part{Lua\TeX の歴史}

\chapter{Lua\TeX入門}

\section{それは何で、何がそんなに違うのか？}
Lua\TeX{} は \textit{ツールキット}です。高度なソフトウェアツールやコンポーネントが含まれており、それらを使って幅広い文書を作成（組版）できます。この記事のサブタイトルでは Lua\TeX について2つの問いも投げかけています。つまり、それは何か、そして何がそんなに違うのか、です。「それは何か？」への答えは明白に思えるかもしれません。「\TeX{} の組版エンジンです！」そのとおりです。しかし、より広い見方、そしてこの著者も支持する見方では、Lua\TeX{} は非常に多用途な、\TeX ベースの文書構築・工学システムです。

\subsection{Lua\TeXの説明：どこから始める？}
LuaTeX に関するこの最初の記事の目的は、この TeX エンジンが何を提供するのか、そしてその設計がなぜ／どのように、複雑な組版やデザインの問題に対する幅広い解決策をユーザーが構築／設計／作成できるようにするのかを理解するための文脈を与えることです。さらに、ある程度の「将来への備え」も提供するかもしれません。

\chapter{Lua\TeX: 背景と歴史}
\section{導入}
Lua\TeX{} は、10年以上にわたって活発に開発されてきたにもかかわらず、\TeX{} の世界では「登場したばかりの新顔」です。

\subsection{Lua\TeX: \TeX の「ブラックボックス」を開く}
Knuth の元の \TeX{} プログラムは、今日使われているすべての現代的な \TeX{} エンジンの共通祖先であり、Lua\TeX{} は実質的にはその最新の進化形です。pdf\TeX{} プログラムをベースに、さらに多くの機能をもたらす強力なソフトウェアコンポーネントが追加されています。

\subsubsection{Lua\TeX{} は \texttt{\string\directlua} をどのように処理するのか：まず見る}
\verb|\directlua{<code>}| に与えられる ⟨code⟩ は、まず上で説明した処理と計算を用いてトークンに変換され、そのトークン列はトークンリストに格納されます。
\end{document}
```

[出力を見るには、 **この例を Overleaf で開いてください** （使用しているのは `**lualatex**`)](<https://www.overleaf.com/docs?engine=lualatex\&snip_name=Example+of+a+LaTeX+book\&snip=\documentclass{book}&#xA;\title{Sections+and+Chapters}&#xA;\author{Overleaf}&#xA;\date{\today}&#xA;\begin{document}&#xA;\maketitle&#xA;\tableofcontents&#xA;\part{History+of+Lua\TeX}&#xA;&#xA;\chapter{An+Introduction+to+Lua\TeX}&#xA;&#xA;\section{What+is+it—and+what+makes+it+so+different?}&#xA;Lua\TeX{}+is+a+\textit{toolkit}—it+contains+sophisticated+software+tools+and+components+with+which+you+can+construct+(typeset)+a+wide+range+of+documents.+The+sub-title+of+this+article+also+poses+two+questions+about+Lua\TeX:+What+is+it—and+what+makes+it+so+different?+The+answer+to+“What+is+it?”+may+seem+obvious:+“It’s+a+\TeX{}+typesetting+engine!”+Indeed+it+is,+but+a+broader+view,+and+one+to+which+this+author+subscribes,+is+that+Lua\TeX{}+is+an+extremely+versatile+\TeX-based+document+construction+and+engineering+system.&#xA;&#xA;\subsection{Explaining+Lua\TeX:+Where+to+start?}&#xA;The+goal+of+this+first+article+on+Lua\TeX{}+is+to+offer+a+context+for+understanding+what+this+TeX+engine+provides+and+why/how+its+design+enables+users+to+build/design/create+a+wide+range+of+solutions+to+complex+typesetting+and+design+problems—perhaps+also+offering+some+degree+of+“future+proofing”+&#xA;&#xA;\chapter{Lua\TeX:+Background+and+history}&#xA;\section{Introduction}&#xA;Lua\TeX{}+is,+in+\TeX{}+terms,+“the+new+kid+on+the+block”+despite+having+been+in+active+development+for+over+10+years.&#xA;&#xA;\subsection{Lua\TeX:+Opening+up+\TeX’s+“black+box”}&#xA;Knuth’s+original+\TeX{}+program+is+the+common+ancestor+of+all+modern+\TeX{}+engines+in+use+today+and+Lua\TeX{}+is,+in+effect,+the+latest+evolutionary+step:+derived+from+the+pdf\TeX{}+program+but+with+the+addition+of+some+powerful+software+components+which+bring+a+great+deal+of+extra+functionality.&#xA;&#xA;\subsubsection{How+Lua\TeX{}+processes+\texttt{\string\directlua}:+A+first+look}&#xA;The+⟨code⟩+provided+to+\verb|\directlua{\<code\>}|+is+first+converted+to+tokens+using+the+processes+and+calculations+discussed+above;+that+sequence+of+tokens+is+stored+in+a+token+list.&#xA;\end{document}>)

## 章と節をカスタマイズする

以下を使用できます。 [`titlesec`](https://ctan.org/pkg/titlesec?lang=en) パッケージを使うと、章、節、小節のスタイルを簡単にカスタマイズできます。

```latex
\documentclass[a4paper,12pt]{book}
\usepackage[T1]{fontenc}
\usepackage{titlesec}

\titleformat
{\chapter} % コマンド
[display] % 形
{\bfseries\Large\itshape} % 形式
{物語番号 \ \thechapter} % ラベル
{0.5ex} % 間隔
{
    \rule{\textwidth}{1pt}
    \vspace{1ex}
    \centering
} % 前コード
[
\vspace{-0.5ex}%
\rule{\textwidth}{0.3pt}
] % 後コード

\titleformat{\section}[wrap]
{\normalfont\bfseries}
{\thesection.}{0.5em}{}

\titlespacing{\section}{12pc}{1.5ex plus .1ex minus .2ex}{1pc}

\begin{document}
\chapter{さあ始めましょう}
\section{最初の試み}

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris...

\section{2回目の試み}

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris...

\end{document}
```

[この `titlesec` Overleaf の例。](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=titlesec+example\&snip=%5Cdocumentclass%5Ba4paper%2C12pt%5D%7Bbook%7D%0A%5Cusepackage%5BT1%5D%7Bfontenc%7D%0A%5Cusepackage%7Btitlesec%7D%0A%0A%5Ctitleformat%0A%7B%5Cchapter%7D+%25+command%0A%5Bdisplay%5D+%25+shape%0A%7B%5Cbfseries%5CLarge%5Citshape%7D+%25+format%0A%7BStory+No.+%5C+%5Cthechapter%7D+%25+label%0A%7B0.5ex%7D+%25+sep%0A%7B%0A++++%5Crule%7B%5Ctextwidth%7D%7B1pt%7D%0A++++%5Cvspace%7B1ex%7D%0A++++%5Ccentering%0A%7D+%25+before-code%0A%5B%0A%5Cvspace%7B-0.5ex%7D%25%0A%5Crule%7B%5Ctextwidth%7D%7B0.3pt%7D%0A%5D+%25+after-code%0A%0A%0A%5Ctitleformat%7B%5Csection%7D%5Bwrap%5D%0A%7B%5Cnormalfont%5Cbfseries%7D%0A%7B%5Cthesection.%7D%7B0.5em%7D%7B%7D%0A%0A%5Ctitlespacing%7B%5Csection%7D%7B12pc%7D%7B1.5ex+plus+.1ex+minus+.2ex%7D%7B1pc%7D%0A%0A%5Cbegin%7Bdocument%7D%0A%5Cchapter%7BLet%27s+begin%7D%0A%5Csection%7BFirst+Attempt%7D%0A%0ALorem+ipsum+dolor+sit+amet%2C+consectetur+adipiscing+elit%2C+sed+do+%0Aeiusmod+tempor+incididunt+ut+labore+et+dolore+magna+aliqua.+Ut+%0Aenim+ad+minim+veniam%2C+quis+nostrud+exercitation+ullamco+laboris...%0A%0A%5Csection%7BSecond+attempt%7D%0A%0ALorem+ipsum+dolor+sit+amet%2C+consectetur+adipiscing+elit%2C+sed+do+%0Aeiusmod+tempor+incididunt+ut+labore+et+dolore+magna+aliqua.+Ut+%0Aenim+ad+minim+veniam%2C+quis+nostrud+exercitation+ullamco+laboris...%0A%0A%5Cend%7Bdocument%7D)

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

![Titlesecolv2.png](/files/e460b400f20ec60c846673ec18b2e5972e5a0e52)

### titlesec のコマンド

一般的なコマンドは2つあります：

```latex
 \titleformat{<command>}[<shape>]{<format>}{<label>}{<sep>}{<before-code>}[<after-code>]
```

ここで `[<shape>]` や `[<after-code>]` は任意の引数であり、

* `<command>` は再定義される節区切りコマンドです： `\part`, `\\chapter`, `\section`, `\subsection`, `\subsubsection`, `\paragraph` または `\subparagraph`.
* `<shape>` は節見出しの形状です。取り得る値は次のとおりです： `hang`, `block`, `表示`, `runin`, `leftmargin`, `rightmargin`, `drop`, `wrap` や `frame`.
* `<format>` は、タイトル、ラベル、本文に適用される書式です。たとえば `\normalfont\Large\bfseries`
* `<label>` は節のラベルを指定します。
* `<sep>` はラベルとタイトル本文の間の水平間隔で、長さを指定する必要があり、空にはできません。
* `<before-code>` はタイトル本文の前に置かれるコードです。
* `<after-code>` はタイトル本文の後に置かれるコードです。

や

```latex
 \titlespacing{<command>}{<left>}{<before-sep>}{<after-sep>}
```

次のとおりです：

* `<left>` 左余白を増やします。
* `<before-sep>` はタイトル前の縦方向の空白です。
* `<after-sep>` はタイトルと節外の本文との間隔です。

このコマンドの星付き版（`\titlespacing*`）はタイトルの後に続く段落のインデントをなくします。

## さらに読む

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

* [LaTeXで文書を作成する](/latex/ja/latexno/01-learn-latex-in-30-minutes.md)
* [太字、斜体、下線](/latex/ja/latexno/03-bold-italics-and-underlining.md)
* [目次](/latex/ja/wen-shu-gou-zao/02-table-of-contents.md)
* [節や数式の相互参照](/latex/ja/wen-shu-gou-zao/03-cross-referencing-sections-equations-and-floats.md)
* [大規模プロジェクトでの管理](/latex/ja/wen-shu-gou-zao/07-management-in-a-large-project.md)
* [複数ファイルの LaTeX プロジェクト](/latex/ja/wen-shu-gou-zao/08-multi-file-latex-projects.md)
* [ハイパーリンク](/latex/ja/wen-shu-gou-zao/09-hyperlinks.md)
* [ページ番号](/latex/ja/shu-shi-she-ding/03-page-numbering.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)
* [カウンタ](/latex/ja/shu-shi-she-ding/10-counters.md)
* [フォントサイズ、ファミリー、スタイル](/latex/ja/fonto/01-font-sizes-families-and-styles.md)
* [`titlesec` パッケージマニュアル](http://mirrors.ctan.org/macros/latex/contrib/titlesec/titlesec.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/wen-shu-gou-zao/01-sections-and-chapters.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.
