I use Emacs [1] Org-Mode [2] for writing all kinds of articles. The standard format for org-mode is to show the table of contents before all other content, but that requires people to scroll down to see whether the article is interesting for them. Therefore I want the abstract to be shown before the table of contents.
There is an old guide for showing the abstract before the TOC in org-mode<8 [3], but since I use org-mode 8, that wasn’t applicable to me.
With a short C-h v org-toc TAB TAB (means: search all variables which start with org- and containt -toc) I found the following even simpler way. After I got that solution working, I found that this was still much too complex and that org-mode actually provides an even easier and very convenient way to add the TOC at any place.
(from the manual [4])
At the beginning of your file (after the title) add
#+OPTIONS: toc:nil
Then after the abstract add a TOC:
#+BEGIN_ABSTRACT Abstract #+END_ABSTRACT #+TOC: headlines 2
Done. Have fun with org-mode!
This is the complicated way I tried first. It only works with LaTeX, but there it works. Better use the simple way.
Set org-export-with-toc to nil as file-local variable. This means you just append the following to the file:
# Local Variables: # org-export-with-toc: nil # End:
(another nice local variable is org-confirm-babel-evaluate: nil, but don’t set that globally, otherwise you could run untrusted code when you export org-mode files from others. When this is set file-local, emacs will ask you for each file you open whether you want to accept the variable setting)
Then write the abstract before the first heading and add tableofcontents after it. Example:
#+BEGIN_ABSTRACT Abstract #+END_ABSTRACT #+LATEX: \tableofcontents
Anhang | Größe |
---|---|
2013-11-21-Do-emacs-orgmode-abstract-before-toc.pdf [5] | 143.29 KB |
2013-11-21-Do-emacs-orgmode-abstract-before-toc.org [6] | 2.23 KB |
Links:
[1] http://gnu.org/s/emacs
[2] http://orgmode.org
[3] http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-11-1
[4] http://orgmode.org/manual/Table-of-contents.html
[5] https://www.draketo.de/files/2013-11-21-Do-emacs-orgmode-abstract-before-toc.pdf
[6] https://www.draketo.de/files/2013-11-21-Do-emacs-orgmode-abstract-before-toc.org