Table Of Contents (TOC) example This demonstrates the fast way to generate a table of contents. The table of contents below is generated dynamically. We reserve a fixed size box to hold the TOC below (6x3 inches in this case), and use a deferred form to draw it. If you can safely estimate the maximum size of the TOC (and if it fits on one page), this lets you generate one in a single formatting pass. If the TOC might span pages, then don't do the deferred form; just put the TOC table inline within the document, using namedString and getName. RML will automatically do multiple passes over the document (usually 2 but it can be 3) until all cross references are resolved accurately. We also did some cunning trickery with the page numbers to make the second page show 'page 1' - see the source. You can do basic page number maths to number sections distinctly. Chapter 1: About this page Chapter 1 -+1 About these pages: the code behind this pdf should give an example of how to set up a table of contents. You'll see the form for the table of contents (headed 'form name="TOC"') is defined at the end of the code. The two most important tags and the (ones that must match here)are namedString id="label3" and the related getName id="label3". The first sets a value for the contents page number, the second retrieves it. Ignore the following pseudo-bio babble, it's there for padding Politics of Foramenifera Globorotalia Menardii coils according to water temperature and prevailing political situations. Preferring alkaline rather than acidic environments they are however intuitively left-wing Drosophila Melanogaster How fruit flies changed my life. Blah blah waffle waffle blah blah yawn yawn ....................................... CHAPTER2 Chapter 2 -+1 Politics of Foramenifera Globorotalia Menardii coils according to water temperature and prevailing political situations. Preferring alkaline rather than acidic environments they are intuitively left-wing Drosophila Melanogaster How fruit flies changed my life. Blah blah waffle waffle blah blah yawn yawn ....................................... image45.gif CHAPTER3 Chapter3 -+1 Acrocladium Cuspidatum A meaningful relationship with Moss Rattus rattus So bad they named him twice Blah blah waffle waffle blah blah yawn yawn ....................................... more rubbish about ratty and so forth ....................................... image67.gif CHAPTER4 Chapter4 -+1 Namby Pamby Lilac scented satin trousers Ganesh the elephant god dances on heads with Kali So bad they named him thrice Blah blah waffle waffle blah blah yawn yawn ....................................... Last Chapter Last Chapter -+1 Blah blah waffle waffle blah blah yawn yawn....................................... Blah blah waffle waffle blah blah yawn yawn....................................... Blah blah waffle waffle blah blah yawn yawn.......................................
Table of Contents - - - - -