> 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/ko/document-structure/04-indices.md).

# 색인

예를 들어 책과 같은 큰 문서에서는 주요 용어를 담은 알파벳 목록을 만드는 것이 관례입니다. LaTeX와 지원 프로그램 **imakeidx**를 사용하면 인덱스를 매우 쉽게 생성할 수 있습니다.

## 소개

간단한 작동 예제를 살펴봅시다.

```latex
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{imakeidx}
\makeindex

\begin{document}
\section{Introduction}
이 예제에서는 몇 가지 키워드\index{keywords}가 사용될 것이며
이들은 중요하고 Index\index{Index}에 나타날 가치가 있습니다.

generate\index{generate}와 some\index{others} 같은 용어도
또한 나타날 것입니다.

\printindex
\end{document}
```

[이 예제를 Overleaf에서 열기](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Index+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%5BT1%5D%7Bfontenc%7D%0A%5Cusepackage%7Bimakeidx%7D%0A%5Cmakeindex%0A%0A%5Cbegin%7Bdocument%7D%0A%5Csection%7BIntroduction%7D%0AIn+this+example%2C+several+keywords%5Cindex%7Bkeywords%7D+will+be+used+%0Awhich+are+important+and+deserve+to+appear+in+the+Index%5Cindex%7BIndex%7D.%0A%0ATerms+like+generate%5Cindex%7Bgenerate%7D+and+some%5Cindex%7Bothers%7D+will+%0Aalso+show+up.+%0A%0A%5Cprintindex%0A%5Cend%7Bdocument%7D)

다음 이미지는 위의 예제로 생성된 결과를 보여줍니다:

![Index1OLV2.png](/files/3ff27a810de89b796a90f41135d4b69f788e8bd6)

먼저, 패키지는 다음 줄을 통해 서문에 포함됩니다

```latex
\usepackage{imakeidx}
```

그다음 명령 `\makeindex` 은 인덱스가 작동하기 위해 필수이며, 모양을 사용자 지정하기 위해 몇 가지 매개변수를 받을 수 있습니다. 다음 절에서 이것이 분명해질 것입니다.

인덱스에 항목을 추가하려면 명령 `\index{}` 을 사용하며, 추가할 단어를 매개변수로 삽입합니다. 주의하세요. 이것은 현재 위치에 그 단어를 출력하는 것이 아니라 인덱스에만 출력합니다.

마지막으로, 명령 `\printindex` 이 실제로 인덱스를 렌더링합니다. 만약 `babel` 패키지를 통해 특별한 지역화 설정을 사용하고 있다면 제목은 그에 맞게 번역됩니다.

참고: 다음 대신 `imakeidx`를 사용하기보다는, 패키지 `makeidx` 를 가져올 수 있지만 사용자 지정 가능성은 더 적습니다.

## Overleaf에서의 인덱스

Overleaf의 프로젝트에 인덱스를 추가할 때 **주의할 점은** 인덱스가 올바르게 컴파일되려면, मुख्य `.tex` 파일이 프로젝트의 루트 디렉터리에 있어야 하고, *어떤 폴더 안에도 있지 않아야*합니다. 이렇게 하면 인덱스를 생성하는 데 필요한 보조 파일이 컴파일러가 접근할 수 있는 방식으로 캐시됩니다.

## 항목과 하위 항목

이전 섹션에서 언급했듯이, 명령 `\index` 은 전달된 단어를 인덱스에 추가하지만, 이것이 사용할 수 있는 유일한 방법은 아닙니다.

```latex
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{imakeidx}
\makeindex

\begin{document}
\section{Introduction}
이 예제에서는 몇 가지 키워드\index{keywords}가 사용될 것이며
이들은 중요하고 Index\index{Index}에 나타날 가치가 있습니다.

generate\index{generate}와 some\index{others} 같은 용어도 또한
나타날 수 있습니다. 인덱스의 용어는 또한 중첩될 수 있습니다 \index{Index!nested}

\clearpage

\section{Second section}
이 두 번째 섹션\index{section}에는 어떤 특별한 단어가 포함될 수 있으며,
이미 사용된 것들\index{keywords!used}을 확장할 수 있습니다.

\printindex
\end{document}
```

[이 예제를 Overleaf에서 열기](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Index+example+2\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%5BT1%5D%7Bfontenc%7D%0A%5Cusepackage%7Bimakeidx%7D%0A%5Cmakeindex%0A%0A%5Cbegin%7Bdocument%7D%0A%5Csection%7BIntroduction%7D%0AIn+this+example%2C+several+keywords%5Cindex%7Bkeywords%7D+will+be+used+%0Awhich+are+important+and+deserve+to+appear+in+the+Index%5Cindex%7BIndex%7D.%0A%0ATerms+like+generate%5Cindex%7Bgenerate%7D+and+some%5Cindex%7Bothers%7D+will+also+%0Ashow+up.+Terms+in+the+index+can+also+be+nested+%5Cindex%7BIndex%21nested%7D%0A%0A%5Cclearpage%0A%0A%5Csection%7BSecond+section%7D%0AThis+second+section%5Cindex%7Bsection%7D+may+include+some+special+word%2C+%0Aand+expand+the+ones+already+used%5Cindex%7Bkeywords%21used%7D.%0A%0A%5Cprintindex%0A%5Cend%7Bdocument%7D)

다음 이미지는 위의 예제로 생성된 결과를 보여줍니다:

![Index2OLV2.png](/files/c3726e841e14ae3238778bbed5c3e8c9c1c7aff8)

인덱스의 용어를 특수한 형용사를 포함하도록 확장하는 것은 일반적인 관행입니다. 예를 들어 단어 *Field* 는 다음 형용사 앞에 오면 특별한 의미를 가질 수 있습니다 *finite* 또는 다음이 뒤따르면 *of characteristic 0*, 그리고 서로 다른 유형의 *Field*를 인덱스의 별도 항목으로 추가하는 것은 다소 번거로울 수 있습니다. 이런 경우에는 느낌표 "!"를 추가하여 이 기호 뒤의 용어를 주 용어의 하위 항목으로 넣을 수 있습니다 *Field*.

예제에서 "Index"라는 단어는 하위 항목으로 "nested"를 갖습니다.

## 인덱스 서식 지정

인덱스 제목 변경, 여러 열 추가, 열 너비 변경과 같은 간단한 인덱스 서식 지정은 다음에 선택적 값을 전달하여 쉽게 할 수 있습니다 `\makeindex`:

```latex
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{imakeidx}
\makeindex[columns=3, title=Alphabetical Index]

\begin{document}
\section{Introduction}
이 예제에서는 몇 가지 키워드\index{keywords}가 사용될 것이며
이들은 중요하고 Index\index{Index}에 나타날 가치가 있습니다.

generate\index{generate}와 some\index{others} 같은 용어도 또한
나타날 수 있습니다. 인덱스의 용어는 또한 중첩될 수 있습니다 \index{Index!nested}

\clearpage

\section{Second section}
이 두 번째 섹션\index{section}에는 어떤 특별한 단어가 포함될 수 있으며,
이미 사용된 것들\index{keywords!used}을 확장할 수 있습니다.

\printindex
\end{document}
```

[이 예제를 Overleaf에서 열기](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Index+example+3\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%5BT1%5D%7Bfontenc%7D%0A%5Cusepackage%7Bimakeidx%7D%0A%5Cmakeindex%5Bcolumns%3D3%2C+title%3DAlphabetical+Index%5D%0A%0A%5Cbegin%7Bdocument%7D%0A%5Csection%7BIntroduction%7D%0AIn+this+example%2C+several+keywords%5Cindex%7Bkeywords%7D+will+be+used+which+%0Aare+important+and+deserve+to+appear+in+the+Index%5Cindex%7BIndex%7D.%0A%0ATerms+like+generate%5Cindex%7Bgenerate%7D+and+some%5Cindex%7Bothers%7D+will+also+%0Ashow+up.+Terms+in+the+index+can+also+be+nested+%5Cindex%7BIndex%21nested%7D%0A%0A%5Cclearpage%0A%0A%5Csection%7BSecond+section%7D%0AThis+second+section%5Cindex%7Bsection%7D+may+include+some+special+word%2C+%0Aand+expand+the+ones+already+used%5Cindex%7Bkeywords%21used%7D.%0A%0A%5Cprintindex%0A%5Cend%7Bdocument%7D)

다음 이미지는 위의 예제로 생성된 결과를 보여줍니다:

![Index3OLV2.png](/files/0ae7ee80f94f8a8d82b906430412712bf3867bad)

이 예제에서 인덱스는 매개변수 `columns=3`를 사용해 세 열 형식으로 제시되며, 제목은 다음을 통해 "Alphabetical Index"로 변경됩니다 `title=Alphabetical Index`; 이러한 매개변수는 `\makeindex` 에 전달됩니다. 다음을 참조하세요 [참고 안내서](#reference-guide) 에서 사용할 수 있는 매개변수 목록과 그 설명을 확인하세요.

### 스타일 파일 사용

인덱스를 더 세부적으로 사용자 지정하려면 스타일 파일을 사용할 수 있습니다. 스타일 파일은 `makeindex` 에 최종 출력의 의도된 형식에 대해 알려 줍니다. 스타일 파일에는 다음 목록이 포함됩니다 `<key, value>` 쌍. 예를 들어, 인덱스의 용어를 첫 글자별로 묶고 페이지 번호를 오른쪽 정렬해야 한다면, 다음 스타일 파일이 그 역할을 합니다:

```latex
headings_flag 1

heading_prefix "\n\\centering\\large\\sffamily\\bfseries%
\\noindent\\textbf{"heading_suffix "}\\par\\nopagebreak\n"

item_0 "\n \\item \\small "

delim_0 " \\hfill "
delim_1 " \\hfill "
delim_2 " \\hfill "
```

키는 인덱스 출력의 서로 다른 요소를 변경합니다:

* `headings_flag 1` 새 그룹 앞에 그룹 머리말(기호, 숫자 또는 글자)을 삽입하여 그룹화를 가능하게 합니다.
* `heading_prefix` 는 새 글자가 시작되기 전에 삽입할 머리말을 형식화합니다. 글꼴 계열, 글자 크기, 정렬에는 일반적인 서식 명령을 사용하지만, 백슬래시는 하나가 아니라 두 개의 백슬래시로 이스케이프해야 합니다.
* `item_0` 은 두 개의 기본 항목 사이에 삽입될 것입니다.
* `delim_*` 는 키와 첫 번째 페이지 번호 사이에 삽입될 구분자입니다.

.ist 파일에서 사용할 키와 값의 전체 목록은 다음을 참조하세요 [참고 안내서에 포함된 표](#keys-to-create-styles-files).

이전 파일이 "example\_style.ist"로 저장되어 있다고 가정합니다. 문서에서 이를 사용하려면 매개변수 `options= -s example_style.ist` 를 `\makeindex` 명령에 추가합니다.

```latex
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{imakeidx}
\makeindex[columns=3, title=Alphabetical Index,
           options= -s example_style.ist]

\begin{document}

\tableofcontents

\section{Introduction}
이 예제에서는 몇 가지 키워드\index{keywords}가 사용될 것이며 이들은 중요하고 Index\index{Index}에 나타날 가치가 있습니다.

generate\index{generate}, great\index{great} 목록, 그리고 중요할 수 있는 som other\index{others} 용어\index{important} 같은 것들이
또한 나타날 수 있습니다. 인덱스의 용어는 또한 중첩될 수 있습니다 \index{Index!nested}

\clearpage

\section{Second section}
이 두 번째 섹션\index{section}에는 어떤 특별한 단어가 포함될 수 있으며, 이미 사용된 것들\index{keywords!used}을 확장할 수 있습니다.

\printindex
\end{document}
```

[Overleaf에서 인덱스 스타일 파일을 사용하는 예제 열기](https://www.overleaf.com/project/new/template/20614?id=70756423\&templateName=Using+an+index+style+file\&latexEngine=pdflatex\&texImage=texlive-full%3A2020.1\&mainFile=)

다음 이미지는 위의 예제로 생성된 결과를 보여줍니다:

![Index4OLV2.png](/files/bb9adc281ccb72350f86a08fb56d50739782046c)

## 목차에 인덱스 포함

기본적으로 인덱스는 목차에 포함되지 않으며, 이는 쉽게 조정할 수 있습니다.

```latex
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{imakeidx}
\makeindex[columns=3, title=Alphabetical Index, intoc]

\begin{document}
\tableofcontents

\section{Introduction}
이 예제에서는 몇 가지 키워드\index{keywords}가
사용될 것이며 중요하고 다음에 나타날 가치가 있는
Index\index{Index}.

generate\index{generate}와 some\index{others} 같은 용어도
또한 나타날 것입니다. 인덱스의 용어는 또한
중첩될 수 있습니다 \index{Index!nested}

\clearpage

\section{Second section}
이 두 번째 섹션\index{section}에는 어떤 특별한
단어가 포함될 수 있으며, 이미 사용된 것들\index{keywords!used}을 확장할 수 있습니다.

\printindex
\end{document}
```

[이 예제를 Overleaf에서 열기](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Index+example+3\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%5BT1%5D%7Bfontenc%7D%0A%5Cusepackage%7Bimakeidx%7D%0A%5Cmakeindex%5Bcolumns%3D3%2C+title%3DAlphabetical+Index%2C+intoc%5D%0A%0A%5Cbegin%7Bdocument%7D%0A%5Ctableofcontents%0A%0A%5Csection%7BIntroduction%7D%0AIn+this+example%2C+several+keywords%5Cindex%7Bkeywords%7D+will+be+%0Aused+which+are+important+and+deserve+to+appear+in+the+%0AIndex%5Cindex%7BIndex%7D.%0A%0ATerms+like+generate%5Cindex%7Bgenerate%7D+and+some%5Cindex%7Bothers%7D+%0Awill+also+show+up.+Terms+in+the+index+can+also+be+%0Anested+%5Cindex%7BIndex%21nested%7D%0A%0A%5Cclearpage%0A%0A%5Csection%7BSecond+section%7D%0AThis+second+section%5Cindex%7Bsection%7D+may+include+some+special+%0Aword%2C+and+expand+the+ones+already+used%5Cindex%7Bkeywords%21used%7D.%0A%0A%5Cprintindex%0A%5Cend%7Bdocument%7D)

다음 이미지는 위의 예제로 생성된 결과를 보여줍니다:

![Index5OLV2.png](/files/d6266a5d38641a233e28bdba4b3abcbc6d431aca)

매개변수 `intoc` 를 명령에 추가하면 `\makeindex` 인덱스 제목을 목차에 포함하는 것이 활성화됩니다.

## 참고 안내서

### \makeindex 명령의 매개변수

**title**

특정 인덱스의 시작 부분에 조판될 제목입니다. 예제는 인덱스 서식 지정에서 제시됩니다.

**intoc**

이 옵션을 전달하면 인덱스 제목이 목차에 들어갑니다.

**columns**

key=value 구문을 사용하며, 값은 열의 개수를 나타내는 정수여야 합니다. 기본값은 2입니다.

**columnsep**

열 사이의 간격을 나타내는 단위를 지정합니다. 구문은 key=value여야 하며, 예를 들어 columnsep=2em입니다.

**columnseprule**

이 옵션이 전달되면 열 사이에 세로 줄이 렌더링됩니다.

### 스타일 파일을 만들기 위한 키

다음 표는 .ist 스타일 파일을 만들기 위한 키, 기본값, 설명을 보여줍니다.

| key                         | 설명                                                                                                                                                   |
| --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `actual <char>`             | '@' 다음 항목이 출력 파일에 나타나야 함을 나타내는 기호.                                                                                                                   |
| `arg_close <char>`          | '}' 인덱스 항목 인수의 닫는 구분자.                                                                                                                               |
| `arg_open <char>`           | '{' 인덱스 항목 인수의 여는 구분자.                                                                                                                               |
| `encap <char>`              | ' 기호는 인수 목록의 나머지 부분이 페이지 번호를 감싸는 명령으로 사용됨을 나타냅니다.                                                                                                    |
| `escape <char>`             | '\\\\' 앞의 기호 자체가 이스케이프 기호가 아닌 한, 뒤따르는 문자를 이스케이프하는 기호입니다. 참고: quote는 바로 뒤에 오는 문자를 이스케이프하는 데 사용되지만, 앞에 이스케이프 기호가 있으면 일반 문자로 취급됩니다. 이 두 기호는 서로 달라야 합니다. |
| `keyword <string>`          | "\\\indexentry" makeindex에 그 인수가 인덱스 항목임을 알려 주는 명령.                                                                                                  |
| `level <char>`              | '!' 하위 항목의 새 수준을 나타내는 구분자.                                                                                                                           |
| `quote <char>`              | '"' 참고: quote는 바로 뒤에 오는 문자를 이스케이프하는 데 사용되지만, 앞에 이스케이프 기호가 있으면 일반 문자로 취급됩니다. 이 두 기호는 서로 달라야 합니다.                                                      |
| `range_close <char>`        | ')' 명시적 페이지 범위의 끝을 나타내는 닫는 구분자.                                                                                                                      |
| `range_open <char>`         | '(' 명시적 페이지 범위의 시작을 나타내는 여는 구분자.                                                                                                                     |
| `preamble <string>`         | "\\\begin{theindex}\n" 출력 파일의 서문.                                                                                                                    |
| `postamble <string>`        | "\n\n\\\end{theindex}\n" 출력 파일의 후문.                                                                                                                  |
| `setpage_prefix <string>`   | "\n \\\setcounter{page}{" 시작 페이지 번호를 설정하는 명령의 접두사.                                                                                                   |
| `setpage_suffix <string>`   | "}\n" 시작 페이지 번호를 설정하는 명령의 접미사.                                                                                                                       |
| `group_skip <string>`       | "\n\n \\\indexspace\n" 새 그룹이 시작되기 전에 삽입할 세로 공간.                                                                                                      |
| `headings_flag <string>`    | 0 새 그룹 머리말(기호, 숫자, 그리고 26개의 글자)의 처리를 나타내는 플래그입니다. 양수 값은 접두사와 접미사 사이에 대문자를 삽입하고, 음수 값은 소문자를 삽입합니다(기본값은 0이며, 이 경우 머리말이 생성되지 않습니다).                     |
| `heading_prefix <string>`   | "" 새 글자가 시작되기 전에 삽입될 머리말의 접두사.                                                                                                                       |
| `symhead_positive <string>` | "Symbols" headings\_flag가 양수일 때 삽입될 기호용 머리말.                                                                                                         |
| `symhead_negative <string>` | "symbols" headings\_flag가 음수일 때 삽입될 기호용 머리말.                                                                                                         |
| `numhead_positive <string>` | "Numbers" headings\_flag가 양수일 때 삽입될 숫자용 머리말.                                                                                                         |
| `numhead_negative <string>` | "numbers" headings\_flag가 음수일 때 삽입될 숫자용 머리말.                                                                                                         |
| `item_0 <string>`           | "\n \\\item " 두 개의 기본(레벨 0) 항목 사이에 삽입될 명령.                                                                                                           |
| `item_1 <string>`           | "\n \\\subitem " 두 개의 보조(레벨 1) 항목 사이에 삽입될 명령.                                                                                                        |
| `item_2 <string>`           | "\n \\\subsubitem " 두 개의 레벨 2 항목 사이에 삽입될 명령.                                                                                                         |
| `item_01 <string>`          | "\n \\\subitem " 레벨 0 항목과 레벨 1 항목 사이에 삽입될 명령.                                                                                                        |
| `item_x1 <string>`          | "\n \\\subitem " 레벨 0 항목과 레벨 1 항목 사이에 삽입될 명령이며, 레벨 0 항목에는 연결된 페이지 번호가 없습니다.                                                                          |
| `item_12 <string>`          | "\n \\\subsubitem " 레벨 1 항목과 레벨 2 항목 사이에 삽입될 명령.                                                                                                     |
| `item_x2 <string>`          | "\n \\\subsubitem " 레벨 1 항목과 레벨 2 항목 사이에 삽입될 명령이며, 레벨 1 항목에는 연결된 페이지 번호가 없습니다.                                                                       |
| `delim_0 <string>`          | ", " 레벨 0 키와 첫 번째 페이지 번호 사이에 삽입될 구분자(기본값: 쉼표 뒤에 공백).                                                                                                 |
| `delim_1 <string>`          | ", " 레벨 1 키와 첫 번째 페이지 번호 사이에 삽입될 구분자(기본값: 쉼표 뒤에 공백).                                                                                                 |
| `delim_2 <string>`          | ", " 레벨 2 키와 첫 번째 페이지 번호 사이에 삽입될 구분자(기본값: 쉼표 뒤에 공백).                                                                                                 |
| `delim_n <string>`          | ", " 어느 수준에서든 같은 키에 대한 두 페이지 번호 사이에 삽입될 구분자(기본값: 쉼표 뒤에 공백).                                                                                          |
| `delim_r <string>`          | "--" 범위의 시작 페이지 번호와 끝 페이지 번호 사이에 삽입될 구분자.                                                                                                            |
| `delim_t <string>`          | "" 페이지 목록의 끝에 삽입될 구분자입니다. 이 구분자는 연결된 페이지 목록이 없는 항목에는 영향을 주지 않습니다.                                                                                    |
| `encap_prefix <string>`     | "\\\\" 페이지 번호를 감싸는 명령의 접두사 첫 번째 부분.                                                                                                                  |
| `encap_infix <string>`      | "{" 페이지 번호를 감싸는 명령의 접두사 두 번째 부분.                                                                                                                     |
| `encap_suffix <string>`     | "}". 페이지 번호를 감싸는 명령의 접미사.                                                                                                                            |
| `line_max <number>`         | 72 출력에서 한 줄의 최대 길이이며, 이를 넘으면 줄이 바뀝니다.                                                                                                                |
| `indent_space <string>`     | "\t\t" 줄바꿈된 줄 앞에 삽입될 공백(기본값: 탭 두 개).                                                                                                                 |
| `indent_length <number>`    | 16 indent\_space의 길이(기본값: 16, 탭 2개와 동일).                                                                                                             |

## 추가 읽을거리

더 많은 정보는 다음을 참조하세요:

* [용어집](/latex/ko/document-structure/05-glossaries.md)
* [표와 그림 목록](/latex/ko/figures-and-tables/03-lists-of-tables-and-figures.md)
* [목차](/latex/ko/document-structure/02-table-of-contents.md)
* [섹션과 장](/latex/ko/document-structure/01-sections-and-chapters.md)
* [하이퍼링크](/latex/ko/document-structure/09-hyperlinks.md)
* [국제 언어 지원](/latex/ko/languages/03-international-language-support.md)
* [섹션과 수식의 상호 참조](/latex/ko/document-structure/03-cross-referencing-sections-equations-and-floats.md)
* [대규모 프로젝트에서의 관리](/latex/ko/document-structure/07-management-in-a-large-project.md)
* [다중 파일 LaTeX 프로젝트](/latex/ko/document-structure/08-multi-file-latex-projects.md)
* [imakeidx 패키지 문서](http://mirror.math.ku.edu/tex-archive/macros/latex/contrib/imakeidx/imakeidx.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/ko/document-structure/04-indices.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.
