domenica 22 gennaio 2012

About Itemized Lists

Before tackling the subject of fonts (which will require more than one post, I think), let's talk about itemized lists.

From time to time, the need for an itemized lists (or a hierarchical list) will arise: for instance, when describing some subprocedure during character creation, or explaining the combat sequence, or if you want to remark some important points in your book.

When this time comes, you will need a way to format informations like this:

  1. First info
  2. Sec ond info
  3. Third info

or this way:

  • First info
  • Second info
  • Third info

ConTeXt comes with a plethora of itemization commands whose behaviors is not unlike those found in HTML <ol> or <ul> tags. That is, you start an itemization environment, you mark individual items using the appropriate command and when you're finished close the itemization environment. This is how the itemization commands look like:

\startitemize[setups]
\item ...
\item ...
\item ...
\stopitemize

This is an actual example:

\starttext

\subsubject{Itemization Sample}

These are some notable Lovecraftian creatures:

\startitemize[1,packed]

\item Shoggoths

\item Shantaks

\item Fungi from Yuggoth

\item Deep Ones

\stopitemize

\stoptext

You surely will have noticed the odd parameters after \startitemize. These parameters determine how the list will look. The first argument defines the item marker, as per the table below:

Argument Type
1 a black dot
2 -
3 *
n 1,2,3...
a a, b, c, ...
A A, B, C, ...
r i, ii, iii, ...
R I, II, III, ...

You can also define your own item marker, but as an exercise, it is up to you to find out how you can do it. :-)

If you want to have an header on your item, you must use \head instead of \item

. You separate the header text from the item text by inserting an empty blank line after the header text. For instance:

\startitemize[R]

\head Shoggoths

Mad arab Abdul Al-Alhzraed tried to deny their very existence. They usually dwell in Antarctica

\head Shantaks

Flying beasts not unlike huge lizards

\head Fungi from Yuggoth

These insects come from Pluto.

\head Deep Ones

Immortal amphibious beings worshipping Father Dagon and Mother Hydra

\stopitemize

This will yield a numbered list with Roman numerals, on which the first line will be an head. You will notice that header is formatted the same way as normal text. However, there is a way to tell ConTeXt how to format headers in itemization environments: We must use \setupitemize[each][headstyle=bold] to get a bold header.

If we look at the first example, we will notice the presence of a second parameter (packed) in the \startitemize command. This parameter governs how the list will be set up: These are:

standard The default setup
packed No vertical spacing between items
serried No horizontal spacing between separator and text
joinedup No vertical spacing between separator and text
broad horizontal spacing between separator and text
inmargin Place item marker in margin
atmargin Place item marker on margin
stopper Place full stop after separator
columns Place items in columns
intro Prevent page breaking after introdution line
continue Continue numbering or lettering

 

Columns is used in conjunction with a number expressed in letter. the command \startitemized[n,columns,three] will arrange items in three columns.

Nesting lists

Itemized lists can be nested. This way, we can have something typeset this way:

\startitemize[1]

\head Lesser creatures

      Lesser Mythos creatures are those that characters will encounter most often
   during their adventures. These include:
   
   \startitemize[n,columns,three]
   
   \item Ghouls
   \item Deep Ones
   \item Byhakees
   \item Fungi from Yuggoth
   \item Cultists
   \item Sand Dwellers
   \item Serpent People
   
   \stopitemize

\head Great Old Ones

Even if characters survive, they might not be resilient enough to escape from the wrath of:

\startitemize[r,columns, four]

\item Shudde M'Ell
\item Nyoghta
\item Ghathanotoa
\item Shub-Niggurath
\item Cthulhu itself 
\item and, obviously, Nyarlatothep, the Crawling Chaos.

\stopitemize

A word of warning when using columns: please, refrain from putting long text in item body. Results won't be pleasant at all, and if you want to format long paragraph columns in a semi-tabular fashion you'd better use Tables or using Paragraph Definition, topic we will tackle in future posts.

You can download a .tex file with some list samples from here

Nessun commento:

Posta un commento