> 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/10-counters.md).

# 카운터

## LaTeX 카운터 소개

LaTeX 기반 조판은 특수한 형태의 프로그래밍입니다: 조판 언어(LaTeX 명령)를 사용해 “지시”를 제공하고, 그 결과물은 PDF 파일 형태의 컴파일된 LaTeX 문서입니다. 다른 모든 프로그래밍과 마찬가지로, 문서(코드)에서 나중에 다시 사용하기 위해 정수 값을 일시적으로 저장하도록 LaTeX가 필요할 가능성이 큽니다—다음과 같은 용도로 사용하고 싶을 수 있습니다:

* 문서에 저장된 그 정수들을 조판하기
* 문서의 특정 요소에 자동 번호를 매기기
* 조건부 코드(또는 반복문)를 제어하는 변수로 사용하기
* 고정된 값을 더하거나 빼서 값을 변경 및 갱신하기
* 완전히 다른 값으로 초기화하기

이러한 정수 처리 작업은 JavaScript, C, Lua 등과 같은 “일반적인” 프로그래밍 언어에서 매우 흔합니다. 보통은 변수(정수를 담기 위한 이름)를 선언(생성)한 다음 그 변수에 값을 할당합니다. LaTeX 조판 언어도 이와 비슷한 기능을 제공하지만, 구현 방식은 상당히 다르며, 아래에서 살펴보겠습니다.

본질적으로 LaTeX 카운터는 위에서 나열한 작업과 그 밖의 많은 용도에 사용할 수 있는 정수 값을 저장하는 “LaTeX 변수”의 이름입니다. LaTeX 자체는 페이지, 절, 표, 그림, 글머리/번호 목록 등의 번호 매기기를 제공하는 수많은 내부 카운터를 사용합니다. 이 글에서는 이러한 카운터에 접근하고 수정하는 방법, 그리고 새 카운터를 만들고 사용하는 방법을 설명합니다.

## 카운터 작업을 위한 LaTeX 명령

다음은 이후 섹션의 설명과 연결된 LaTeX의 카운터 명령 목록입니다.

카운터 생성 및 증가:

* [`\\newcounter{somecounter}[anothercounter]`](#newcountersomecounteranothercounter)
* [`\\setcounter{somecounter}{number}`](#setcountersomecounternumber)
* [`\\addtocounter{somecounter}{number}`](#addtocountersomecounternumber)
* [`\\stepcounter{somecounter}`](#stepcountersomecounter)
* [`\\refstepcounter{somecounter}`](#refstepcountersomecounter)

카운터 값에 접근하고 출력하기:

* [`\\arabic{somecounter}`](#arabicsomecounter)
* [`\\roman{somecounter}`](#romansomecounter)
* [`\\Roman{somecounter}`](#romanoutput)
* [`\\alph{somecounter}`](#alphsomecounter)
* [`\\Alph{somecounter}`](#alphoutput)
* [`\\fnsymbol{somecounter}`](#fnsymbolsomecounter)
* [`\\value{somecounter}`](#valuesomecounter)

기타 카운터 명령:

* [`\\counterwithin{somecounter}{anothercounter}`](#counterwithinsomecounteranothercounter)
* [`\\counterwithout{somecounter}{anothercounter}`](#counterwithoutsomecounteranothercounter)

### 카운터 생성 및 증가

#### \\\newcounter{somecounter}\[anothercounter]

새 카운터를 정의하는 데 사용됩니다. 괄호로 묶인 두 번째 인수는 `[]`선택 사항이지만 사용하면 `*somecounter*` 을 새로운 카운터로 정의하며, 다음이 `*anothercounter*` 가 증가될 때 초기화됩니다. `\\newcounter` 는 더 단순한 형태로 자주 사용됩니다 `\\newcounter{*somecounter*}` 를 생성하고 `*somecounter*` 0이 들어가도록 초기화합니다.

* **참고**\\\newcounter 명령에 의해 생성된 각 카운터에 대해, `\\newcounter` 명령은 *또한* 카운터의 값을 조판하는 데 사용할 수 있는 명령을 정의합니다. 예를 들면, `\\newcounter{*mycounter*}` 이라는 명령을 정의합니다 `\\the*mycounter*`. 다음은 제공된 링크를 사용해 완성된 문서로 Overleaf에서 열어 볼 수 있는 다음 LaTeX 코드 조각에 보이는 예입니다:

```latex
\\newcounter{mycounter}
\\setcounter{mycounter}{42}
이제 \\verb|\\themycounter|를 작성하면 \\themycounter를 얻을 수 있습니다.
```

[이 LaTeX 코드 조각을 Overleaf에서 열기](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Using+newcounter\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cnewcounter%7Bmycounter%7D%0A%5Csetcounter%7Bmycounter%7D%7B42%7D%0AYou+can+now+write+%5Cverb%7C%5Cthemycounter%7C+to+obtain+%5Cthemycounter.%0A%5Cend%7Bdocument%7D)

이 예제는 다음을 생성합니다 $$\text{You can now write }\verb|\themycounter|\text{ to obtain 42.}$$

* **참고**: 만약 `*mycounter*` 가 이미 정의되어 있다면 LaTeX는 다음 오류를 표시합니다 `c@mycounter already defined`라고 하며, 이는 Overleaf에서 열어 볼 수 있는 다음 예제가 보여 줍니다.

```latex
\\newcounter{mycounter}
...코드는 아주 많지만, 깜빡하고 다시 \\verb|\\newcounter{mycounter}|를 작성합니다
\\newcounter{mycounter}
```

[이 예제를 ***오류를 발생시키는 코드*** Overleaf에서](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Using+newcounter\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cnewcounter%7Bmycounter%7D%0A...lots+of+code...+but+we+forget+and+write+%5Cverb%7C%5Cnewcounter%7Bmycounter%7D%7C+again%0A%5Cnewcounter%7Bmycounter%7D%0A%5Cend%7Bdocument%7D)

#### \\\setcounter{somecounter}{number}

설정합니다 `*somecounter*` 값이 들어가도록 `*숫자*`.

* **참고**: `*숫자*` 는 양수일 수도 음수일 수도 있습니다.

다음은 제공된 링크를 사용해 완성된 문서로 Overleaf에서 열어 볼 수 있는 다음 LaTeX 코드 조각에 보이는 예입니다:

```latex
\\noindent 새로운 카운터 \\texttt{myvar}를 만들고 그 값으로 \\texttt{42}를 할당합니다.
\vspace{10pt}

\\newcounter{myvar}
\\setcounter{myvar}{42}

\\noindent \\verb|\\themymar|를 작성하면 \\texttt{\\themyvar}가 조판됩니다.
\vspace{10pt}

\\noindent 다음으로, \\texttt{myvar}를 \\texttt{-42}로 바꾸기 위해 \\verb|\\setcounter{myvar}{-42}|를 작성합니다
\\setcounter{myvar}{-42}. 이제 \\verb|\\themyvar|를 작성하면 \\texttt{\\themyvar}가 출력됩니다.
```

[이 LaTeX 코드 조각을 Overleaf에서 열기](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Using+newcounter\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cnoindent+Create+a+new+counter+%5Ctexttt%7Bmyvar%7D+and+assign+it+the+value+%5Ctexttt%7B42%7D.%0A%5Cvspace%7B10pt%7D%0A%0A%5Cnewcounter%7Bmyvar%7D%0A%5Csetcounter%7Bmyvar%7D%7B42%7D+%0A%0A%5Cnoindent+Writing+%5Cverb%7C%5Cthemymar%7C+typesets+%5Ctexttt%7B%5Cthemyvar%7D.%0A%5Cvspace%7B10pt%7D%0A%0A%5Cnoindent+Next%2C+we%27ll+change+%5Ctexttt%7Bmyvar%7D+to+%5Ctexttt%7B-42%7D%2C+writing+%5Cverb%7C%5Csetcounter%7Bmyvar%7D%7B-42%7D%7C%0A%5Csetcounter%7Bmyvar%7D%7B-42%7D.+Now%2C+writing+%5Cverb%7C%5Cthemyvar%7C+outputs+%5Ctexttt%7B%5Cthemyvar%7D.%0A%5Cend%7Bdocument%7D)

#### \\\addtocounter{somecounter}{number}

카운터를 1 증가시킵니다 `*somecounter*` 만큼 `*숫자*`.

* **참고**: `*숫자*` 는 카운터 값을 늘리기 위해서는 양수일 수 있고, 줄이기 위해서는 음수일 수 있습니다. 예를 들면:

```latex
\\addtocounter{somecounter}{-1} % somecounter를 1만큼 감소시킵니다
```

다음은 제공된 링크를 사용해 완성된 문서로 Overleaf에서 열어 볼 수 있는 다음 LaTeX 코드 조각에 보이는 예입니다:

```latex
\\noindent 새로운 카운터 \\texttt{myvar}를 만들고 그 값으로 \\texttt{42}를 할당합니다.
\vspace{10pt}

\\newcounter{myvar}
\\setcounter{myvar}{42}

\\noindent \\verb|\\themymar|를 작성하면 \\texttt{\\themyvar}가 조판됩니다.
\vspace{10pt}

\\noindent 다음으로, \\texttt{myvar}를 \\texttt{142}로 바꾸기 위해 \\verb|\\addtocounter{myvar}{100}|\\addtocounter{myvar}{100}를 작성합니다. 이제 \\verb|\\themyvar|를 작성하면 \\texttt{\\themyvar}가 출력됩니다.
```

[이 LaTeX 코드 조각을 Overleaf에서 열기](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Using+addtocounter\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cnoindent+Create+a+new+counter+%5Ctexttt%7Bmyvar%7D+and+assign+it+the+value+%5Ctexttt%7B42%7D.%0A%5Cvspace%7B10pt%7D%0A%0A%5Cnewcounter%7Bmyvar%7D%0A%5Csetcounter%7Bmyvar%7D%7B42%7D+%0A%0A%5Cnoindent+Writing+%5Cverb%7C%5Cthemymar%7C+typesets+%5Ctexttt%7B%5Cthemyvar%7D.%0A%5Cvspace%7B10pt%7D%0A%0A%5Cnoindent+Next%2C+we%E2%80%99ll+change+%5Ctexttt%7Bmyvar%7D+to+%5Ctexttt%7B142%7D+by+writing+%5Cverb%7C%5Caddtocounter%7Bmyvar%7D%7B100%7D%7C%5Caddtocounter%7Bmyvar%7D%7B100%7D.+Now%2C+writing+%5Cverb%7C%5Cthemyvar%7C+outputs+%5Ctexttt%7B%5Cthemyvar%7D.%0A%5Cend%7Bdocument%7D)

#### \\\stepcounter{somecounter}

증가시킵니다 `*somecounter*` 을 1만큼. 다음은 제공된 링크를 사용해 완성된 문서로 Overleaf에서 열어 볼 수 있는 LaTeX 코드 조각의 예입니다:

```latex
만약 \\verb|\\newcounter{mycounter}|를 작성하여 새 카운터를 만들면
\\newcounter{mycounter}를 쓰면 카운터 \\texttt{mycounter}가 생성되고
\\verb|\\themycounter|를 작성하면 0으로 초기화된 것을 볼 수 있습니다:
\\texttt{mycounter}가 현재 저장하는 값: \\themycounter.

이제 \\verb|\\stepcounter{mycounter}|\\stepcounter{mycounter}를 작성하면
\\verb|\\themycounter|에는 이제 값 \\themycounter가 들어 있습니다.
```

[이 LaTeX 코드 조각을 Overleaf에서 열기](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Using+stepcounter\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0AIf+we+create+a+new+counter+by+writing+%5Cverb%7C%5Cnewcounter%7Bmycounter%7D%7C%0A%5Cnewcounter%7Bmycounter%7D+then+the+counter+%5Ctexttt%7Bmycounter%7D+is+created+and+%0Ainitialized+to+zero%2C+as+you+can+see+if+you+write+%5Cverb%7C%5Cthemycounter%7C%3A%0A%5Ctexttt%7Bmycounter%7D+currently+stores%3A+%5Cthemycounter.+%0A%0AIf+we+now+write+%5Cverb%7C%5Cstepcounter%7Bmycounter%7D%7C%5Cstepcounter%7Bmycounter%7D+then+%0A%5Cverb%7C%5Cthemycounter%7C+now+contains+the+value+%5Cthemycounter.%0A%5Cend%7Bdocument%7D)

#### \\\refstepcounter{somecounter}

증가시킵니다 `*somecounter*` 을 1만큼 늘리고 참조 메커니즘에서 보이게 하며, 또한 값도 설정하므로 `\label` 그다음에 사용할 수 있습니다.

**\\\refstepcounter를 사용하는 예**

다음 예제는 다음을 사용합니다 `\\refstepcounter` 를 사용해 하나의 `예제` 환경을 위한 새 카운터를 만들고 `\label` 및 `\ref` 를 사용해 참조를 보여 줍니다 `예제` 카운터 변수입니다.

```latex
\documentclass{article}

\\newcounter{example}[section]
\\newenvironment{example}[1][]{\\refstepcounter{example}\\par\\medskip
   \\noindent\\textbf{Example~\\theexample. #1} \\rmfamily}{\\medskip}

\begin{document}
\\section{Three examples}
\\begin{example}
첫 번째 예제에서 레이블 \\verb|\\label{ex:1}|\\label{ex:1}을 만듭니다. 이것이 첫 번째 예제입니다. \\texttt{example} 카운터는 각 새 \\verb|\\section|의 시작에서 초기화됩니다.
\\end{example}

\\begin{example}
그리고 여기에 또 다른 번호가 매겨진 예제가 있습니다. 나중에 이것을 참조하기 위해 두 번째 \\verb|\\label{ex:2}|\\label{ex:2}를 만드세요. 예제 \\ref{ex:1}에서는... 무언가를 읽습니다.
\\end{example}

\\begin{example}
그리고 여기에 또 다른 번호가 매겨진 예제가 있습니다: \\verb|\\theexample|를 사용해 \\texttt{example} 카운터에 현재 할당된 번호를 조판하면 됩니다: 그것은 \\theexample입니다.
\\end{example}

\section{또 다른 절}
방금 새 절을 시작했으므로 \\texttt{example} 카운터는 \\theexample로 설정되었습니다.
이전 절의 예제들(예제 \\ref{ex:1} 및 \\ref{ex:2})을 참조하겠습니다. 이것은 텍스트를 담는 것 외에는 아무 목적도 없는 더미 절입니다. 이 절의 \\texttt{section} 카운터는 \\verb|\\thesection|를 사용해 조판할 수 있으며: 현재 \\thesection의 값이 할당되어 있습니다.

\\begin{example}
이 절의 첫 번째 예제입니다: \\texttt{example} 카운터가 한 단계 증가되어 이제 \\theexample로 설정되었습니다.
\\end{example}
\end{document}
```

[이 예제를 `\\refstepcounter` Overleaf의 예](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=An+example+using+refstepcounter\&snip=%5Cdocumentclass%7Barticle%7D%0A%0A%5Cnewcounter%7Bexample%7D%5Bsection%5D%0A%5Cnewenvironment%7Bexample%7D%5B1%5D%5B%5D%7B%5Crefstepcounter%7Bexample%7D%5Cpar%5Cmedskip%0A+++%5Cnoindent%5Ctextbf%7BExample%7E%5Ctheexample.+%231%7D+%5Crmfamily%7D%7B%5Cmedskip%7D%0A%0A%5Cbegin%7Bdocument%7D%0A%5Csection%7BThree+examples%7D%0A%5Cbegin%7Bexample%7D%0ACreate+a+label+in+this+first+example+%5Cverb%7C%5Clabel%7Bex%3A1%7D%7C%5Clabel%7Bex%3A1%7D.+This+is+the+first+example.+The+%5Ctexttt%7Bexample%7D+counter+will+be+reset+at+the+start+of+each+new+each+document+%5Cverb%7C%5Csection%7C.%0A%5Cend%7Bexample%7D%0A%0A%5Cbegin%7Bexample%7D%0AAnd+here%27s+another+numbered+example.+Create+a+second+%5Cverb%7C%5Clabel%7Bex%3A2%7D%7C%5Clabel%7Bex%3A2%7D+to+later+reference+this+one.+In+Example+%5Cref%7Bex%3A1%7D+we+read...+something.+%0A%5Cend%7Bexample%7D%0A%0A%5Cbegin%7Bexample%7D%0AAnd+here%27s+another+numbered+example%3A+use+%5Cverb%7C%5Ctheexample%7C+to+typeset+the+number+currently+assigned+to+the+%5Ctexttt%7Bexample%7D+counter%3A+it+is++%5Ctheexample.%0A%5Cend%7Bexample%7D%0A%0A%5Csection%7BAnother+section%7D%0AWe%27ve+just+started+a+new+section+meaning+that+the++%5Ctexttt%7Bexample%7D+counter+has+been+set+to+%5Ctheexample.++%0AWe%27ll+reference+examples+from+the+previous+section+%28Examples+%5Cref%7Bex%3A1%7D+and+%5Cref%7Bex%3A2%7D%29.++This+is+a+dummy+section+with+no+purpose+whatsoever+but+to+contain+text.+The+%5Ctexttt%7Bsection%7D+counter+for+this+section+can+be+typeset+using+%5Cverb%7C%5Cthesection%7C%3A+it+is++currently+assigned+the+value+of+%5Cthesection.%0A%0A%5Cbegin%7Bexample%7D%0AThis+is+the+first+example+in+this+section%3A+the+%5Ctexttt%7Bexample%7D+counter+has+been+stepped+and+now+set+to+%5Ctheexample.+%0A%5Cend%7Bexample%7D%0A%5Cend%7Bdocument%7D)

**코드 요약**

이 예제에서는 새 환경 `예제` 이 정의되며, 이 환경에는 카운팅 전용 명령이 3개 있습니다:

* `\\newcounter{example}[section]`: 새 카운터를 생성합니다. 이름은 `예제` 이며, 다음이 증가할 때마다 0으로 초기화됩니다 `section` 카운터. 대신 `section` 를 넣거나, 카운터를 자동으로 초기화하고 싶지 않다면 매개변수를 생략할 수 있습니다.
* `\\refstepcounter{example}`: 카운터를 `예제` 1만큼 증가시키고 참조 메커니즘에서 보이게 하므로 `\label` 그다음에 사용할 수 있습니다.
* `\\theexample`: 카운터의 현재 값을 출력합니다 `예제`.

사용자 정의 환경에 대한 자세한 정보는 [새 환경을 정의하는 글](/latex/ko/commands/02-environments.md#defining-a-new-environment)

### 카운터 값에 접근하고 출력하기

다음 논의는 사용자가 불러온 패키지에 의해 적용된 맞춤 설정이 이루어지기 전의 LaTeX 기본값을 바탕으로 합니다.

#### \\\arabic{somecounter}

의 표현을 출력합니다 `*somecounter*` 아라비아 숫자로: 1, 2, 3...

#### \\\roman{somecounter}

의 표현을 출력합니다 `*somecounter*` 소문자 로마 숫자로: i, ii, iii...

* **참고**: 만약 `*somecounter*` $$\leq$$ `0` 출력은 생성되지 않습니다. 또한, *매우* 큰 정수 값을 소문자 로마 숫자로 변환하는 데는 완료까지 오랜 시간이 걸릴 수 있으며, 길게 이어진 `m` 문자열이 생성됩니다(숫자 `1000`).
* **팁**: TeX가 아라비아 숫자를 로마 숫자로 변환하는 데 사용하는 알고리즘에 관심이 있다면 [로마 숫자 알고리즘](https://www.hanshq.net/roman-numerals.html#tex).

#### \\\Roman{somecounter}

의 표현을 출력합니다 `*somecounter*` 대문자 로마 숫자로: I, II, III...

* **참고**: 만약 `*somecounter*` $$\leq$$ `0` 출력은 생성되지 않습니다. 또한, *매우* 큰 정수 값을 대문자 로마 숫자로 변환하는 데는 완료까지 오랜 시간이 걸릴 수 있으며, 길게 이어진 `M` 문자열이 생성됩니다(숫자 `1000`).
* **팁**: TeX가 아라비아 숫자를 로마 숫자로 변환하는 데 사용하는 알고리즘에 관심이 있다면 [로마 숫자 알고리즘](https://www.hanshq.net/roman-numerals.html#tex).

#### \\\alph{somecounter}

의 표현을 출력합니다 `*somecounter*` 소문자 글자로: a=1, b=2, c=3...

* **참고**: `*somecounter*` 의 범위에 있어야 합니다 `1` $$\leq$$ `*somecounter*` $$\leq$$ `26`, 그렇지 않으면 다음 오류가 발생합니다 `! LaTeX 오류: 카운터가 너무 큽니다.`

#### \\\Alph{somecounter}

의 표현을 출력합니다 `*somecounter*` 대문자 글자로: A=1, B=2, C=3...

* **참고**: `*somecounter*` 의 범위에 있어야 합니다 `1` $$\leq$$ `*somecounter*` $$\leq$$ `26`, 그렇지 않으면 다음 오류가 발생합니다 `! LaTeX 오류: 카운터가 너무 큽니다.`

#### \\\fnsymbol{somecounter}

의 표현을 출력합니다 `*somecounter*` 각주 기호로: 1 =∗, 2 =†...

* **참고**: `*somecounter*` 의 범위에 있어야 합니다 `1` $$\leq$$ `*somecounter*` $$\leq$$ `9`, 그렇지 않으면 다음 오류가 발생합니다 `! LaTeX 오류: 카운터가 너무 큽니다.`

|                     |                             |
| ------------------- | --------------------------- |
| 의 값 `*somecounter*` | 다음 명령이 조판하는 문자 `\\fnsymbol` |
| 1                   | \*                          |
| 2                   | †                           |
| 3                   | ‡                           |
| 4                   | §                           |
| 5                   | ¶                           |
| 6                   | ∥                           |
| 7                   | ∗∗                          |
| 8                   | ††                          |
| 9                   | ‡‡                          |

#### 카운터 값 출력 예

다음 예는 다음 명령들의 사용을 보여 줍니다 `\\arabic{*somecounter*}`, `\\roman{*somecounter*}`, `\\Roman{*somecounter*}`, `\\alph{*somecounter*}`, `\\Alph{*somecounter*}`, 그리고 `\\fnsymbol{*somecounter*}`.

```latex
\\newcounter{somecounter}
\\setcounter{somecounter}{9}
\begin{itemize}
    \\item \\verb|\\arabic{somecounter}|는 \\texttt{somecounter}의 값인 \\thesomecounter{}를 \\arabic{somecounter}로 조판합니다
    \\item \\verb|\\roman{somecounter}|는 \\texttt{somecounter}의 값인 \\thesomecounter{}를 \\roman{somecounter}로 조판합니다
    \\item \\verb|\\Roman{somecounter}|는 \\texttt{somecounter}의 값인 \\thesomecounter{}를 \\Roman{somecounter}로 조판합니다
    \\item \\verb|\\alph{somecounter}|는 \\texttt{somecounter}의 값인 \\thesomecounter{}를 \\alph{somecounter}로 조판합니다
   \\item \\verb|\\Alph{somecounter}|는 \\texttt{somecounter}의 값인 \\thesomecounter{}를 \\Alph{somecounter}로 조판합니다
    \\item \\verb|\\fnsymbol{somecounter}|는 \\texttt{somecounter}의 값인 \\thesomecounter{}를 \\fnsymbol{somecounter}로 조판합니다
\end{itemize}
```

[이 LaTeX 코드 조각을 Overleaf에서 열기](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Converting+counter+values\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cnewcounter%7Bsomecounter%7D%0A%5Csetcounter%7Bsomecounter%7D%7B9%7D%0A%5Cbegin%7Bitemize%7D%0A++++%5Citem+%5Cverb%7C%5Carabic%7Bsomecounter%7D%7C+typesets+the+%5Ctexttt%7Bsomecounter%7D+value+of++%5Cthesomecounter%7B%7D+as+%5Carabic%7Bsomecounter%7D+%0A++++%5Citem+%5Cverb%7C%5Croman%7Bsomecounter%7D%7C+typesets+the+%5Ctexttt%7Bsomecounter%7D+value+of++%5Cthesomecounter%7B%7D+as++%5Croman%7Bsomecounter%7D%0A++++%5Citem+%5Cverb%7C%5CRoman%7Bsomecounter%7D%7C+typesets+the+%5Ctexttt%7Bsomecounter%7D+value+of++%5Cthesomecounter%7B%7D+as++%5CRoman%7Bsomecounter%7D%0A++++%5Citem+%5Cverb%7C%5Calph%7Bsomecounter%7D%7C+typesets+the+%5Ctexttt%7Bsomecounter%7D+value+of++%5Cthesomecounter%7B%7D+as++%5Calph%7Bsomecounter%7D%0A+++%5Citem+%5Cverb%7C%5CAlph%7Bsomecounter%7D%7C+typesets+the+%5Ctexttt%7Bsomecounter%7D+value+of++%5Cthesomecounter%7B%7D+as++%5CAlph%7Bsomecounter%7D%0A++++%5Citem+%5Cverb%7C%5Cfnsymbol%7Bsomecounter%7D%7C+typesets+the+%5Ctexttt%7Bsomecounter%7D+value+of++%5Cthesomecounter%7B%7D+as++%5Cfnsymbol%7Bsomecounter%7D%0A%5Cend%7Bitemize%7D%0A%5Cend%7Bdocument%7D)

이 예제는 다음 출력을 생성합니다:

![LaTeX에서 카운터를 변환하는 예](/files/a61fbdaf2b23973f1896ccfed1567a6c94ded13a)

#### \\\value{somecounter}

LaTeX 소스 코드에 설명되어 있듯이, 이 명령의 목적은 “카운터 값을 TeX 숫자로 접근하기 위한 것”입니다: 즉, 숫자 값을 처리하길 LaTeX가 기대하는 상황에서 \\\value를 사용합니다. `\\value{somecounter}` LaTeX가 숫자 값을 처리하길 기대하는 상황에서 사용합니다.

**(선택 사항) \\\value 명령에 대한 배경 설명**

명령 `\\value{*somecounter*}` 는 *직접* 가 `*somecounter*`의 값을 조판한다고 생각하기 쉽지만, 그렇지 않습니다. 이 명령은 `\\thesomecounter` 의 출력된 표현을 생성하는 명령과 달리, TeX 숫자로 카운터의 값에 접근하기 위해 다른 명령 안에서 사용되도록 의도되었습니다. `*somecounter*`.

LaTeX 소스 코드에서, `\\value` 는 다음과 같이 정의됩니다:

```latex
\\def\\value#1{\\csname c@#1\\endcsname}
```

따라서, `\\value{*somecounter*}` LaTeX 내부 제어 시퀀스 `\\c@somecounter` 의 인스턴스를 생성하며, 이는 카운터의 값을 담고 있습니다 `*somecounter*`.

**예제**

다음 예는 \\\value의 기본 사용 사례 하나를 보여 줍니다 `\\value`.

```latex
먼저 두 개의 새 카운터를 선언합니다:
\begin{verbatim}
\\newcounter{first}
\\newcounter{second}
\end{verbatim}

\\newcounter{first}
\\newcounter{second}

잠시 뒤 코드에서 그 값들을 설정합니다:
\begin{verbatim}
\\setcounter{first}{100}
\\setcounter{second}{50}
\end{verbatim}

\\setcounter{first}{100}
\\setcounter{second}{50}
그런 다음 더 많은 \\LaTeX{} 코드를 작성합니다...\\vspace{10pt}

어느 시점에는 \\texttt{first} 카운터에 \\texttt{second} 카운터의 값을 더하고 싶을 수 있습니다. 이를 수행하는 한 가지 방법은 \\verb|\\value|를 사용해 \\texttt{second} 카운터에 저장된 \\textit{현재} 값을 얻는 것입니다:

\begin{verbatim}
\\addtocounter{first}{\\value{second}}
\end{verbatim}

\\addtocounter{first}{\\value{second}}\\noindent \\texttt{first}의 값은 \\verb|\\thefirst|로 출력할 수 있습니다: \\thefirst. 또한 \\verb|\\the\\value{first}|를 작성하면 \\the\\value{first}도 조판됩니다. 그러나 \\verb|\\value{first}|를 작성하면 \\texttt{Missing number, treated as zero} 오류가 발생하는데, 이는 LaTeX가 그때 내부 명령 \\verb|\\c@first|를 실행하려고 하기 때문입니다. 다음 줄의 주석을 해제하여 오류를 생성해 보세요:
\begin{verbatim}
%\\value{first}
\end{verbatim}
%\\value{first}
```

[이 코드 조각을 Overleaf에서 열기](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Using+the+value+command\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cnoindent+Start+by+declaring+two+new+counters%3A%0A%5Cbegin%7Bverbatim%7D%0A%5Cnewcounter%7Bfirst%7D%0A%5Cnewcounter%7Bsecond%7D++++%0A%5Cend%7Bverbatim%7D%0A%0A%5Cnewcounter%7Bfirst%7D%0A%5Cnewcounter%7Bsecond%7D%0A%0A%5Cnoindent+Sometime+later+in+your+code+you+set+their+values%3A%0A%5Cbegin%7Bverbatim%7D%0A%5Csetcounter%7Bfirst%7D%7B100%7D%0A%5Csetcounter%7Bsecond%7D%7B50%7D++++%0A%5Cend%7Bverbatim%7D%0A%0A%5Csetcounter%7Bfirst%7D%7B100%7D%0A%5Csetcounter%7Bsecond%7D%7B50%7D++%0A%5Cnoindent+Then+you+write+more+%5CLaTeX%7B%7D+code...%5Cvspace%7B10pt%7D%0A%0A%5Cnoindent+At+some+point+we+might+want+to+add+the+value+of+counter+%5Ctexttt%7Bsecond%7D+to+counter+%5Ctexttt%7Bfirst%7D.+One+way+to+do+that+is+using+%5Cverb%7C%5Cvalue%7C+to+obtain+the+%5Ctextit%7Bcurrent%7D+value+stored+in+the+%5Ctexttt%7Bsecond%7D+counter%3A%0A%0A%5Cbegin%7Bverbatim%7D%0A%5Caddtocounter%7Bfirst%7D%7B%5Cvalue%7Bsecond%7D%7D%0A%5Cend%7Bverbatim%7D%0A%0A%5Caddtocounter%7Bfirst%7D%7B%5Cvalue%7Bsecond%7D%7D%5Cnoindent+The+value+of+%5Ctexttt%7Bfirst%7D+can+be+output+by+%5Cverb%7C%5Cthefirst%7C%3A+%5Cthefirst.+We+can+also+write+%5Cverb%7C%5Cthe%5Cvalue%7Bfirst%7D%7C+which+also+typesets+%5Cthe%5Cvalue%7Bfirst%7D.+However%2C++writing+%5Cverb%7C%5Cvalue%7Bfirst%7D%7C+will+generate+the+error+%5Ctexttt%7BMissing+number%2C+treated+as+zero%7D+because+%5CLaTeX%7B%7D+then+tries+to+execute+the+internal+command+%5Cverb%7C%5Cc%40first%7C.+Uncomment+the+following+line+to+generate+the+error%3A%0A%5Cbegin%7Bverbatim%7D%0A%25%5Cvalue%7Bfirst%7D%0A%5Cend%7Bverbatim%7D%0A%25%5Cvalue%7Bfirst%7D%0A%5Cend%7Bdocument%7D)

이 예제는 다음 출력을 생성합니다:

![\\\value 명령을 사용한 예](/files/3cc279190bb44c15785207dc8ac322457949dbbf)

### 기타 카운터 명령

여기서는 명령 `\\counterwithin` 및 `\\counterwithout` 의 기원은 [`chngcntr` 패키지](https://ctan.org/pkg/chngcntr) 에 있지만 지금은 LaTeX 자체에 통합되어 있습니다— [LaTeX News, 2018년 4월](https://www.latex-project.org/news/latex2e-news/ltnews28.pdf). 다음 `chngcntr` [패키지 문서](https://mirror.ox.ac.uk/sites/ctan.org/macros/latex/contrib/chngcntr/chngcntr.pdf) 에서 이 명령들의 목적을 이해하는 데 도움이 되는 다음과 같은 설명을 합니다:

켜기 `\\counterwithin`:

> \\\newcounter{\<ctr>}로 정의된 카운터를 `\\newcounter{<ctr>}` 에 의해 정의된 카운터가 마치 `\\newcounter{<ctr>}[<within>]`으로 정의된 것처럼 동작하도록 하는 것이 때때로 바람직합니다. 이 패키지는 명령 `\\counterwithin{<ctr>}{<within>}` 을 제공하여 이를 수행합니다.

켜기 `\\counterwithout`:

> 마찬가지로, 명령 `\\counterwithout{<ctr>}{<within>}` 으로 생성된 카운터를 마치 `\\newcounter{<ctr>}[<within>]` 로 생성된 것처럼 동작하도록 변경합니다 `\\newcounter{<ctr>}`.

본질적으로, 이 두 명령은 정의된 후 두 카운터를 연결(`\\counterwithin`연결`\\counterwithout`해제

**\\\counterwithin{somecounter}{anothercounter}**

0으로 초기화 `*somecounter*` 언제나 0으로 `*anothercounter*` 가 증가될 때마다 초기화되는, 두 카운터를 연결하는 메커니즘입니다. 연결을 만드는 것 외에도, 이 명령은 다음이 조판하는 내용을 다시 정의합니다 `\\the*somecounter*`: 카운터의 값을 출력하는 대신 `*somecounter*` 다음을 생성합니다 `<anothercounter의 값>**.**<somecounter의 값>`. 별표가 붙은 형태(`\\counterwithin*{somecounter}{anothercounter}`)는 다음의 출력 형식을 다시 정의하지 않습니다 `*somecounter*`, 다음 예가 보여 주듯이—코드 아래 링크를 선택해 Overleaf에서 열어 보세요:

```latex
\documentclass{article}
\begin{document}
\\section{A short example}
\\newcounter{example}
\\counterwithin{example}{section}
\\newcounter{exampletwo}
\\counterwithin*{exampletwo}{section}
\\setcounter{example}{100}
\\setcounter{exampletwo}{100}
\begin{itemize}
\\item \\verb|\\theexample|를 조판하면 \\theexample가 됩니다
\\item \\verb|\\theexampletwo|를 조판하면 \\theexampletwo가 됩니다
\end{itemize}
\end{document}
```

[이 예제를 `\\counterwithin` Overleaf의 예](https://www.overleaf.com/docs?engine=\&snip_name=Example+of+starred+version+of+counterwithin\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0A%5Csection%7BA+short+example%7D%0A%5Cnewcounter%7Bexample%7D%0A%5Ccounterwithin%7Bexample%7D%7Bsection%7D%0A%5Cnewcounter%7Bexampletwo%7D%0A%5Ccounterwithin%2A%7Bexampletwo%7D%7Bsection%7D%0A%5Csetcounter%7Bexample%7D%7B100%7D%0A%5Csetcounter%7Bexampletwo%7D%7B100%7D%0A%5Cbegin%7Bitemize%7D%0A%5Citem+%5Cverb%7C%5Ctheexample%7C+typesets+%5Ctheexample%0A%5Citem+%5Cverb%7C%5Ctheexampletwo%7C+typesets+%5Ctheexampletwo%0A%5Cend%7Bitemize%7D%0A%5Cend%7Bdocument%7D)

이 예제는 다음 출력을 생성합니다:

![\\\counterwithin 명령 사용](/files/08795ff5e064289f30b7664db6622f18d61c24ba)

다음을 사용할 수 있습니다 `\\counterwithin` LaTeX가 제공하는 표준 카운터와 함께, 예를 들면:

* `section`: 에 의해 사용되는 `\\section` 명령을 사용합니다
* `식으로 요약할 수 있습니다` 그것이 사용되는 `식으로 요약할 수 있습니다` 환경은

또는 직접 만든 카운터와 함께.

**\\\counterwithin 및 \\\counterwithin\* 예**

다음 코드는 다음을 사용하는 더 완전한 예를 제공합니다 `\\counterwithin` 및 `\\counterwithin*`; 코드를 아래의 링크를 선택하여 Overleaf에서 열어 보세요:

```latex
\documentclass{article}
\\counterwithin{equation}{section}
\\newcounter{example}
\\counterwithin*{example}{section}
\\newenvironment{example}[1][]{%
\\stepcounter{example}%
\\par\\vspace{5pt}\\noindent
\\fbox{\\textbf{Example~\\thesection.\\theexample}}%
\\hrulefill\\par\\vspace{10pt}\\noindent\\rmfamily}%
{\\par\\noindent\\hrulefill\\vrule width10pt height2pt depth2pt\\par}
\begin{document}
\\section{First equation}
도입 텍스트...
\\begin{example}
\begin{equation}
    f(x)=\\frac{x}{1+x^2}
\end{equation}
\\end{example}

\\subsection{More detail}
\\begin{example}
여기서는 다룹니다
\begin{equation}
    f(x)=\\frac{x+1}{x-1}
\end{equation}
... 하지만 아무 말도 하지 않습니다
\\end{example}

\\subsubsection{Even more detail}
\\begin{example}
\begin{equation}
    f(x)=\\frac{x^2}{1+x^3}
\end{equation}
\begin{equation}
    f(x+\\delta x)=\\frac{(x+\\delta x)^2}{1+(x+\\delta x)^3}
\end{equation}
\\end{example}

\\section{Third equation}
\\begin{example}
다음 함수...
\begin{equation}
    f_1(x)=\\frac{x+1}{x-1}
\end{equation}
..는 함수입니다
\begin{equation}
    f_2(x)=\\frac{x^2}{1+x^3}
\end{equation}
\begin{equation}
    f_3(x)=\\frac{3+ x^2}{1-x^3}
\end{equation}
\\end{example}
\end{document}
```

[이 예제를 `\\counterwithin` Overleaf의 예](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Example+of+using+counterwithin\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Ccounterwithin%7Bequation%7D%7Bsection%7D%0A%5Cnewcounter%7Bexample%7D%0A%5Ccounterwithin%2A%7Bexample%7D%7Bsection%7D%0A%5Cnewenvironment%7Bexample%7D%5B1%5D%5B%5D%7B%25%0A%5Cstepcounter%7Bexample%7D%25%0A%5Cpar%5Cvspace%7B5pt%7D%5Cnoindent%0A%5Cfbox%7B%5Ctextbf%7BExample%7E%5Cthesection.%5Ctheexample%7D%7D%25%0A%5Chrulefill%5Cpar%5Cvspace%7B10pt%7D%5Cnoindent%5Crmfamily%7D%25%0A%7B%5Cpar%5Cnoindent%5Chrulefill%5Cvrule+width10pt+height2pt+depth2pt%5Cpar%7D%0A%5Cbegin%7Bdocument%7D%0A%5Csection%7BFirst+equation%7D%0ASome+introductory+text...%0A%5Cbegin%7Bexample%7D%0A%5Cbegin%7Bequation%7D%0A++++f%28x%29%3D%5Cfrac%7Bx%7D%7B1%2Bx%5E2%7D%0A%5Cend%7Bequation%7D%0A%5Cend%7Bexample%7D%0A%0A%5Csubsection%7BMore+detail%7D%0A%5Cbegin%7Bexample%7D%0AHere+we+discuss%0A%5Cbegin%7Bequation%7D%0A++++f%28x%29%3D%5Cfrac%7Bx%2B1%7D%7Bx-1%7D%0A%5Cend%7Bequation%7D%0A...+but+don%27t+say+anything%0A%5Cend%7Bexample%7D%0A%0A%5Csubsubsection%7BEven+more+detail%7D%0A%5Cbegin%7Bexample%7D%0A%5Cbegin%7Bequation%7D%0A++++f%28x%29%3D%5Cfrac%7Bx%5E2%7D%7B1%2Bx%5E3%7D%0A%5Cend%7Bequation%7D%0A%5Cbegin%7Bequation%7D%0A++++f%28x%2B%5Cdelta+x%29%3D%5Cfrac%7B%28x%2B%5Cdelta+x%29%5E2%7D%7B1%2B%28x%2B%5Cdelta+x%29%5E3%7D%0A%5Cend%7Bequation%7D%0A%5Cend%7Bexample%7D%0A%0A%5Csection%7BThird+equation%7D%0A%5Cbegin%7Bexample%7D%0AThe+following+function...%0A%5Cbegin%7Bequation%7D%0A++++f_1%28x%29%3D%5Cfrac%7Bx%2B1%7D%7Bx-1%7D%0A%5Cend%7Bequation%7D%0A..is+a+function%0A%5Cbegin%7Bequation%7D%0A++++f_2%28x%29%3D%5Cfrac%7Bx%5E2%7D%7B1%2Bx%5E3%7D%0A%5Cend%7Bequation%7D%0A%5Cbegin%7Bequation%7D%0A++++f_3%28x%29%3D%5Cfrac%7B3%2B+x%5E2%7D%7B1-x%5E3%7D%0A%5Cend%7Bequation%7D%0A%5Cend%7Bexample%7D%0A%5Cend%7Bdocument%7D)

이 예제는 다음 출력을 생성합니다:

![\\\counterwithin 명령 사용](/files/cdb78cbfe449106df1fb68607039bf39892e3ca1)

**코드 요약**

* `\\newcounter{example}`: 이는 우리 환경에서 사용할 새 카운터를 만들며, 또한 `예제`
* `\\counterwithin*{example}{section}`: 이는 우리의 `예제` 카운터를 `section` 안에서 사용되는 카운터와 `\\section` 명령과 연결합니다: 우리가 `\\section` 명령을 `예제` 실행할 때마다 카운터는 0으로 초기화됩니다. 별표 버전인 `\\counterwithin*` 의 재정의를 피하기 위해 `\\theexample`
* 그다음, 우리는 또한 다음과 같은 새 환경을 만듭니다 `예제`. 그 환경 안에서는 `\\stepcounter{example}` 를 사용해 환경의 카운터를 증가시킵니다. 또한 우리는 `\\textbf{Example~\\thesection.\\theexample}` 를 출력하기 위해 **예제** `<섹션 번호>.<예제 번호>`

```latex
\\newenvironment{example}[1][]{%
\\stepcounter{example}%
\\par\\vspace{5pt}\\noindent
\\fbox{\\textbf{Example~\\thesection.\\theexample}}%
\\hrulefill\\par\\vspace{10pt}\\noindent\\rmfamily}%
{\\par\\noindent\\hrulefill\\vrule width10pt height2pt depth2pt}
```

**\\\counterwithout{somecounter}{anothercounter}**

`\\counterwithout{*somecounter*}{*anothercounter*}` 사이의 연결을 제거하여 `*somecounter*` 및 `*anothercounter*` 서로 독립적이 되게 합니다. 어떤 카운터 쌍이든, 다음을 사용하는 것 사이를 전환할 수 있습니다 `\\counterwithout` 및 `\\counterwithin`, 다음 예가 보여 주듯이 `예제` 및 `section` 카운터들—코드 아래에 제공된 링크를 사용해 이 예를 Overleaf에서 열 수 있습니다.

```latex
\\section{First equation}
\\begin{example}
\begin{equation}
    f(x)=\\frac{x}{1+x^2}
\end{equation}
\\end{example}

\\subsection{Second equation}
\\begin{example}
\begin{equation}
    f(x)=\\frac{x+1}{x-1}
\end{equation}
\\end{example}
\vspace{6pt}\noindent \texttt{example} 카운터가 섹션 \ref{sec:n0}의 시작에서 재설정되는 것을 보세요.
\\section{Third equation}
\label{sec:n0}
\\begin{example}
\begin{equation}
    f(x)=\\frac{x+1}{x-1}
\end{equation}
\\end{example}
\vspace{6pt}\noindent 여기서는 \verb|\counterwithout{example}{section}|를 작성하여 \texttt{example}이 더 이상 섹션 시작 시 재설정되지 않도록 했습니다. 섹션 \ref{sec:n1} 및 \ref{sec:n2}에서 \texttt{example} 카운터는 계속 증가합니다. \counterwithout{example}{section}
\section{네 번째 방정식}
\label{sec:n1}
\\begin{example}
\begin{equation}
    f(x)=\frac{x^2+x^3}{1+x^3}
\end{equation}
\\end{example}
\section{다섯 번째 방정식}
\label{sec:n2}
\\begin{example}
\begin{equation}
    f(x,k)=\frac{x^2-x^k}{1+x^3}
\end{equation}
\\end{example}
```

[이 예제를 `\\counterwithout` Overleaf의 예](<https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Example+of+using+counterwithout\&snip=\documentclass{article}&#xA;\counterwithin{equation}{section}&#xA;\newcounter{example}&#xA;\counterwithin*{example}{section}&#xA;\newenvironment{example}\[1]\[]{%&#xA;\stepcounter{example}%&#xA;\par\vspace{3pt}\noindent&#xA;\fbox{\textbf{Example~\thesection.\theexample}}%&#xA;\hrulefill\par\vspace{3pt}\noindent\rmfamily}%&#xA;{\par\noindent\hrulefill\vrule+width10pt+height2pt+depth2pt\par}&#xA;\begin{document}&#xA;\section{First+equation}&#xA;\begin{example}&#xA;\begin{equation}&#xA;++++f(x)=\frac{x}{1+x^2}&#xA;\end{equation}&#xA;\end{example}&#xA;&#xA;\subsection{Second+equation}&#xA;\begin{example}&#xA;\begin{equation}&#xA;++++f(x)=\frac{x+1}{x-1}&#xA;\end{equation}&#xA;\end{example}&#xA;\vspace{6pt}\noindent+Note+how+the+\texttt{example}+counter+is+reset+at+the+start+Section+\ref{sec:n0}.+&#xA;\section{Third+equation}&#xA;\label{sec:n0}&#xA;\begin{example}&#xA;\begin{equation}&#xA;++++f(x)=\frac{x+1}{x-1}&#xA;\end{equation}&#xA;\end{example}&#xA;\vspace{6pt}\noindent+Here,+we+wrote+\verb|\counterwithout{example}{section}|+so+that+\texttt{example}+is+no+longer+reset+at+the+start+of+a+section.+In+Sections+\ref{sec:n1}+and+\ref{sec:n2}+the+\texttt{example}+counter+keeps+increasing.+\counterwithout{example}{section}&#xA;\section{Fourth+equation}&#xA;\label{sec:n1}&#xA;\begin{example}&#xA;\begin{equation}&#xA;++++f(x)=\frac{x^2+x^3}{1+x^3}&#xA;\end{equation}&#xA;\end{example}&#xA;\section{Fifth+equation}&#xA;\label{sec:n2}&#xA;\begin{example}&#xA;\begin{equation}&#xA;++++f(x,k)=\frac{x^2-x^k}{1+x^3}&#xA;\end{equation}&#xA;\end{example}&#xA;\end{document}>)

이 예제는 다음 출력을 생성합니다:

![counterwithout 명령 사용하기](/files/c6b27f4929b163cfb94118c320e5b372fbb1df13)

## 예제

### enumerate

다음 `enumerate` 목록 환경은 네 개의 *카운터* 변수를 사용하며, 이 변수들은 각 수준의 현재 레이블 값을 추적합니다:

|        |                        |
| ------ | ---------------------- |
| **수준** | **`enumerate`** 카운터 변수 |
| 수준 1   | `enumi`                |
| 수준 2   | `enumii`               |
| 수준 3   | `enumiii`              |
| 수준 4   | `enumiv`               |

이 카운터들은 다음을 사용해 변경할 수 있습니다. `\setcounter` 명령입니다. 아래 예제를 보세요—반드시 최선의 해결책은 아닙니다(다음을 참조하세요 [Overleaf 목록](/latex/ko/latex/04-lists.md) 자세한 정보는 문서를 참고하세요):

```latex
이 예제는 목록의 번호 매기기를 변경하는 한 가지 방법을 보여줍니다. 여기서는 \texttt{enumi} 카운터의 값을 변경하여 목록 번호를 4에서 시작하도록 합니다(이 값은 \verb|\item| 명령에 의해 증가합니다):

\begin{enumerate}
\setcounter{enumi}{3}
\item 무언가.
\item 다른 무언가.
\item 또 다른 항목.
\item 목록의 마지막 항목.
\end{enumerate}
```

[이 예제를 Overleaf에서 열기](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Modifying+an+enumerate+counter\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0A%5Csection%7BIntroduction%7D%0AThis+example+shows+one+way+to+change+the+numbering+of+a+list%3B+here%2C+changing+the+value+of+the+%5Ctexttt%7Benumi%7D+counter+to+start+the+list+numbering+at+4+%28it+is+incremented+by+the+%5Cverb%7C%5Citem%7C+command%29%3A%0A%0A%5Cbegin%7Benumerate%7D%0A%5Csetcounter%7Benumi%7D%7B3%7D%0A%5Citem+Something.%0A%5Citem+Something+else.%0A%5Citem+Another+element.%0A%5Citem+The+last+item+in+the+list.%0A%5Cend%7Benumerate%7D%0A%5Cend%7Bdocument%7D)

이 예제는 다음 출력을 생성합니다:

![enumerate 카운터 수정하기](/files/b9a1fec6e9e8f712fd9bc7d441677fd4a91575a9)

## LaTeX의 기본 카운터

| 사용법                    | 이름                                                                           |
| ---------------------- | ---------------------------------------------------------------------------- |
| 문서 구조용                 | <p>- 파트<br>- 장<br>- 절<br>- 하위 절<br>- 하위 하위 절<br>- 단락<br>- 하위 단락<br>- 페이지</p> |
| 플로트용                   | <p>- 방정식<br>- 그림<br>- 표</p>                                                  |
| 각주용                    | <p>- 각주<br>- mpfootnote</p>                                                  |
| 다음을 위한 `enumerate` 환경은 | <p>- enumi<br>- enumii<br>- enumiii<br>- enumiv</p>                          |

## 추가 읽을거리

자세한 내용은 다음을 참조하세요:

* [환경](/latex/ko/commands/02-environments.md)
* [명령](/latex/ko/commands/01-commands.md)
* [목록](/latex/ko/latex/04-lists.md)
* [페이지 번호 매기기](/latex/ko/formatting/03-page-numbering.md)
* [섹션과 장](/latex/ko/document-structure/01-sections-and-chapters.md)
* [수학 표현식](/latex/ko/mathematics/01-mathematical-expressions.md)
* [이미지 삽입](/latex/ko/more-topics/27-inserting-images.md)
* [표](/latex/ko/figures-and-tables/01-tables.md)
* [LaTeX에서 시험지 작성하기](/latex/ko/field-specific/09-typesetting-exams-in-latex.md)
* [사용자 정의 패키지 작성하기](/latex/ko/class-files/03-writing-your-own-package.md)
* [자신만의 클래스 작성하기](/latex/ko/class-files/04-writing-your-own-class.md)
* [LaTeX2ε에 대한 그다지 짧지 않은 소개](http://www.ctan.org/tex-archive/info/lshort/)


---

# 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/10-counters.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.
