Zwillingssterns Weltenwald
Published on Zwillingssterns Weltenwald (http://www.xn--drachentrnen-ocb.de)

Startseite > How to show the abstract before the table of contents in org-mode

How to show the abstract before the table of contents in org-mode

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.

Table of Contents

  • 1. Intro
  • 2. Solution
  • 3. Appendix: Complex way

1 Intro

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.

2 Solution

(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!

3 Appendix: Complex way

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
AnhangGröß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
Werke von Arne Babenhauserheide. Lizensiert, wo nichts anderes steht, unter der GPLv3 or later und weiteren freien Lizenzen.

Diese Seite nutzt Cookies. Und Bilder. Manchmal auch Text. Eins davon muss ich wohl erwähnen — sagen die meisten anderen, und ich habe grade keine Zeit, Rechtstexte dazu zu lesen…


Source URL: http://www.xn--drachentrnen-ocb.de/light/english/emacs/org-mode-abstract-before-toc

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] http://www.xn--drachentrnen-ocb.de/files/2013-11-21-Do-emacs-orgmode-abstract-before-toc.pdf
[6] http://www.xn--drachentrnen-ocb.de/files/2013-11-21-Do-emacs-orgmode-abstract-before-toc.org