zoukankan      html  css  js  c++  java
  • latex listing

    List are basic elements in a document, when used correctly they keep concepts organized and structured. This article explains how to create and modify numbered and unnumbered lists in LaTeX.

    Introduction

    Lists are actually very simple to create.

     

    List are really easy to create
    
    egin{itemize}
      item One entry in the list
      item Another entry in the list
    end{itemize}
    

    To create a (unordered) list you have to declare the itemize environment and then put the entries inside.

    Unordered lists

    The unordered (unnumbered) lists are produced by the itemize environment. Each entry must be preceded by the control sequence item.

     

    egin{itemize}
      item The individual entries are indicated with a black dot, a so-called bullet.
      item The text in the entries may be of any length.
    end{itemize}
    

    By default the individual entries are indicated with a black dot, so-called bullet. The text in the entries may be of any length.

    Ordered lists

    Ordered list have the same syntax inside a different environment:

     

    egin{enumerate}
      item The labels consists of sequential numbers.
      item The numbers starts at 1 with every call to the enumerate environment.
    end{enumerate}
    

    The ordered lists are generated by a enumerate environment and each entry must be preceded by the control sequence item, which will automatically generate the number labelling the item. The enumerate labels consists of sequential numbers, these numbers starts at 1 with every call to the enumerate environment.

    Nested Lists

    In LaTeX you can insert a list inside another list. The above lists may be included within one another, either mixed or of one type, to a depth of four levels.

    egin{enumerate}
       item The labels consists of sequential numbers.
       egin{itemize}
         item The individual entries are indicated with a black dot, a so-called bullet.
         item The text in the entries may be of any length.
       end{itemize}
       item The numbers starts at 1 with every call to the enumerate environment.
    end{enumerate}
    

    List styles

    As many other LaTeX elements, unordered and ordered list styles can be personalized.

    Ordered lists

    The numbering styles change depending on the depth of the nested lists:

     egin{enumerate}
       item First level item
       item First level item
       egin{enumerate}
         item Second level item
         item Second level item
         egin{enumerate}
           item Third level item
           item Third level item
           egin{enumerate}
             item Fourth level item
             item Fourth level item
           end{enumerate}
         end{enumerate}
       end{enumerate}
     end{enumerate}
    

    The default numbering scheme is:

    • Arabic number (1, 2, 3, ...) for Level 1
    • Lowercase letter (a, b, c, ...) for Level 2
    • Lowercase Roman numeral (i, ii, iii, ...) for Level 3
    • Uppercase letter (A, B, C, ...) for Level 4.

    These numbers can be changed by redefining the commands that typeset the numbers of various list levels. For example:

     

     
    enewcommand{labelenumii}{Roman{enumii}}
     egin{enumerate}
       item First level item
       item First level item
       egin{enumerate}
         item Second level item
         item Second level item
         egin{enumerate}
           item Third level item
           item Third level item
           egin{enumerate}
             item Fourth level item
             item Fourth level item
           end{enumerate}
         end{enumerate}
     end{enumerate}
     end{enumerate}
    

    The command enewcommand{labelenumii}{Roman{enumii}} changes the second level to upper case Roman numeral. It is possible to change the labels of any level, replace labelenumii for one of the listed below.

    • heenumi for Level 1
    • heenumii for Level 2
    • heenumiii for Level 3
    • heenumiv for Level 4


    The command must be placed in the preamble to change the labels globally or right before egin{enumerate} to change labels only in this list. There are some other styles, see the reference guide for a complete list.

    In numbered lists the counter is incremented by item before it is printed, and starts from 1,a,i,A,I. This can be changed:

     

     
    enewcommand{labelenumii}{Roman{enumii}}
     egin{enumerate}
       item First level item
       item First level item
       egin{enumerate}
         setcounter{enumii}{4}
         item Second level item
         item Second level item
           egin{enumerate}
           item Third level item
           item Third level item
             egin{enumerate}
             item Fourth level item
             item Fourth level item
           end{enumerate}
         end{enumerate}
       end{enumerate}
     end{enumerate}
    

    To change the start number or letter you must use the setcounter command. In the example, to change the start number of level 2 to V the command setcounter{enumii}{4} was used.

    To set the start number to any other counter change enumii for any of these:

    • enumi for Level 1
    • enumii for Level 2
    • enumiii for Level 3
    • enumiv for Level 4

    Unordered lists

    The label scheme of unordered lists also changes depending on the depth of the nested list:

     egin{itemize}
       item  First Level
       egin{itemize}
         item  Second Level
         egin{itemize}
           item  Third Level
           egin{itemize}
             item  Fourth Level
           end{itemize}
         end{itemize}
       end{itemize}
     end{itemize}
    

    The default label scheme for itemized lists is:

    • Level 1 is extbullet (•),
    • Level 2 is extendash (–) ,
    • Level 3 is extasteriskcentered (*)
    • Level 4 is extperiodcentered (·).


    These labels can be changed by redefining the commands that typeset them for various list levels. For example, to change Level 1 to black square and Level 2 to white square we'll use :

     
    enewcommand{labelitemi}{$lacksquare$}
     
    enewcommandlabelitemii{$square$}
     egin{itemize}
       item  First Level
       egin{itemize}
         item  Second Level
         egin{itemize}
           item  Third Level
           egin{itemize}
             item  Fourth Level
           end{itemize}
         end{itemize}
       end{itemize}
     end{itemize}
    

    The mathematical symbols used in the previous example belong to the amssymb package, so you have to add usepackage{amssymb} to your preamble.

    To redefine the label use one of the next commands, depending on the level of list mark you intend to change:

    • labelitemi for Level 1
    • labelitemii for Level 2
    • labelitemiii for Level 3
    • labelitemiv for Level 4

    You can also change the item label for a specific entry, for example:

    egin{itemize}
      item  Default item label for entry one
      item  Default item label for entry two
      item[$square$]  Custom item label for entry three
    end{itemize}
    

    All you have to do is pass the desired mark as a parameter inside brackets to the item line.

    https://www.overleaf.com/learn/latex/Lists

    Reference guide

    Available styles for numbered lists:

    CodeDescription
    alph Lowercase letter (a, b, c, ...)
    Alph Uppercase letter (A, B, C, ...)
    arabic Arabic number (1, 2, 3, ...)
    oman Lowercase Roman numeral (i, ii, iii, ...)
    Roman Uppercase Roman numeral (I, II, III, ...)
  • 相关阅读:
    poj2528 Mayor's posters(线段树区间修改+特殊离散化)
    codeforces 733D Kostya the Sculptor(贪心)
    codeforces 733C Epidemic in Monstropolis
    poj 2828--Buy Tickets(线段树)
    lightoj 1125
    HDU 2795 Billboard (线段树)
    hdu 5945 Fxx and game(dp+单调队列! bc#89)
    poj3666 Making the Grade(基础dp + 离散化)
    codeforces 652D
    lightoj 1140
  • 原文地址:https://www.cnblogs.com/Searchor/p/14183929.html
Copyright © 2011-2022 走看看