Difference between revisions of "Lists and sub-lists - PGML"

From WeBWorK_wiki
Jump to navigation Jump to search
(Initial version)
 
m (Add categories)
 
Line 149: Line 149:
 
 
 
2. This is the next item in the same list.
 
2. This is the next item in the same list.
  +
  +
[[Category:PGML]]
  +
[[Category:PGML Syntax]]

Latest revision as of 12:29, 9 May 2015

Bullet Lists

To create a bullet list, start each item with an asterisk or dash followed by a space.

 This is a list:
 * Item 1
 * Item 2
 
 This is a second list:
 - Item 1
 - item 2

You can get different shapes for the bullet by using a plus rather than an asterisk to get square bullets, and an "o" to get open bullets.

 + Item 1 with square bullets
 + Item 2 with square bullets
 
 o Item 1 with open bullets
 o item 2 with open bullets

Numbered Lists

To produce a numbered list, start each item with a number followed by a period and a space.

 This is a numbered list:
 1. Item 1
 2. Item 2

The actual number used doesn't matter; PGML will start the numbering at 1 and increment by 1 for each item. So

 8. Item A
 1. Item B
 3. Item C

still produces

  1. Item A
  2. Item B
  3. Item C

Alphabetic Lists

To create an alphabetic list, start each item with a letter followed by a period or close parenthesis followed by a space.

 This is a list with alphabetic labels:
 a) Item 1
 b) Item 2
 
 Or
 
 a. Item 1
 b. Item 2

If you use upper-case letters, the labels will be in upper case.

 A) Item 1
 B) Item 2

As with numeric lists, it doesn't matter what letters you actually use, so

 a. Item 1
 a. Item 2
 a. Item 3

produces a list with labels "a", "b", and "c".

Roman Numerals

To get a list with Roman numerals, start each item with a roman numeral follow by a period or close parenthesis and a space.

 i. Item 1
 ii. Item 2
 iii. Item 3
 iv. Item 4

As with numeric and alphabetic lists, it doesn't matter what Roman numerals you use, so

 i. Item 1
 i. Item 2
 i. Item 3
 i. Item 4

will generate the same result as the previous list.

To get upper-case Roman numerals, use upper-case letters.

 I. Item 1
 II. Item 2

Sub-Lists

To get a list within a list, simply indent the inner list with four spaces.

 1.  An item with a sub-list
     - Bullet item 1
     - Bullet item 2
 2.  Back to the numbered list

List and indentation

If an item runs longer than a line, you can indent the second and following lines to make it easier to read.

 * An item that runs over
   several lines can be indented.
 * But it doesn't have to be,
 so this is still part of the second
 bullet item.

Lists and Paragraphs

You can put blank lines between the items to get them separated by paragraph breaks.

 * Item 1
 
 * Item 2, with a separation between them

To end a list, start a new unindented paragraph.

 This is a list
 1. Item A
 2. Item B
 
 This is a new paragraph.

Note, however, that

 This is a list
 1. Item A
 2. Item B
 
 1. Item C

does not start a new list, it produces a three-item list (numbered 1, 2, and 3) with a paragraph break between the second and this items. In order to start a new list without an intervening paragraph, end the last line of the first list with three spaces (marked as underscores below):

 This is a list
 1. Item A
 2. Item B___
 
 1. Item C

produces two numbered lists, the first with two items and the second with one.

If a list item consists of more than one paragraph, put four spaces at the beginning of the second paragraph. That will keep the paragraph with the previous list item.

 1.  This is an item with two paragraphs
 
     This is the item's second paragraph (it doesn't end the list).
 
 2.  This is the next item in the same list.