How do I suppress the table of contents?

Skip to first unread message


Jun 9, 2009, 8:41:28 AM6/9/09
to asciidoc
I would like to write a very short document with asciidoc, published
as PDF via FOP.

My problem is that the resulting PDF always has a table of contents
under the title, which doen't look good on such a short document (2
pages max). How can I avoid the generation of this table of contents?

Thanks in advance,



Jun 10, 2009, 7:42:02 PM6/10/09
to asciidoc
This can be done with some customization of the XSL stylesheets. The
generation of the TOC is not a function of AsciiDoc but the DocBook

The docbook-XSL parameter generate.toc controls what gets a toc and
what not. Here is the documentation and some examples:

To turn it of for articles include this to your stylesheet:

<xsl:param name="generate.toc" select="'article nop'"/>

As an example I added some customation to my XSL stylesheets to
include a TOC in articles only if the macro :toc: is present in the
AsciiDoc document.

How can this be done? Here is the recipe:

1) Add this to your XSL stylesheet:

<xsl:param name="generate.toc">
<xsl:when test="/article/articleinfo/processing-instruction
/article toc,title
/article nop

2) Add this to the [header] section of asciidoc.conf after the
<copyright>...</copyright> tags:


What 2) does is it inserts a custom processing instruction if the toc
macro is defined. The stylesheet in 1) checks for the presence of the
inserttoc processing instruction and inserts a toc or not.

Stuart Rackham

Jun 13, 2009, 7:29:48 PM6/13/09
Thanks Henrik, I've patched the trunk with your code:

If you have a moment could you review the changes.

Cheers, Stuart
Reply all
Reply to author
0 new messages