Your support for our advertisers helps cover the cost of hosting, research, and maintenance of this document

Formatting Information — An introduction to typesetting with LATEX

Chapter 7: Programmability

Section 7.6: Reprogramming LATEX’s internals

In this section…

  1. Changing list item bullets

LATEX’s internal macros can also be reprogrammed or even rewritten entirely, although doing this can require a considerable degree of expertise. Simple changes, however, are easily done.

Recall that LATEX’s default document structure for the Report document class uses Chapters as the main unit of text, whereas in reality most reports are divided into Sections, not Chapters (the footnote ‘It is arguable that chapters also …’). The result of this is that if you start off your report with \section{Introduction}, it will print as

0.1  Introduction

which is not at all what you want. The zero is the (missing) chapter number, because no chapter has been started. But this numbering is controlled by macros, and you can redefine them. In the footnote ‘In fact, any time you define …’ we said that every counter automatically gets a related command beginning with ‘the’. In this case what we need to change is that command \thesection because the way the counters are set up makes it reproduce the value of the counter section (see the last para ‘This would make the outermost list …’ in § 4.1) plus any higher-level value (eg chapter). It’s redefined afresh in each document class file, using the command \renewcommand (in this case in report.cls):


You can see it invokes \thechapter (which is defined elsewhere to reproduce the value of the chapter counter), and it then prints a dot, followed by the Arabic value of the counter called section (that \c@ notation is LATEX’s internal way of referring to counters). You can redefine this in your Preamble to simply leave out the reference to chapters:


I’ve used the more formal modern method of enclosing the command being redefined in curly braces. For largely irrelevant historical reasons these braces are often omitted in LATEX’s internal code (as you may have noticed in the example earlier). And I’ve also used the ‘public’ version of the \arabic command to output the value of section (LATEX’s internals use a ‘private’ set of control sequences containing @-signs, designed to protect them against being changed accidentally).

Now the introduction to your report will start with:

1  Introduction

What’s important in making this type of modification is that you DO NOT alter the original document class file report.cls (ever): you just copy the command you need to change into your own document Preamble, or a private package file, and modify that instead. It will then override the default because it will get loaded after the document class.

7.6.1 Changing list item bullets

As mentioned earlier, here’s how to redefine a bullet for an itemized list, with a slight tweak:


Here we use the bbding package which has a large selection of ‘dingbats’ or little icons, and we change the label for top-level itemized lists (\labelitemi, find these in any document class file) to make it print a right-pointing pencil (the names for the icons are in the bbding package documentation: see § 3.1.3 for how to get it).

In this case, we are also using the \raisebox command within the redefinition because it turns out that the symbols in this font are positioned slightly too high for the typeface we’re using. The \raisebox command takes two arguments: the first is a dimension, how much to raise the object by (and a negative value means ‘lower’: there is no need for a separate \lowerbox command); and the second is the text you want to affect. Here, we are shifting the symbol down by ¼ex (see § 1.9.1 for a list of dimensional units LATEX can use).

There are label item commands for each level of lists (1–4) which have command names ending in Roman numerals (i–iv) because of the rule that command names can only use letters. Thus to change the icon for the fourth-level list, modify \labelitemiv. There is a vast number of symbols available: see ‘A comprehensive list of symbols in TEX for a comprehensive list.