zoukankan      html  css  js  c++  java
  • latex列表

    枚举、列举和描述

    egin{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。

    egin{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* 环境,用法和无星号的版本一致。
    定制列表环境
    距离

    在列表的内部,很容易改变一些距离

    egin{itemize}
     setlength{itemsep}{1pt}
     setlength{parskip}{0pt}
     setlength{parsep}{0pt}
     item first item
     item second item
    end{itemize}

    更详细的参数需要看下面 list 环境。
    标签和计数器

    枚举的列表计数可以通过其计数器来改变。enumerate 提供了四个计数器 enumi,enumii,enumiii, enumiv 对应不同层次的枚举。

    egin{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 ...
    oman     i, ii, iii ...
    Roman     I, II, III ...
    fnsymbol     星号,单剑号,双剑号等

    % 重定义第一级计数显示
    enewcommand{ heenumi}{Roman{enumi}}
    enewcommand{labelenumi}{ heenumi}

    % 重定义第二级计数显示
    enewcommand{ heenumii}{Alph{enumii}}
    enewcommand{labelenumii}{( heenumii)}

    这样看起来有些麻烦。有时候直接写

    enewcommand{labelenumi}{Roman{enumi}}

    但是这样有一个缺点:如果在列表内部引用这些计数器,就会按原来的格式打印。

    对列举 itemize 而言,无须计数。标签的形式可以通过 item[label] 来改变。或者通过各级 labelitemi,labelitemii,labelitemiii,labelitemiv。所以

    item[$star$]

    等价于

    enewcommand{labelitemi}{$star$}

    enumerate 宏包

    enumerate 宏包为 enumerate 提供了更灵活的标签。可以使用 A,a,I,i,1 作为可选项产生 Alph,alph,Roman, oman,arabic 的效果。

    usepackage{enumerate}
    ......
    egin{enumerate}[(i)]
     item The first item
     item The second item
     item The third etc ldots
    end{enumerate}

    行内列表

    paralist 宏包提供了 inparaenum 环境,产生不分段的列表。同样支持跟上面 enumerate 宏包类似的格式化标签。

    usepackage{paralist}
     ......
    extbf{itshape Inline lists}, which are  sequential in nature, just like enumerated lists, but are
    egin{inparaenum}[itshape aupshape)]
     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 环境。

    egin{list}{label}{spacing}
     item First item
     item Second item
     end{list}

    其中, label 的内容将会作为标签,放在一个单独的盒子里,出现在每一 item 之前。也可以通过 item[label] 来实现。

    spacing 设定一些距离。通常为空,因为默认距离已经足够好了。

        * opsep 列表顶部与之前内容的额外空白,不含 aselineskip
        * partopsep 如果列表之前是一个空行,列表顶部的额外空白
        * itemsep 列表各项之间额外的垂直空白
        * parsep 一个 item 中,如果分段,段落间额外空白
        * leftmargin 列表与左边距之间的水平距离,值为非负
        * ightmargin 列表与右边距之间的水平距离,值为非负
        * itemindent 每一 item 第一行的缩进
        * listparindent 每一 item 第一行之后各行的缩进
        * labelsep 标签盒子与每一 item 第一行文本之间距离
        * labelwidth 标签盒子的宽度;如果标签过长,这一宽度会自动变大,直到列表的第一行文本为止
        * makelabel{label} 生成 item[label] 命令所要求的标签
        * usecounter{ctr} 使用列表项目计数器 ctr,初始值为 0

    一个例子

    %    定义计数器
    ewcounter{Lcount}
    %   标签计数显示为罗马数字
    egin{list}{Item-Roman{Lcount}}
    %    使用计数器
      {usecounter{Lcount}
    %    左右对称
      setlength{ ightmargin}{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


    枚举、列举和描述

    egin{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。

    egin{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* 环境,用法和无星号的版本一致。

    定制列表环境

    距离

    在列表的内部,很容易改变一些距离

    egin{itemize} setlength{itemsep}{1pt} setlength{parskip}{0pt} setlength{parsep}{0pt} item first item item second item end{itemize}

    更详细的参数需要看下面 list 环境

    标签和计数器

    枚举的列表计数可以通过其计数器来改变。enumerate 提供了四个计数器 enumi,enumii,enumiii, enumiv 对应不同层次的枚举。

    egin{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 ...
    oman i, ii, iii ...
    Roman I, II, III ...
    fnsymbol 星号,单剑号,双剑号等
    % 重定义第一级计数显示 
    enewcommand{	heenumi}{Roman{enumi}} 
    enewcommand{labelenumi}{	heenumi} % 重定义第二级计数显示 
    enewcommand{	heenumii}{Alph{enumii}} 
    enewcommand{labelenumii}{(	heenumii)}

    这样看起来有些麻烦。有时候直接写

    enewcommand{labelenumi}{Roman{enumi}}

    但是这样有一个缺点:如果在列表内部引用这些计数器,就会按原来的格式打印。

    对列举 itemize 而言,无须计数。标签的形式可以通过 item[label] 来改变。或者通过各级 labelitemi,labelitemii,labelitemiii,labelitemiv。所以

    item[$star$]

    等价于

    enewcommand{labelitemi}{$star$}

    enumerate 宏包

    enumerate 宏包为 enumerate 提供了更灵活的标签。可以使用 A,a,I,i,1 作为可选项产生 Alph,alph,Roman, oman,arabic 的效果。

    usepackage{enumerate} ...... egin{enumerate}[(i)] item The first item item The second item item The third etc ldots end{enumerate}

    行内列表

    paralist 宏包提供了 inparaenum 环境,产生不分段的列表。同样支持跟上面 enumerate 宏包类似的格式化标签。

    usepackage{paralist} ...... 	extbf{itshape Inline lists}, which are sequential in nature, just like enumerated lists, but are egin{inparaenum}[itshape aupshape)] 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 环境。

    egin{list}{label}{spacing} item First item item Second item end{list}

    其中, label 的内容将会作为标签,放在一个单独的盒子里,出现在每一 item 之前。也可以通过 item[label] 来实现。

    spacing 设定一些距离。通常为空,因为默认距离已经足够好了。

    • opsep 列表顶部与之前内容的额外空白,不含 aselineskip
    • partopsep 如果列表之前是一个空行,列表顶部的额外空白
    • itemsep 列表各项之间额外的垂直空白
    • parsep 一个 item 中,如果分段,段落间额外空白
    • leftmargin 列表与左边距之间的水平距离,值为非负
    • ightmargin 列表与右边距之间的水平距离,值为非负
    • itemindent 每一 item 第一行的缩进
    • listparindent 每一 item 第一行之后各行的缩进
    • labelsep 标签盒子与每一 item 第一行文本之间距离
    • labelwidth 标签盒子的宽度;如果标签过长,这一宽度会自动变大,直到列表的第一行文本为止
    • makelabel{label} 生成 item[label] 命令所要求的标签
    • usecounter{ctr} 使用列表项目计数器 ctr,初始值为 0

    一个例子

    % 定义计数器 
    ewcounter{Lcount} % 标签计数显示为罗马数字 egin{list}{Item-Roman{Lcount}} % 使用计数器 {usecounter{Lcount} % 左右对称 setlength{
    ightmargin}{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
  • 相关阅读:
    php-管理变量
    php-变量的间接引用
    php-eval()
    HTML
    php观
    笔记1
    脚本语言
    Windows Server 2012如何把快捷方式加到启动文件夹中
    VIM的笔记
    mongodb 从3.0 升级到3.2
  • 原文地址:https://www.cnblogs.com/aoublog/p/4555783.html
Copyright © 2011-2022 走看看