= {title}
:title:       Left or Right margin TOC
:description: In this tutorial, we will learn how to add a table of contents in the left/right hand margin of an article or book document.
:doctitle:    Example for Asciidoc-Bootstrap - {title}


== Left/Right margin Table Of Contents (TOC)

[role="lead"]
This TOC is located in the left or right side of the main content of the document.

Example of Asciidoc document. See source text
footnote:[https://raw.github.com/llaville/asciidoc-bootstrap-backend/master/examples/demo.asciidoc].

NOTE: You will used the standard `toc2` attribute of AsciiDoc.
See http://asciidoc.org/userguide.html#X91[]

== Result with flatly theme

[role="lead"]
With this theme we will put a TOC in right margin of the document

Invoke the following command:
[source,bash]
----
$ asciidoc
  -b bootstrap
  -f /path/to/examples/demo.conf
  -o toc2-sample2.html
  -a toc2
  -a toc-placement=right
  -a theme=flatly
  /path/to/examples/demo.asciidoc
----

And here are the final result that you should get.

image::images/screenshots/toc2-sample2.png[link="toc2-sample2.html",title="My first TOC2 with flatly theme",role="thumbnail",options="align,responsive"]

== Result with default theme

[role="lead"]
With this theme we will put a TOC in left margin of the document (default behavior).

Invoke the following command:
[source,bash]
----
$ asciidoc
 -b bootstrap
 -f /path/to/examples/demo.conf
 -o toc2-sample.html
 -a toc2 /path/to/examples/demo.asciidoc
----

And here are the final result that you should get.

image::images/screenshots/toc2-sample.png[link="toc2-sample.html",title="My first TOC2 with default theme",role="thumbnail",options="align,responsive"]

== About options @to generate documents@

We reused and group all common attributes to generate documents in a standard asciidoc configuration file called `demo.conf`.
..........................
[attributes]
linkcss
numbered
lang=en
jumbotron
jumbotron-fullwidth
totop
iconsfont=font-awesome
footer!
footer-fullwidth
..........................

include::gendocfile.asciidoc[]
