Unable to get Table of Contents working from command line

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Unable to get Table of Contents working from command line

wimdeblauwe
Hello,

I am unable to add a table of contents (toc) to my HTML nor PDF output. I am using the following versions:

> asciidoctor -v
Asciidoctor 1.5.6 [http://asciidoctor.org]
Runtime Environment (ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]) (lc:US-ASCII fs:US-ASCII in:- ex:US-ASCII)

> asciidoctor-pdf -v
Asciidoctor PDF 1.5.0.alpha.15 using Asciidoctor 1.5.6 [http://asciidoctor.org]
Runtime Environment (ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]) (lc:US-ASCII fs:US-ASCII in:- ex:US-ASCII)

In my document, I have added ":toc:", like this:

```
= Title of my document

:pdf-page-size: A4
:toc:
:toclevels: 2
:numbered:
```

But no table of contents is shown in the output
Reply | Threaded
Open this post in threaded view
|

Re: Unable to get Table of Contents working from command line

mojavelinux
Administrator
You have a blank line after the document title, so your attributes are falling outside of the document header.


On Wed, Sep 6, 2017 at 2:22 AM, wimdeblauwe [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hello,

I am unable to add a table of contents (toc) to my HTML nor PDF output. I am using the following versions:

> asciidoctor -v
Asciidoctor 1.5.6 [http://asciidoctor.org]
Runtime Environment (ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]) (lc:US-ASCII fs:US-ASCII in:- ex:US-ASCII)

> asciidoctor-pdf -v
Asciidoctor PDF 1.5.0.alpha.15 using Asciidoctor 1.5.6 [http://asciidoctor.org]
Runtime Environment (ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]) (lc:US-ASCII fs:US-ASCII in:- ex:US-ASCII)

In my document, I have added ":toc:", like this:

```
= Title of my document

:pdf-page-size: A4
:toc:
:toclevels: 2
:numbered:
```

But no table of contents is shown in the output



If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Unable-to-get-Table-of-Contents-working-from-command-line-tp5876.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux
Reply | Threaded
Open this post in threaded view
|

Re: Unable to get Table of Contents working from command line

wimdeblauwe
In reply to this post by wimdeblauwe
Minutes after posting, I find the solution :-)

I have to change:

```
= Title of my document

:pdf-page-size: A4
:toc:
:toclevels: 2
:numbered:
```

to:

```
= Title of my document
:pdf-page-size: A4
:toc:
:toclevels: 2
:numbered:
```

Notice the removed blank line between the title and the options. For other options like :numbered: it does not seem to matter, but for :toc:, that blank line cannot be there. Is this normal/expected behaviour or should I file a bug report about it?

regards,

Wim
Reply | Threaded
Open this post in threaded view
|

Re: Unable to get Table of Contents working from command line

mojavelinux
Administrator
Yes, that is normal behavior. Attributes that control document-level behavior must be defined in the header.

The reason numbered (now called sectnums) is not required in the header is because this setting can be changed throughout the document. There are very few attributes like this, so it's really a rare exception.

Cheers,

-Dan

On Wed, Sep 6, 2017 at 2:24 AM, wimdeblauwe [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Minutes after posting, I find the solution :-)

I have to change:

```
= Title of my document

:pdf-page-size: A4
:toc:
:toclevels: 2
:numbered:
```

to:

```
= Title of my document
:pdf-page-size: A4
:toc:
:toclevels: 2
:numbered:
```

Notice the removed blank line between the title and the options. For other options like :numbered: it does not seem to matter, but for :toc:, that blank line cannot be there. Is this normal/expected behaviour or should I file a bug report about it?

regards,

Wim


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Unable-to-get-Table-of-Contents-working-from-command-line-tp5876p5877.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux