在latex中有三種條列式方法 itemize 、 enumerate 、 discription很常被使用。
本文討論主題有:行距設定, 編號設定, 以及全文設定方式
- 排版之後, 每一條列項之前會有一文字或符號標籤(label)。在itemize 與enumerate 指令環境下,
條列項之標籤有內定之符號,但也可以自行設定。description 指令環境之標籤則由使用者自行輸入。
- 每個條列項底下可以再放一層,最多可放六層。
(1) 行距設定-項目與項目間的距離 :
在begin{itemize}使用\itemsep 調整 -1pt即縮小1pt,1pt則增加1pt.
(2) 調整enumerate數字清單的編號
參考文件: The enumerate package documentation
預設的第一層是阿拉拍數字, 第二層是(a),(b),(c)
\documentclass{article} \usepackage{enumerate} \begin{document} \begin{enumerate} \item This is an example of \ldots \item \ldots the usual enumeration. \begin{enumerate}[a)] \item And this is a \ldots \item \ldots couple of \ldots \end{enumerate} \item \begin{enumerate}[-- i --] \item \ldots examples of \ldots \item \ldots custom-tailored \ldots \item \ldots enumerations. \newcounter{enumii_saved} \setcounter{enumii_saved}{\value{enumii}} \end{enumerate} Some general comments \begin{enumerate}[-- i --] \setcounter{enumii}{\value{enumii_saved}}
如果要換另一個條列式項目, 但編號接續, 使用\newcounter{enumii_saved}來操作
\item My next point. \setcounter{enumii}{7}
使用setcounter{enumii}{數字}來指定編號號碼
\item My eighth point. \end{enumerate} \end{enumerate} \end{document}
(3) enumerate也可以在全文指令環境中調整預設值: 層、標籤格式
表示條列的層:\labelitemi 與 \labelitemii
前者代表最外層之item指令環境;後者代表次一層之指令環境。再下一層之指令則為\labelitemiii..
此一指令環境之標籤是以阿拉伯數字或英文字母依序標出,控制指令有: \arabic, \roman, \Roman,與\Alph。譬如,
\renewcommand{\labelenumi}{\arabic{enumi})}
將把指令環境最外層之標籤改變成1), 2), . . .之形式。同理,下列指令則把標籤變成大寫羅馬字: I., II., . . . 。
\renewcommand{\labelenumi}{\Roman{enumi}}
(4) 設定每一層列舉條文的內縮距離
第一層列舉項之內 縮距離是以\leftmargini 控制,
最後的字母i 代表第一層; 第二層列舉項則以\leftmarginii 控制
用法
在\begin{itemize}之前 先下兩行,表示第一層內縮7mm,第2層縮6mm
\leftmargini=7mm
\leftmarginii=6mm
[轉] http://www.cnblogs.com/dearjustine/archive/2010/04/05/1704508.html
-------------------------------
LaTeX/列表
枚舉、列舉和描述
\begin{list_type} \item The first item \item The second item \item The third etc \ldots \end{list_type}
默認的 list_type 有 enumerate、 itemize 和 description,區別主要是列項標簽的不同。enumerate 是有序的列表;itemize 用圓點;description 需要 \item[label] 指定標簽。各種列表環境可以互相嵌套,此時,enuemrate 的標簽會自動變化以體現分級層次。
如果不想讓列項第一行和標簽同行,加一個 \hfill。
\begin{description} \item[First] \hfill \\ The first item \item[Second] \hfill \\ The second item \item[Third] \hfill \\ The third etc \ldots \end{description}
緊湊的列表
以上的列表環境空白較大,如果需要更緊湊的列表方式,可以選用 mdwlist 宏包提供的 itemize*、enumerate* 和 description* 環境,用法和無星號的版本一致。
定制列表環境
距離
在列表的內部,很容易改變一些距離
\begin{itemize} \setlength{\itemsep}{1pt} \setlength{\parskip}{0pt} \setlength{\parsep}{0pt} \item first item \item second item \end{itemize}
更詳細的參數需要看下面 list 環境。
標簽和計數器
枚舉的列表計數可以通過其計數器來改變。enumerate 提供了四個計數器 enumi,enumii,enumiii, enumiv 對應不同層次的枚舉。
\begin{enumerate} \setcounter{enumi}{4} \item fifth element \end{enumerate}
會產生
5. fifth element
LaTeX 可以用其他格式打印這些計數器的值,
命令 | 例子 |
---|---|
\arabic | 1, 2, 3 ... |
\alph | a, b, c ... |
\Alph | A, B, C ... |
\roman | i, ii, iii ... |
\Roman | I, II, III ... |
\fnsymbol | 星號,單劍號,雙劍號等 |
% 重定義第一級計數顯示 \renewcommand{\theenumi}{\Roman{enumi}} \renewcommand{\labelenumi}{\theenumi} % 重定義第二級計數顯示 \renewcommand{\theenumii}{\Alph{enumii}} \renewcommand{\labelenumii}{(\theenumii)}
這樣看起來有些麻煩。有時候直接寫
\renewcommand{\labelenumi}{\Roman{enumi}}
但是這樣有一個缺點:如果在列表內部引用這些計數器,就會按原來的格式打印。
對列舉 itemize 而言,無須計數。標簽的形式可以通過 \item[label] 來改變。或者通過各級 \labelitemi,\labelitemii,\labelitemiii,\labelitemiv。所以
\item[$\star$]
等價於
\renewcommand{\labelitemi}{$\star$}
enumerate 宏包
enumerate 宏包為 enumerate 提供了更靈活的標簽。可以使用 A,a,I,i,1 作為可選項產生 \Alph,\alph,\Roman,\roman,\arabic 的效果。
usepackage{enumerate} ...... \begin{enumerate}[(i)] \item The first item \item The second item \item The third etc \ldots \end{enumerate}
行內列表
paralist 宏包提供了 inparaenum 環境,產生不分段的列表。同樣支持跟上面 enumerate 宏包類似的格式化標簽。
\usepackage{paralist} ...... \textbf{\itshape Inline lists}, which are sequential in nature, just like enumerated lists, but are \begin{inparaenum}[\itshape a\upshape)] \item formatted within their paragraph; \item usually labelled with letters; and \item usually have the final item prefixed with `and' or `or', \end{inparaenum} like this example.
list 環境
最有可定制性的當屬 list 環境。以上的 enumerate, itemize,description 其本質上都是封裝好的 list 環境。
\begin{list}{label}{spacing} \item First item \item Second item \end{list}
其中, label 的內容將會作為標簽,放在一個單獨的盒子里,出現在每一 item 之前。也可以通過 \item[label] 來實現。
spacing 設定一些距離。通常為空,因為默認距離已經足夠好了。
- \topsep 列表頂部與之前內容的額外空白,不含 \baselineskip
- \partopsep 如果列表之前是一個空行,列表頂部的額外空白
- \itemsep 列表各項之間額外的垂直空白
- \parsep 一個 item 中,如果分段,段落間額外空白
- \leftmargin 列表與左邊距之間的水平距離,值為非負
- \rightmargin 列表與右邊距之間的水平距離,值為非負
- \itemindent 每一 item 第一行的縮進
- \listparindent 每一 item 第一行之后各行的縮進
- \labelsep 標簽盒子與每一 item 第一行文本之間距離
- \labelwidth 標簽盒子的寬度;如果標簽過長,這一寬度會自動變大,直到列表的第一行文本為止
- \makelabel{label} 生成 \item[label] 命令所要求的標簽
- \usecounter{ctr} 使用列表項目計數器 ctr,初始值為 0
一個例子
% 定義計數器 \newcounter{Lcount} % 標簽計數顯示為羅馬數字 \begin{list}{Item-\Roman{Lcount}} % 使用計數器 {\usecounter{Lcount} % 左右對稱 \setlength{\rightmargin}{\leftmargin}} % 開始 \item This is the first item \item And this is the second item \end{list}
效果將是
Item-I This is the first item Item-II And this is the second item
[轉] http://blog.chinaunix.net/uid-778728-id-2043822.html