> 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/formatting/03-page-numbering.md).

# 페이지 번호 매기기

문서의 페이지 번호는 특정한 *style*방식을 사용해 조판할 수 있습니다. 예를 들어 아라비아 숫자나 로마 숫자를 사용하는 방식이며, 특정 페이지 *위치*—보통 머리말이나 꼬리말 안에 있습니다. 이 글에서는 페이지 번호의 스타일과 위치를 어떻게 변경할 수 있는지 보여 줍니다:

* 그 *style* 페이지 번호의 `\pagenumbering` 명령으로 변경할 수 있으며;
* 그 *위치* 페이지 번호의 [`fancyhdr` 패키지](https://ctan.org/pkg/fancyhdr?lang=en).

## 페이지 번호 스타일 설정

페이지 번호의 스타일은 다음 명령으로 변경할 수 있습니다

```latex
\pagenumbering{⟨style⟩}
```

여기서 `⟨style⟩` 은 다음 중 하나입니다

* `arabic`: 아라비아 숫자(1, 2, 3, ... )를 사용합니다
* `alph`: 소문자(a, b, c, ... )를 사용합니다
* `Alph`: 대문자(A, B, C, ... )를 사용합니다
* `roman`: 소문자 로마 숫자(i, ii, iii, ... )를 사용합니다
* `Roman`: 대문자 로마 숫자(I, II, III, ... )를 사용합니다

### 페이지 번호 스타일을 보여 주는 예제

다음 예제는 목차를 조판한 뒤 5개의 페이지를 이어서 보여 주며, 각 페이지는 페이지 번호에 대한 다음 옵션 중 하나를 보여 줍니다. 내부적으로 LaTeX는 이른바 `⟨style⟩` 카운터 *를 사용해 현재 페이지 번호를 기록합니다. 카운터는 정수 값을 저장하는 데 사용되는 LaTeX 변수의 이름입니다—* Overleaf 카운터 문서 [에서](/latex/ko/formatting/10-counters.md) 더 자세한 내용과 예제를 볼 수 있습니다.

```latex
\begin{document}
% 목차 삽입
\tableofcontents
\newpage
\section{대문자 로마 숫자}
\pagenumbering{Roman}% 대문자 'R': 대문자 로마 숫자
\blindtext[1]
\newpage
\section{소문자 로마 숫자} % 소문자 로마 숫자
\pagenumbering{roman}
\blindtext[1]
\newpage
\section{아라비아 숫자}
\pagenumbering{arabic} % 아라비아/인도 숫자 페이지 번호
\blindtext[1]
\newpage
\section{소문자 알파벳}
\pagenumbering{alph} % 소문자 알파벳 페이지 "번호"
\blindtext[1]
\newpage
\section{대문자 알파벳}
\pagenumbering{Alph} % 대문자 알파벳 페이지 "번호"
\blindtext[1]
\end{document}
```

[이 예제를 Overleaf에서 열기](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Demonstrating+page+number+styles\&snip=%5Cdocumentclass%7Barticle%7D%0A%25+Use+a+small+page+size+to+avoid+%0A%25+needing+lots+of+text+to+create+%0A%25+several+pages%0A%5Cusepackage%5Bincludefoot%2C%0Apaperheight%3D10cm%2C%0Apaperwidth%3D10cm%2C%0Atextwidth%3D9cm%2C%0Atextheight%3D8cm%5D%7Bgeometry%7D%0A%5Cusepackage%7Bblindtext%7D%0A%5Cbegin%7Bdocument%7D%0A%25+Insert+a+table+of+contents%0A%5Ctableofcontents%0A%5Cnewpage%0A%5Csection%7BUppercase+Roman%7D%0A%5Cpagenumbering%7BRoman%7D%25+Capital+%27R%27%3A+uppercase+Roman+numerals%0A%5Cblindtext%5B1%5D%0A%5Cnewpage%0A%5Csection%7BLowercase+Roman%7D+%25+lowercase+Roman+numerals%0A%5Cpagenumbering%7Broman%7D%0A%5Cblindtext%5B1%5D%0A%5Cnewpage%0A%5Csection%7BArabic+numbers%7D%0A%5Cpagenumbering%7Barabic%7D+%25+Arabic%2FIndic+page+numbers%0A%5Cblindtext%5B1%5D%0A%5Cnewpage%0A%5Csection%7BLowercase+alphabetic%7D%0A%5Cpagenumbering%7Balph%7D+%25+Lowercase+alphabetic+page+%22numbers%22%0A%5Cblindtext%5B1%5D%0A%5Cnewpage%0A%5Csection%7BUppercase+alphabetic%7D%0A%5Cpagenumbering%7BAlph%7D+%25+Uppercase+alphabetic+page+%22numbers%22%0A%5Cblindtext%5B1%5D%0A%5Cend%7Bdocument%7D)

다음 그림은 이 문서가 생성한 목차를 보여 줍니다. 다음을 주목하세요 `\pagenumbering` 명령이 각 스타일마다 시작 페이지 번호를 초기값으로 재설정했습니다: `i` 는 `roman` 스타일에 대해, `복사된` 는 `Alph` 스타일에 대해, `I` 는 `Roman` 스타일 등등에 대해 해당합니다:

![LaTeX로 조판한 예제 목차](/files/3524860aa9501994c4bfab4545c5211f63805c80)

다음은 이 예제로 생성된 샘플 페이지 두 장입니다. 첫 번째 이미지는 페이지 번호를 대문자 로마 숫자로 보여 주고, 두 번째는 페이지 번호를 대문자로 보여 줍니다:

![로마 숫자를 사용해 조판한 페이지 번호 예제](/files/5edaa2877c837fed02f594926d4501535079e8f0)

![대문자를 사용해 조판한 페이지 번호 예제](/files/24771a9bf170b879c51d84ac480fe8274d161589)

## Book 클래스: 두 가지 페이지 번호 스타일 사용

이 [책의 앞부분 몇 페이지는](https://en.wikipedia.org/wiki/Book_design#Structure)저작권 페이지, 제목 또는 반제목 페이지, 서문이나 머리말, 그리고 목차를 포함하며, 통틀어 *예비* 페이지, 또는 줄여서 prelims라고 부르며—이 페이지들을 가리키는 또 다른 용어는 [*앞부분*](https://en.wikipedia.org/wiki/Book_design#Front_matter)입니다. 전통적으로 예비 페이지는 소문자 로마 숫자로 번호를 매기고, 본문 페이지는 아라비아 숫자로 번호를 매깁니다. `book` 문서 클래스에는 이를 돕는 명령이 포함되어 있으며, 다음 예제가 이를 보여 줍니다.

```latex
\documentclass{book}
% emptypage 패키지는 빈 페이지에 페이지 번호와
% 머리말이 나타나지 않도록 합니다.
\usepackage{emptypage}
\begin{document}
\frontmatter % 페이지 번호에 소문자 로마 숫자 사용
\chapter*{서문}
\addcontentsline{toc}{chapter}{서문}
서문은 책의 저자가 아닌 사람이 씁니다.

\chapter*{머리말}
\addcontentsline{toc}{chapter}{머리말}
머리말은 책의 저자가 씁니다.

\tableofcontents

\mainmatter % 이제 페이지 번호에 아라비아 숫자 사용

\chapter{첫 번째 장}
이것은 빈 장이 될 것입니다...
\section{First section}
어떤 텍스트라도 있으면 좋겠습니다.
\chapter{두 번째 장}
\end{document}
```

[이 예제를 Overleaf에서 열기](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Example+page+numbers+in+book+class\&snip=%5Cdocumentclass%7Bbook%7D%0A%25+The+emptypage+package+prevents+page+numbers+and%0A%25+headings+from+appearing+on+empty+pages.%0A%5Cusepackage%7Bemptypage%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cfrontmatter+%25Use+lowercase+Roman+numerals+for+page+numbers%0A%5Cchapter%2A%7BForeword%7D%0A%5Caddcontentsline%7Btoc%7D%7Bchapter%7D%7BForeword%7D%0AThe+Foreword+is+written+by+someone+who+is+not+the+book%27s+author.%0A%0A%5Cchapter%2A%7BPreface%7D%0A%5Caddcontentsline%7Btoc%7D%7Bchapter%7D%7BPreface%7D%0AThe+Preface+is+written+by+the+book%27s+author.%0A%0A%5Ctableofcontents%0A%0A%5Cmainmatter+%25+Now+Use+Arabic+numerals+for+page+numbers%0A%0A%5Cchapter%7BFirst+Chapter%7D%0AThis+will+be+an+empty+chapter...%0A%5Csection%7BFirst+section%7D%0ASome+text+would+be+good.%0A%5Cchapter%7BThe+second+chapter%7D%0A%5Cend%7Bdocument%7D)

이 예제로 생성된 목차는 앞부분에는 로마 숫자를, 본문에는 아라비아 숫자를 사용하는 것을 보여 줍니다:

![책에서 로마 숫자와 아라비아 숫자 페이지 번호를 보여 주기](/files/faa117771bed27dbf0aca48a402f715ae65eecc6)

페이지 번호 매기기를 제어하는 명령은 다음과 같습니다:

* `\frontmatter`: 이 명령 이후부터 명령 `\mainmatter`사이의 페이지에는 소문자 로마 숫자가 매겨집니다.
* `\mainmatter`: 페이지 카운터를 다시 시작하고 스타일을 아라비아 숫자로 변경합니다.

## Article 클래스: 두 가지 페이지 번호 스타일 사용

위에서 언급했듯이 현재 페이지 번호는 [LaTeX 카운터 변수](/latex/ko/formatting/10-counters.md#introduction-to-latex-counters) 에 저장되며, 그 이름은 `page`입니다. 다음을 사용하면 `page`에 저장된 값이나 다른 카운터 변수의 값을 특정 값으로 설정할 수 있습니다 `\setcounter` 명령:

```latex
\setcounter{⟨countvar⟩}{⟨intval⟩}
```

여기서 카운터 변수 `⟨countvar⟩` 의 값은 `⟨intval⟩`로 설정됩니다. 예를 들어 `page` 카운터를 `3` 로 설정하려면

```latex
\setcounter{page}{3}
```

카운터 변수를 변경하는 다른 명령에는 `\addtocounter` 및 `\stepcounter`:

```latex
\addtocounter{⟨countvar⟩}{⟨increment⟩}
\stepcounter{⟨countvar⟩}
```

* `\addtocounter{⟨countvar⟩}{⟨increment⟩}` 는 값 `⟨increment⟩` 를 카운터 변수에 더합니다 `⟨countvar⟩`. **참고**: `⟨increment⟩` 카운터 값을 증가시키기 위해 양수일 수도 있고, 줄이기 위해 음수일 수도 있습니다.
* `\steptocounter{⟨countvar⟩}` 는 카운터 변수에 1을 더합니다 `⟨countvar⟩`

이 가상의 예제는 아직 작성되지 않았고 페이지 수가 추정된 섹션을 포함하여 목차를 계획하기 위해 페이지 카운터를 수정합니다. 또한 `\pagenumbering{roman}` 및 `\pagenumbering{Arabic}` 를 사용해 페이지 번호의 스타일을 설정합니다.

```latex
\documentclass{article}
\pagenumbering{roman}
\begin{document}

\section*{게스트 서문(TBD)}
\addcontentsline{toc}{section}{서문: 4페이지(TBD)}
작성 예정: 4페이지 허용.
\newpage
\setcounter{page}{5}

\section*{서론(2페이지)}
\addcontentsline{toc}{section}{서론: 2페이지(TBD)}
작성 예정: 2페이지 허용.
\newpage
\addtocounter{page}{1}

\section*{전략 요약(2페이지)}
\addcontentsline{toc}{section}{전략 요약: 2페이지(TBD)}
작성 예정: 2페이지.
\newpage
\stepcounter{page}

\tableofcontents

\newpage
\pagenumbering{arabic}

\section{레벨 1 제목}
이 페이지의 일부 텍스트입니다.
\newpage
\section{또 다른 레벨 1 제목}
\end{document}
```

[이 예제를 Overleaf에서 열어 보세요.](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Mixing+page+number+formats+in+the+article+class\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cpagenumbering%7Broman%7D%0A%5Cbegin%7Bdocument%7D%0A%0A%5Csection%2A%7BGuest+Foreword+%28TBD%29%7D%0A%5Caddcontentsline%7Btoc%7D%7Bsection%7D%7BForeword%3A+4+pages+%28TBD%29%7D%0ATo+be+written%3A+Allowing+4+pages.%0A%5Cnewpage+%0A%5Csetcounter%7Bpage%7D%7B5%7D%0A%0A%5Csection%2A%7BIntroduction+%282+pages%29%7D%0A%5Caddcontentsline%7Btoc%7D%7Bsection%7D%7BIntroduction%3A+2+pages+%28TBD%29%7D%0ATo+be+written%3A+2+pages+allowed.%0A%5Cnewpage%0A%5Caddtocounter%7Bpage%7D%7B1%7D%0A%0A%5Csection%2A%7BStrategy+summary+%282+pages%29%7D%0A%5Caddcontentsline%7Btoc%7D%7Bsection%7D%7BStrategy+summary%3A+2+pages+%28TBD%29%7D%0ATo+be+written%3A+2+pages.%0A%5Cnewpage%0A%5Cstepcounter%7Bpage%7D%0A%0A%5Ctableofcontents%0A%0A%5Cnewpage%0A%5Cpagenumbering%7Barabic%7D%0A%0A%5Csection%7BLevel+1+heading%7D%0ASome+text+on+this+page.%0A%5Cnewpage%0A%5Csection%7BAnother+Level+1+heading%7D%0A%5Cend%7Bdocument%7D)

이 예제는 다음 목차를 생성하며, `page` 카운터 값 변경 결과를 보여 줍니다:

![LaTeX에서 페이지 카운터 변경](/files/c016093a8eec6bd6acb33f1ca81cbe9189d63294)

## fancyhdr 패키지를 사용한 페이지 번호 사용자 지정

이 `fancyhdr` 패키지는 페이지 번호의 위치와 형식을 사용자 지정하는 데 사용할 수 있습니다. 예를 들어 머리말이나 꼬리말의 특정 위치에 배치할 수 있습니다. Overleaf 문서 [머리말과 꼬리말](/latex/ko/formatting/02-headers-and-footers.md) 에서는 이를 다양한 예제와 함께 자세히 설명하며, 여기서는 이를 재현하지 않습니다.

여기서는 전체 페이지 수에 대한 맥락에서 현재 페이지 번호를 쓰는 한 가지 예를 보여 주겠습니다. 예를 들면 `Page X of Y` 여기서 Y는 [`lastpage` 패키지](https://ctan.org/pkg/lastpage?lang=en).

```latex
\documentclass{article}
% 너무 많은 텍스트가 필요하지 않도록 작은 페이지 크기를 사용
% 여러 페이지를 만들기 위해
% 필요하지 않도록
\usepackage[includefoot,
paperheight=10cm,
paperwidth=10cm,
textwidth=9cm,
textheight=8cm]{geometry}
\usepackage{blindtext}
\usepackage{lastpage}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{} % 기존 머리말/꼬리말 항목 지우기
% Page X of Y를 오른쪽
% 꼬리말 쪽에 배치
\fancyfoot[R]{Page \thepage \hspace{1pt} of \pageref{LastPage}}
\begin{document}
% 목차 삽입
\tableofcontents
\newpage
\section{하나}
\blindtext[1]
\newpage
\section{둘}
\blindtext[1]
\newpage
\section{셋}
\blindtext[1]
\newpage
\section{넷}
\blindtext[1]
\newpage
\section{다섯}
\blindtext[1]
\end{document}
```

[이 예제를 Overleaf에서 열어 보세요.](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Modifying+page+numbers+with+fancyhdr\&snip=%5Cdocumentclass%7Barticle%7D%0A%25+Use+a+small+page+size+to+avoid+%0A%25+needing+lots+of+text+to+create+%0A%25+several+pages%0A%5Cusepackage%5Bincludefoot%2C%0Apaperheight%3D10cm%2C%0Apaperwidth%3D10cm%2C%0Atextwidth%3D9cm%2C%0Atextheight%3D8cm%5D%7Bgeometry%7D%0A%5Cusepackage%7Bblindtext%7D%0A%5Cusepackage%7Blastpage%7D%0A%5Cusepackage%7Bfancyhdr%7D%0A%5Cpagestyle%7Bfancy%7D%0A%5Cfancyhf%7B%7D+%25+clear+existing+header%2Ffooter+entries%0A%25+Place+Page+X+of+Y+on+the+right-hand%0A%25+side+of+the+footer%0A%5Cfancyfoot%5BR%5D%7BPage+%5Cthepage+%5Chspace%7B1pt%7D+of+%5Cpageref%7BLastPage%7D%7D%0A%5Cbegin%7Bdocument%7D%0A%25+Insert+a+table+of+contents%0A%5Ctableofcontents%0A%5Cnewpage%0A%5Csection%7BOne%7D%0A%5Cblindtext%5B1%5D%0A%5Cnewpage%0A%5Csection%7BTwo%7D%0A%5Cblindtext%5B1%5D%0A%5Cnewpage%0A%5Csection%7BThree%7D%0A%5Cblindtext%5B1%5D%0A%5Cnewpage%0A%5Csection%7BFour%7D%0A%5Cblindtext%5B1%5D%0A%5Cnewpage%0A%5Csection%7BFive%7D%0A%5Cblindtext%5B1%5D%0A%5Cend%7Bdocument%7D)

다음 이미지는 이 예제로 생성된 페이지 중 하나를 보여 줍니다— `Page 3 of 6` 오른쪽 꼬리말 쪽에:

![fancyhdr로 페이지 번호 변경](/files/10b1aef278b86215f0fdc71d88c9000387e4ab76)


---

# 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/formatting/03-page-numbering.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.
