At Taodyne, we mostly use Apple Pages to create our documents. For large documents, I’d like to be able to create numbered chapters, something like “Chapter 1″, “Chapter 2″, and so on. Apple Pages does not seem to have that feature. Let’s not get used to it, and let’s fix it.
Apple Pages can read numbered chapters from Word
One thing that I observed is that when you read a Microsoft Word document that contains numbered chapters, Apple Pages preserves that formatting. In other words, if the user interface may not know how to edit numbered lists with text in them, the rendering engine knows how to render them, and the regular editing within Pages will correctly renumber these documents.
To verify that my recollection of this capability of Pages was correct, I first created a document in Microsoft Word that looks like this:
Section 1 – Hello
Chapter 1 – This is a chapter
I. This is a numbered section
1. This is a numbered sub-section
It doesn’t just “look like” this. The Section and Chapter text were edited in the Numbering section of Microsoft Word, so this is auto-numbering.
Then I saved this document to disk, and imported it into Pages. And indeed, when I edit it in Pages, numbering works just like in Microsoft Word.
The Pages XML format
Let’s look inside the document to see what’s there. A quick tour through the command line shows that Apple Pages documents are really zipped collections of files, including XML files representing the document itself:
% unzip Hello.pages Archive: Hello.pages extracting: thumbs/PageCapThumbV2-1.tiff extracting: QuickLook/Thumbnail.jpg extracting: QuickLook/Preview.pdf extracting: buildVersionHistory.plist inflating: index.xml
The most interesting of these documents is the index.xml file. It contains the actual description of the document in XML format. And if I look inside, I see something interesting:
<sf:list-label-typeinfo sf:type="text"><sf:text-label sf:type="decimal" sf:format="Section %L -" sf:first="1"/>
So this sf:format= accepts a rather general format, with %L serving as the marker for where the number should go.
The solution for adding chapter numbers
So the solution for adding chapter numbers is simple:
- Once, you will need Microsoft Word to create a document that has the kind of chapter numbering that you need. You may have multiple levels of numbering (e.g. chapter, section, etc).
- Import this document in Pages. This will give you a new list style.
- When you want to number chapters, select the given list style.
- To edit the formatting of the numbering text, select the whole line, change colors or fonts, and in the list style, select “Redefine style for selection”. In other words, the list style defines the font and color for the numbering independently from the paragraph style, and can do that for multiple levels.
Now, you have proper chapter numbering in Apple Pages.