This is the official manual for the latest Org-mode release.
The table of contents is normally inserted directly before the first headline
of the file. If you would like to get it to a different location, insert
#+TOC: headlines at the desired location. The depth of the table of
contents is by default the same as the number of headline levels, but you can
choose a smaller number, or turn off the table of contents entirely, by
configuring the variable org-export-with-toc, or on a per-file basis
with a line like
#+OPTIONS: toc:2 (only to two levels in TOC)
#+TOC: headlines 2 (the same, at a specific location)
#+OPTIONS: toc:nil (no TOC at all)
The same TOC keyword can also generate a list of all tables (resp.
all listings) with a caption in the buffer.
#+TOC: listings (build a list of listings)
#+TOC: tables (build a list of tables)
The headline's title usually determines its corresponding entry in a table of
contents. However, it is possible to specify an alternative title by
setting ALT_TITLE property accordingly. It will then be used when
building the table.