단계 2 · 텍스트와 문서 구조 12 / 48 ≈ 16 분 분량

LaTeX 목록: itemize·enumerate·description

LaTeX에는 목록 환경이 세 개 있고, 셋 모두 같은 커널 매크로 위에 얹혀 있어서 실제로는 같은 여덟 레지스터가 모양을 결정합니다. 이 강의는 중첩 단계별 라벨 사다리와 그 아래 카운터, \ref가 지금의 것을 인쇄하는 이유, 손으로 만든 \renewcommand 정의를 대신하는 enumitem의 키, 그리고 목록이 페이지에서 값으로 치르는 세로 여백을 다룹니다.

    세 개의 환경, 하나의 커널 매크로, 하나의 규칙

    itemize, enumerate, description이 기본 시스템에서 LaTeX가 가진 목록 어휘의 전부입니다. 셋 모두 커널 매크로 \list를 얇게 감싼 래퍼라서 들여쓰기와 여백, 그리고 오류 메시지까지 공유합니다. itemize는 기호를 대고, enumerate는 카운터를 대며, description은 각 \item의 선택 인자에 입력한 라벨을 그대로 씁니다.

    유일한 규칙은 목록의 본문이 항목들로만 구성되어야 한다는 것입니다. 모든 항목은 \item으로 시작하고, 첫 내용이 \item이 아닌 환경 — 완전히 빈 목록을 포함해 — 은 LaTeX에서 가장 혼란스러운 오류를 냅니다: ! LaTeX Error: Something's wrong--perhaps a missing \item. 메시지는 정확하지만 원인까지는 대개 그렇지 않습니다. 뜬금없는 빈 줄, 주석 처리된 \item, 아직 아무 내용도 없는 \begin{document} 바로 뒤에 시작된 목록이 모두 같은 보고를 남깁니다.

    셋 중에서 고르는 문제는 나중에 그 목록에 대해 무엇을 말할 수 있어야 하는지의 문제입니다. 순서를 인용할 가치가 없는 집합에는 itemize를 쓰십시오. 항목을 참조해야 한다면 enumerate를 씁니다 — 항목에 카운터가 붙어 \label{itm:power}와 \ref{itm:power}가 인쇄된 숫자로 해결되기 때문입니다. 용어와 설명이 짝을 이루는 재료에는 description이 맞습니다. 라벨이 생성된 토큰이 아니라 내용 그 자체이니까요.

    초보자가 목록으로 풀려 하지만 그러면 안 되는 네 번째 경우가 있습니다. 짧은 정의를 두 열로 늘어놓은 경우나, 답안지, 또는 페이지에 펼쳐진 체크리스트입니다. 그런 것은 중첩 글머리가 아니라 표나 tasks 패키지의 영역이고, 이 강의 마지막 절에서 다시 다룹니다.

    \begin{array}{l|l}\text{environment} & \text{what it contributes} \\\hline \texttt{itemize} & \text{a symbol, no counter} \\ \texttt{enumerate} & \text{a counter you can \textbackslash ref} \\ \texttt{description} & \text{a label you type per item}\end{array}
    \begin{array}{l|l}\text{environment} & \text{what it contributes} \\\hline \texttt{itemize} & \text{a symbol, no counter} \\ \texttt{enumerate} & \text{a counter you can \textbackslash ref} \\ \texttt{description} & \text{a label you type per item}\end{array}
    enumerate만 카운터를 소유하므로, 의미 있게 상호 참조할 수 있는 것도 enumerate 항목뿐입니다.

    라벨 사다리: 네 단계와 그 아래 카운터들

    표준 클래스는 목록 하나당 네 단계의 중첩을 허용하고, 각 단계에 미리 정해진 라벨이 있습니다. article에서 글머리 사다리는 1단계 채워진 총알, 2단계 굵은 en-dash, 3단계 가운데 정렬 별표, 4단계 가운데 정렬 마침표이고, report와 book은 총알 대신 em-dash로 시작합니다. 같은 소스가 학위논문 클래스에서 다르게 보이는 이유입니다. 숫자 사다리는 1., (a), iii., A.입니다.

    그 라벨은 하드코딩된 문자열이 아니라 두 매크로로 짝 지어집니다. 카운터는 enumi, enumii, enumiii, enumiv이고, \theenumi는 카운터를 읽는 방법(\arabic{enumi})을 말하고, \labelenumi는 항목 앞에 인쇄되는 방법(\theenumi.)을 말합니다. itemize에 대응하는 것은 \labelitemi부터 \labelitemiv까지이고 그 뒤에는 카운터가 없습니다.

    이 분리는 항목에 \label을 붙이는 순간 중요해집니다. \ref가 인쇄하는 것이 \p@enumii\theenumii — 부모 접두사(표준 클래스에서는 비어 있음)에 현재 값을 더한 형태 — 이기 때문입니다. 그래서 \labelenumi만 재정의하면 글머리만 바뀌고 상호 참조는 옛 스타일에 남고, \theenumi를 재정의하면 둘 다 바뀝니다. 하위 항목 참조가 “c” 대신 “2.3”으로 읽히길 원할 때 딱 원하는 동작입니다. 두 매크로 설계는 그렇게 쓰라고 있는 것입니다: \renewcommand{\theenumii}{\theenumi.\arabic{enumii}}에 이어서 \renewcommand{\labelenumii}{(\theenumii)}.

    중첩 깊이는 흡수되지 않고 검사됩니다. 어느 환경이든 다섯째 단계는 실행을 ! Too deeply nested.로 멈춥니다. 시작 값이 1이 아닌 목록을 만들려면 알맞은 단계의 카운터를 설정하면 됩니다 — \begin{enumerate}\setcounter{enumi}{4}는 첫 항목에 5번을 붙이고, 평범한 \begin{enumerate}는 그 자체로 enumi를 0으로 되돌리므로 되돌리기와 설정은 같은 메커니즘입니다.

    \begin{array}{c|c|c|c}\text{depth} & \text{counter} & \text{\textbackslash the…} & \text{printed label} \\\hline 1 & \texttt{enumi} & \texttt{\textbackslash arabic\{enumi\}} & \texttt{1.} \\ 2 & \texttt{enumii} & \texttt{\textbackslash alph\{enumii\}} & \texttt{(a)} \\ 3 & \texttt{enumiii} & \texttt{\textbackslash roman\{enumiii\}} & \texttt{iii.} \\ 4 & \texttt{enumiv} & \texttt{\textbackslash Alph\{enumiv\}} & \texttt{A.}\end{array}
    \begin{array}{c|c|c|c}\text{depth} & \text{counter} & \text{\textbackslash the…} & \text{printed label} \\\hline 1 & \texttt{enumi} & \texttt{\textbackslash arabic\{enumi\}} & \texttt{1.} \\ 2 & \texttt{enumii} & \texttt{\textbackslash alph\{enumii\}} & \texttt{(a)} \\ 3 & \texttt{enumiii} & \texttt{\textbackslash roman\{enumiii\}} & \texttt{iii.} \\ 4 & \texttt{enumiv} & \texttt{\textbackslash Alph\{enumiv\}} & \texttt{A.}\end{array}
    Four levels of nested LaTeX lists with their predefined labels, counters and macros, and the wall at level five THE TEXT SIDE: WHAT A NESTED LIST LOOKS LIKE • – * · ? a fifth level stops the run: Too deeply nested each level also moves the block further in: \leftmargini 2.5em, \leftmarginii 2.2em, \leftmarginiii 1.87em, \leftmarginiv 1.7em THE MACROS BEHIND THE SYMBOLS ITEMIZE — no counter \labelitemi \textbullet \labelitemii a bold endash \labelitemiii centred asterisk \labelitemiv centred period report and book start with an em dash instead ENUMERATE — four counters 1. enumi \theenumi = \arabic{enumi} (a) enumii \theenumii = \alph{enumii} iii. enumiii \theenumiii = \roman{enumiii} A. enumiv \theenumiv = \Alph{enumiv} \label… prints it, \the… also feeds \ref WHAT A LIST ITEM COSTS VERTICALLY \partopsep + \topsep = space above the list \itemsep between items · \parsep between paragraphs inside one item article at level 1: topsep 8pt, itemsep and parsep 4pt, all with stretch and shrink; deeper levels shrink toward zero, which is why level 4 looks tight.
    네 단계의 글머리와 번호, 각각을 정의하는 매크로, 그리고 다섯째 단계에 서 있는 벽.

    enumitem: 전역 재정의 대신 목록별 옵션

    \usepackage{enumitem}이 표준 업그레이드이고 인터페이스를 바꿔 놓습니다. \begin{enumerate}[label=(\alph*),leftmargin=*]는 이 목록을 사용자화하는데, *가 현재 카운터 값의 자리표시자입니다. 대개 진짜로 원하는 쪽이 이것이고, \renewcommand{\labelenumi}는 문서의 모든 목록을 바꿔 버리면서 다음에 문서를 편집하는 사람 눈에는 보이지 않습니다. 패키지를 shortlabels 옵션과 함께 올리면 짤막한 \begin{enumerate}[(a)] 형태도 쓸 수 있습니다.

    자주 쓰게 되는 키는 아래 표에 있습니다. label과 ref는 \labelenumi, \theenumi를 대체하고, label*은 부모 라벨에 이어 붙여서 부모 부분을 직접 쓰지 않고도 1.1, 1.2를 얻게 해 줍니다. start와 resume/series은 카운터를 조절하고, noitemsep과 nosep은 기성 여백 프리셋이며, wide는 표준의 느슨한 여백을 되돌리고, align=left와 align=parbox은 라벨이 배정된 \labelwidth보다 넓을 때의 거동을 정합니다.

    문서 전역 기본값은 재정의가 아니라 설정으로 처리합니다: \setlist[enumerate,1]{label=\arabic*.}은 “모든 enumerate의 1단계”, \setlist[itemize]{topsep=4pt}은 “모든 단계의 모든 itemize”, 인자 없는 \setlist{noitemsep}은 문서의 모든 목록을 뜻합니다. 이것들이 프리앰블에 놓는 선언이라는 사실은 또한 목록 여백을 정직하게 바꾸는 길이라는 뜻이기도 합니다. 표준 클래스는 목록이 시작될 때 자체 \@listi, \@listii 매크로에서 topsep, parsep, itemsep을 가져오기 때문에, 프리앰블에 둔 \setlength{\topsep}{…}는 소리 없이 버려집니다.

    직접 발명하기 전에 알아 둘 스위치가 둘 더 있습니다. \usepackage[inline]{enumitem}은 itemize*, enumerate*, description*을 더합니다 — 단락 안에서 흐르는 목록으로, “(a) 속도, (b) 비용, (c) 무게를 시험했다”를 알파벳을 손으로 쓰지 않고 처리하는 올바른 도구입니다. 그리고 \newlist{checklist}{itemize}{2}는 기존 환경 위에 자체 깊이와 자체 스타일을 둔 새 이름을 선언해 주므로, 사내 표준이 본문 안으로 스며들지 않습니다.

    \begin{array}{ll}\texttt{label} & \text{what prints before each item} \\ \texttt{ref} & \text{what \textbackslash ref\ shows for that item} \\ \texttt{start} & \text{first value of the counter} \\ \texttt{series} & \text{a named list you can resume later} \\ \texttt{leftmargin=*} & \text{flush with the text block} \\ \texttt{noitemsep} & \text{itemsep and parsep to zero}\end{array}
    \begin{array}{ll}\texttt{label} & \text{what prints before each item} \\ \texttt{ref} & \text{what \textbackslash ref\ shows for that item} \\ \texttt{start} & \text{first value of the counter} \\ \texttt{series} & \text{a named list you can resume later} \\ \texttt{leftmargin=*} & \text{flush with the text block} \\ \texttt{noitemsep} & \text{itemsep and parsep to zero}\end{array}
    The enumitem option keys grouped by what they change: label, layout, counter and behaviour \begin{enumerate}[label=(\alph*),leftmargin=*] one optional argument, comma-separated key = value pairs WHAT PRINTS BEFORE THE TEXT label the box itself label* appended to the parent ref what \ref will show font shape of the label only align how a too-wide label sits in the label, * is the current value of the counter for that level WHERE THE LIST SITS leftmargin=* flush with the block labelindent moves the label out itemindent first line of the item listparindent 2nd paragraph, same item rightmargin the fore-edge side vertical: topsep, partopsep, itemsep, parsep — or noitemsep, nosep THE COUNTER AND THE RUN start=3 first value series=name a named sequence resume continue it here resume* keep the level too wide old-style loose spacing description keys: style=sameline and style=nextline decide label vs text line DOCUMENT-WIDE, STILL WITHOUT \renewcommand \setlist[enumerate,2]{label=(\roman*)} \setlist{noitemsep} first is one environment at one depth; second is every list in the file NEW NAMES, AND DEEPER THAN FOUR \newlist{checklist}{itemize}{2} \setlistdepth{9} a checklist is a style, not a hack; \renewlist{itemize}{itemize}{9} raises the wall Inline lists are separate environment names, not keys: \usepackage[inline]{enumitem} gives itemize*, enumerate*, description*, which continue the surrounding paragraph — the correct tool for "screened (i) by price, (ii) by lead time and (iii) by warranty".
    enumitem 옵션은 키–값 쌍입니다. 라벨은 클래스가 쓰는 바로 그 카운터에서 만들어지고, 그 자리표시자가 *입니다.
    \documentclass[10pt]{article}
    \usepackage[T1]{fontenc}
    \usepackage{lmodern}
    \usepackage{amssymb}                 % for \square
    \usepackage[inline,shortlabels]{enumitem}
    
    \setlist[enumerate,1]{label=\textbf{\arabic*.},leftmargin=*}
    \setlist[enumerate,2]{label=\textbf{\theenumi.\arabic*}}
    \setlist[itemize]{topsep=4pt,itemsep=2pt,parsep=0pt}
    \setlist[description]{style=nextline}
    
    \newlist{checklist}{itemize}{2}
    \setlist[checklist,1]{label=$\square$,leftmargin=*}
    
    \newlist{questions}{enumerate}{2}
    \setlist[questions,1]{label=Q\arabic*,ref=Q\arabic*}
    \setlist[questions,2]{label=(\alph*),ref=\arabic{questionsi}(\alph*)}
    
    \begin{document}
    
    \section*{Per-instance options}
    
    \begin{enumerate}[label=\textbf{\arabic*.},start=3]
      \item Third in the sequence, because \texttt{start=3}.
      \item \begin{enumerate}[label*=\arabic*]   % label* appends to the parent
              \item prints 3.1, where \texttt{label=\arabic*} on its own would
                    have restarted at 1.
            \end{enumerate}
    \end{enumerate}
    
    \begin{checklist}
      \item Power budget signed off
      \item Rack space measured
    \end{checklist}
    
    \begin{questions}
      \item Which port is upstream? \label{q:one}
        \begin{questions}
          \item Justify with the diagram. \label{q:onea}
        \end{questions}
      \item See question~\ref{q:one} and part~\ref{q:onea}.
    \end{questions}
    
    \section*{Inline lists}
    Three candidates were screened \begin{enumerate*}[label=(\roman*)]
      \item by price \item by lead time \item by warranty
    \end{enumerate*}, and only the last two survived.
    
    \section*{Broken across a page}
    \begin{enumerate}[series=steps]
      \item Unpack
      \item Mount
    \end{enumerate}
    Text on the next page continues the same numbering:
    \begin{enumerate}[resume*=steps]
      \item Commission
    \end{enumerate}
    
    \end{document}

    description: 라벨은 카운터가 아니라 내용

    description 환경은 \list{}{\labelwidth\z@ \itemindent-\leftmargin \let\makelabel\descriptionlabel}로 정의됩니다. 문자 그대로 읽으면 결론이 둘 나옵니다. 첫째, \labelwidth가 0입니다. 라벨은 고정 폭 상자에 넣지 않고 조판한 뒤 그 뒤에 본문을 이어 놓기 때문에, 긴 용어는 제 항목의 본문만 오른쪽으로 밀고 이웃 항목은 제자리에 남아 있습니다. 둘째, \itemindent는 \leftmargin의 음수이고, 이것이 라벨을 여백 바깥으로 잡아당기는 장치입니다.

    커널의 \descriptionlabel은 \hspace\labelsep\normalfont\bfseries #1입니다. description 라벨이 굵게 나오는 전적인 이유가 저쪽이고, 그것을 재정의하는 것이 이탤릭이나 스몰캡스, 또는 전부 대문자로 된 라벨을 얻는 방법입니다. enumitem이 있으면 같은 일이 키 하나로 끝납니다 — \setlist[description]{font=\normalfont\itshape} — 또는 기성품인 style=nextline은 설명을 용어 옆이 아니라 아래에 놓아 주고, 표기법 표를 읽을 만하게 만들어 주는 바로 그 옵션입니다.

    라벨에는 단락 안에서 동작하는 것이라면 무엇이든 들어갈 수 있고 수식도 포함됩니다: \item[$\alpha$-decay] …. 잘 들어가지 않는 것은 각주나 \verb입니다 — 선택 인자는 여러 문맥에서 움직이는 인자이기 때문입니다. 있는 그대로 쓰기 같은 용어가 필요하면 \texttt{}가 안전한 선택입니다.

    빈 선택 인자를 둔 \item[]은 실수가 아니라 실제 관용구입니다: 라벨이 없는 항목을 만드는데, description 목록의 들여쓰기는 유지하면서 굵은 용어만 걷어 내는 표준 방법입니다. 제목 같은 라벨 아래 이어지는 단락을 다룰 때 쓸모가 있습니다.

    목록의 모양을 결정하는 레지스터들

    수평 방향으로 목록은 네 개의 길이로 이루어집니다. \leftmargin과 그 단계별 형태인 \leftmargini부터 \leftmarginiv까지는 블록 전체를 본문 폭 안쪽으로 밀고, \labelwidth는 라벨을 담는 상자이고, \labelsep은 라벨과 본문 사이 간격이고, \itemindent는 각 항목의 첫 줄을 그것을 기준으로 이동시키고, \listparindent는 항목 안 두번째 단락의 들여쓰기입니다. \rightmargin은 오른쪽에서 폭을 떼어 갑니다. enumitem은 이 전부를 같은 이름으로 노출합니다.

    수직 방향으로는 네 개의 거리가 있고, 이들을 헷갈리는 것이 가장 흔한 여백 불만입니다. \topsep은 목록 전체의 위아래 글루, \partopsep은 \begin 앞에 빈 줄이 있을 때, 즉 목록이 새 단락을 시작할 때만 추가되는 글루, \itemsep은 항목 사이에 놓이는 글루, \parsep는 한 항목 안의 단락 사이에 놓이는 글루입니다. 1단계에서 article은 대략 \topsep 8pt에 \itemsep과 \parsep을 각각 4pt씩 주는데 모두 신축 여지를 두며, 깊을수록 값은 0으로 수렴합니다 — 네째 단계 목록이 꽉 조여 보이는 이유입니다.

    이 숫자들이 목록이 시작되는 순간 \@listi와 그 일가에 할당되기 때문에, enumitem이 이들을 바꾸는 깔끔한 방법(\setlist[enumerate]{topsep=6pt})이고 클래스 매크로를 패치하는 것이 지저분한 방법입니다. 유일한 예외는 \parskip입니다. 그것은 진정으로 전역이며, 0이 아닌 \parskip을 설정한 문서의 목록은 클래스나 parskip 패키지가 보정용으로 목록 파라미터를 다시 조절하지 않는 한 그 값을 그대로 물려받습니다.

    한 항목은 그 자체로 단락 문맥이므로 항목 안의 빈 줄은 실수가 아닙니다 — 두번째 단락이고, \parsep로 비용을 치르고 \listparindent로 들여쓰기를 합니다. 반면 부모 \item과 그 항목이 소유한 중첩 \begin{itemize} 사이의 빈 줄은 실제로 빈 단락과 아무도 부탁하지 않은 틈을 만들어 냅니다. 중첩 목록은 그것을 소유한 항목과 논리적으로 같은 줄에 놓으십시오.

    \begin{array}{c}\texttt{partopsep}\quad\text{list starts a new paragraph} \\ \hline \texttt{topsep}\quad\text{above and below the whole list} \\ \hline \texttt{itemsep}\quad\text{between two items} \\ \hline \texttt{parsep}\quad\text{between two paragraphs inside one item}\end{array}
    \begin{array}{c}\texttt{partopsep}\quad\text{list starts a new paragraph} \\ \hline \texttt{topsep}\quad\text{above and below the whole list} \\ \hline \texttt{itemsep}\quad\text{between two items} \\ \hline \texttt{parsep}\quad\text{between two paragraphs inside one item}\end{array}
    Anatomy of a list item: which length controls the label box, the indentation, and each of the four vertical gaps THE PAGE, THE TEXT BLOCK AND THE LIST INSIDE IT text block = \textwidth \leftmargin leftmargin moves the whole list in (a) labelwidth \labelsep second paragraph inside the same item — indented by \listparindent, spaced by \parsep (b) \itemindent shifts only the first line of an item \rightmargin THE FOUR VERTICAL GAPS OF A LIST \parskip + \partopsep only when a blank line precedes \begin{itemize} \topsep above and below the list \itemsep between two items \parsep inside one item partopsep is a top-up, not an alternative WHY \setlength DOES NOT FIX ANY OF THEM % article.cls assigns them every time a level-1 list starts: \def \@listi { \leftmargin \leftmargini \parsep 4pt … \topsep 8pt … \itemsep 4pt … } so the preamble assignment has to come from enumitem (\setlist{itemsep=2pt}) or from patching \@listi. enumitem exposes all of the above as keys with the same names: leftmargin=*, labelsep, listparindent, itemindent, topsep, partopsep, itemsep, parsep — and noitemsep / nosep are presets over the last four.
    어떤 길이가 항목의 어느 가장자리를 조절하고, 어떤 글루가 어느 틈을 조절하는가.

    목록이 잘못된 도구일 때

    마흔 개 용어로 된 용어집을 description으로 짜면 두 가지로 무너집니다. 앞 절에서 본 것처럼 긴 용어가 본문과 부딪히고, 블록을 열로 훑어볼 수 없습니다. 대체물은 표기법 표에는 두 열 longtable 또는 tabularx, 짧은 항목용 두세 단 구성입니다. tasks 패키지는 정확히 그 일을 위해 존재합니다: \begin{tasks}(3)에 줄당 \task 하나를 두면 번호나 글머리가 달린 목록을 세 열에 걸쳐 깔면서 번호 순서를 읽는 순서로 유지하고, 연습 문제지에 필요한 것이 바로 그것입니다.

    순서가 아니라 시각적 구조를 가진 것 — 서식, 주소 블록, 서명란 — 은 목록 대신 tabular, quote, 또는 center 블록 안에 둔 명시적 \\ 줄 바꾸기가 알맞은 환경입니다. 목록은 여백과 세로 글루를 데려옵니다. 둘 다 원치 않았다면 여러분이 진짜 원한 것은 단락이었습니다.

    체크리스트라고 itemize에 [ ]을 텍스트로 쳐서 상자를 흉내 내지는 마십시오. 대괄호는 어떤 문맥에서는 선택 인자로 해석되고, 일관된 스타일링도 불가능합니다. 대신 목록을 선언하십시오 — amssymb를 올린 뒤 \newlist{checklist}{itemize}{1}과 \setlist[checklist,1]{label=$\square$,leftmargin=*} — 그러면 상자는 알맞은 굵기에 알맞은 크기로 나가는 글리프가 됩니다.

    마지막으로, 그 “목록”이 사실 다른 본문에서 번호로 참조하는 절차의 나열이라면 enumerate에 ref/label이 도구이고 번호가 곧 내용물입니다. 단지 번호가 붙어 읽히는 나열일 뿐이라면 글머리에 label=\textbf{\arabic*.}를 써도 되지만, enumerate가 그 사실을 정직하게 드러냅니다.

    한 사례를 줄별로

    아래 리스트는 표준 클래스 투어입니다. itemize 라벨 하나와 enumerate 매크로 둘을 재정의해 하위 항목 참조가 “1.2”로 인쇄되는 동안 눈에 보이는 라벨은 “(1.2)”가 나오고, \begin{enumerate} 뒤에 enumi을 설정해 목록을 3부터 시작하고, 다섯째 단계까지 중첩하되 실패하는 부분은 주석으로 처리하며, 짧은 용어집에 description을 씁니다.

    거기에 있는 두 가지 세부는 놓이기 쉽지만 그대로 옮겨 쓸 가치가 있습니다. 하나는 \item Cooling, as item~\ref{itm:psu} requires — 결합 기호가 단어와 번호를 붙들어 두므로 줄 바꾸기가 “item”과 그 참조를 갈라 놓을 수 없습니다. 다른 하나는 오류 텍스트와 함께 주석 처리된 다섯째 단계입니다. 파일은 컴파일되고, 그 주석을 푸는 것은 로그 읽기 90초 연습이 됩니다.

    세째 절의 enumitem 리스트와 견줘 보십시오. 같은 문서 구성에 목록별 옵션이 있고, 이름 붙은 checklist가 있고, \newlist이 만들어 준 부모 카운터 questionsi까지 ref가 닿는 두 단계 questions 목록이 있고, 문장 안에 인라인 enumerate*가 있고, 사이에 본문 블록을 끼고 번호를 이어 가는 series/resume* 쌍이 있습니다. 표준 클래스 버전이 프리앰블에 \renewcommand 네 줄을 요구하는 자리에서, enumitem 버전은 국소적 결정을 위해 프리앰블을 아예 요구하지 않습니다 — 세번째 수정을 거치고 나면 몸으로 느끼는 차이가 바로 그겁니다.

    \documentclass[11pt]{article}
    \usepackage[T1]{fontenc}
    \usepackage{lmodern}
    
    % ---- labels and counters of the standard classes -------------------
    % level 1: 1.   level 2: (a)   level 3: iii.   level 4: A.
    % itemize: bullet, endash, centred asterisk, centred period
    \renewcommand{\labelenumi}{\theenumi)}     % 1) instead of 1.
    \renewcommand{\theenumii}{\theenumi.\arabic{enumii}} % refs read "1.2"
    \renewcommand{\labelenumii}{(\theenumii)}  % labels read "(1.2)"
    \renewcommand{\labelitemii}{$\circ$}       % a math ring as a bullet
    
    \begin{document}
    
    \section{Requirements}
    
    \begin{enumerate}\setcounter{enumi}{2}      % this list starts at 3)
      \item Power supply \label{itm:psu}
      \item Network
        \begin{itemize}
          \item Wired
          \item Wireless
            \begin{itemize}
              \item 2.4\,GHz only, no WPA3 support in the older access points
                \begin{itemize}
                  \item a fourth level is the last one the standard classes allow
                    % \begin{itemize}
                    %   \item a fifth level stops the run with the message
                    %         ! Too deeply nested.
                    % \end{itemize}
                \end{itemize}
            \end{itemize}
        \end{itemize}
      \item Cooling, as item~\ref{itm:psu} requires
    \end{enumerate}
    
    \section{Definitions}
    
    \begin{description}
      \item[Baseline] the invisible line the letters sit on; descenders go below it.
      \item[Leading] the distance from one baseline to the next, stored in
                     \verb|\baselineskip|.
      \item[Overfull] a line TeX could not fit; it sticks into the margin instead
                      of hyphenating.
    \end{description}
    
    An empty list is an error, not an empty space on the page:
    % \begin{itemize}
    % \end{itemize}
    % ! LaTeX Error: Something's wrong--perhaps a missing \item.
    
    \end{document}

    이 강의 요약표

    각 소절의 핵심 코드 한 줄씩. 소절 제목을 눌러 해당 위치로 이동하고 코드는 바로 복사하세요.

    소절 핵심 코드
    \begin{array}{l|l}\text{environment} & \text{what it contributes} \\\hline \texttt{itemize} & \text{a symbol, no counter} \\ \texttt{enumerate} & \text{a counter you can \textbackslash ref} \\ \texttt{description} & \text{a label you type per item}\end{array}
    \begin{array}{c|c|c|c}\text{depth} & \text{counter} & \text{\textbackslash the…} & \text{printed label} \\\hline 1 & \texttt{enumi} & \texttt{\textbackslash arabic\{enumi\}} & \texttt{1.} \\ 2 & \texttt{enumii} & \texttt{\textbackslash alph\{enumii\}} & \texttt{(a)} \\ 3 & \texttt{enumiii} & \texttt{\textbackslash roman\{enumiii\}} & \texttt{iii.} \\ 4 & \texttt{enumiv} & \texttt{\textbackslash Alph\{enumiv\}} & \texttt{A.}\end{array}
    \documentclass[10pt]{article}
    \begin{array}{c}\texttt{partopsep}\quad\text{list starts a new paragraph} \\ \hline \texttt{topsep}\quad\text{above and below the whole list} \\ \hline \texttt{itemsep}\quad\text{between two items} \\ \hline \texttt{parsep}\quad\text{between two paragraphs inside one item}\end{array}
    \documentclass[11pt]{article}

    자주 하는 실수

    • enumitem을 올리지 않은 문서에서 \begin{enumerate}[a)]를 쓰는 것. 표준 환경은 선택 인자를 받지 않아 대괄호 안 텍스트가 목록 앞의 평범한 내용으로 조판되고, 라벨은 1., 2., 3.으로 남습니다.
    • 유일한 \item을 지워 버리거나 목록을 빈 채로 두고 Something's wrong--perhaps a missing \item을 클래스 버그로 읽는 것. 그 환경은 실제로 항목 본문 하나를 요구합니다.
    • \item과 그 항목이 소유한 중첩 \begin{itemize} 사이에 빈 줄을 두는 것. 중첩 목록이 새 단락으로 시작하면서 부모 항목 앞에 \parsep 크기만큼의 빈 줄이 생깁니다.
    • \renewcommand{\labelenumi}{\arabic{enumi})}를 해 두고 \ref가 왜 여전히 옛 모양으로 인쇄되는지 의아해하는 것. 라벨은 \labelenumi에서 오고 참조는 \theenumi에서 옵니다.
    • 다섯째 단계까지 중첩해 놓고 클래스를 탓하는 것. 구조를 깎아 내거나 \setlistdepth{9}에 \renewlist{itemize}{itemize}{9}로 천장을 올리고 \labelitemv를 정의하세요.
    • 프리앰블에서 \setlength{\topsep}{0pt}로 목록을 조이려 하는 것. 클래스는 목록이 시작될 때 \@listi에서 \topsep을 다시 할당합니다. \setlist{topsep=0pt} 또는 noitemsep을 쓰세요.
    • 항목을 \item으로 나누는 대신 \\으로 구분하는 것. 목록 전체가 하나의 항목이 되고 라벨이 전부 사라집니다.

    이 강의에 대한 질문

    LaTeX에서 enumerate 목록의 번호를 글자로 바꾸려면?
    enumitem으로 목록별로 바꿉니다. \begin{enumerate}[label=\alph*)]는 a) b) c)를 주고, label=\textbf{\arabic*.}는 굵은 숫자를 줍니다. 패키지 없이 클래스 매크로를 건드리려면 프리앰블에서 \renewcommand{\labelenumi}{\alph{enumi})}처럼 재정의하면 되는데, 그렇게 하면 문서의 모든 최상위 목록이 바뀌고 \ref까지 새 모양으로 인쇄하려면 \theenumi도 함께 재정의해야 합니다.
    LaTeX에서 나열 목록을 5부터 시작하려면?
    \begin{enumerate}\setcounter{enumi}{4}라고 치면 첫 항목이 5로 인쇄됩니다. 카운터는 라벨이 조판되기 직전에 증가하기 때문입니다. enumitem으로는 같은 일이 키 하나가 됩니다: \begin{enumerate}[start=5]. 앞서 끝난 목록의 번호를 이어 가려면 두 목록 모두 series=로 이름을 주고 둘째를 resume*=로 여세요.
    "Something is wrong, perhaps a missing \item"은 무슨 뜻인가요?
    목록 환경이 시작됐는데 내용이나 \end를 만나기 전까지 \item을 찾지 못했다는 뜻입니다. 빈 목록, 항목이 전부 주석 처리된 목록, 다른 명령의 인자 안으로 들어간 \item에서 보고됩니다. 환경을 지우거나 항목을 채우세요. 이 오류가 페이지의 다른 무언가를 지적하는 일은 결코 없습니다.
    LaTeX 목록 항목 사이의 여백을 없애려면?
    enumitem을 올려 개별 목록에 noitemsep 키를 더하거나, 프리앰블에서 \setlist{noitemsep}로 전역에 적용하세요. nosep은 목록 위아래 여백까지 함께 지웁니다. 두 키가 \itemsep과 \parsep을 0으로 설정하는데, 바로 그 틈을 만드는 두 레지스터입니다.
    LaTeX 목록은 몇 단계까지 중첩할 수 있나요?
    표준 클래스에서는 네 단계이고, 각 단계가 미리 정의된 라벨과 leftmargin을 따로 가집니다. 다섯째 단계는 "Too deeply nested" 메시지를 냅니다. enumitem으로는 \setlistdepth로 한도를 올리고 새 단계의 모양을 선언할 수 있지만, 글머리 네 단계는 이미 독자가 따라가기 어려운 지점이니 먼저 구조 문제로 다루세요.
    itemize와 description의 차이는?
    itemize는 \labelitemi부터 \labelitemiv까지 생성된 기호를 인쇄하고, description은 각 \item의 선택 인자를 \descriptionlabel로 조판해 인쇄하며 커널 기본값은 굵게 나옵니다. description은 그 라벨에 고정 폭을 배정하지 않으므로, enumitem의 style=nextline로 전환하지 않는 한 긴 용어는 제 본문을 오른쪽으로 밀어 냅니다.

    실시간 놀이터: LaTeX를 편집하고 바로 렌더링

    입력하면 미리보기가 즉시 갱신됩니다. 일부러 깨뜨려서 오류가 어떻게 보이는지도 확인해 보세요.

    KaTeX 오류
    예제 사용해 보기

    이어서 읽기

    같은 주제로 들어가는 세 갈래: 표기 자체, 그것을 가르치는 강의, 그리고 실제로 쓰는 글.