Org-mode's default during HTML export is to put the author in the postamble at the bottom of the page.

But I would like to export a paper like document with the author between the title and the abstract. Is it possible somehow to place the author after the title?

And is it possible to label the abstract as an abstract? I have used the delimiters


to mark the text as the abstact but it is rendered just as a normal paragraph (no blockquote like indent). Is it possible to get the right indent for the abstract and a localized label?

  • 2
    For the abstract requirements use css. ... will be wrapped as <div class="abstract"><p>...</p></div>. For having a LaTeX like title maybe you should fill a bug report. For now use the macro {{{AUTHOR}}} and snippets @@html:whatever@@ to build what you want.
    – rasmus
    Jan 20, 2015 at 14:27

3 Answers 3


Maybe something like this (tested with LaTeX and HTML)

#+TITLE: An Orged Paper
#+AUTHOR: Rasmus
#+DATE: A Dark Day for Science 

#+RESULTS: html-header

my long abstract that is longer than one line. my long abstract that is longer than one line.
#+toc: headlines
* Introduction
Please read my paper!
* Data
* Conclusion
Something deep and profound

* styles                                                           :noexport:
#+HTML_HEAD_EXTRA: <style type="text/css">
#+HTML_HEAD_EXTRA:   .header_title {font-size: 2em; font-weight: bold;}
#+HTML_HEAD_EXTRA:   .header_author {font-size: 1.5em; font-weight: bold;text-align:center;}
#+HTML_HEAD_EXTRA:   .header_date {text-align:center;}
#+HTML_HEAD_EXTRA:   .header_date .timestamp {font-size:1em; color:#000000;}
#+HTML_HEAD_EXTRA:   .abstract {max-width: 30em; margin-left: auto; margin-right: auto;}
#+HTML_HEAD_EXTRA: </style>

#+OPTIONS: toc:nil

#+MACRO: html-only (eval (if (org-export-derived-backend-p org-export-current-backend 'html) "$1" ""))

#+NAME: html-header
#+BEGIN_SRC emacs-lisp :results raw :exports (if (org-export-derived-backend-p org-export-current-backend 'html) "results" "none")

Note the html-header could also be generated via org-html-preamble. Note also that from org 8.3 org-latex-title-command can be used to customize the title as a format-string.


Take a look of the source code, it seems that no option to do this.

I don't sure what you really want, just provide possible two ways:

  1. Just add a #+BEGIN_HTML ... #+END_HTML block to write what you want. (The content written in it will be treated as totally HTML.) But you may need to add #+OPTIONS: toc: nil to disable TOC or author will be placed under TOC.

  2. Re-define the export function and do what you want (Notice line 50~52), just place following code after (require 'ox-html) in your config file:

      (defun org-html-template (contents info)
        "Return complete document string after HTML conversion.
      CONTENTS is the transcoded contents string.  INFO is a plist
      holding export options."
         (when (and (not (org-html-html5-p info)) (org-html-xhtml-p info))
           (let ((decl (or (and (stringp org-html-xml-declaration)
                 (cdr (assoc (plist-get info :html-extension)
                 (cdr (assoc "html" org-html-xml-declaration))
             (when (not (or (eq nil decl) (string= "" decl)))
         (format "%s\n"
             (format decl
                 (or (and org-html-coding-system
                      (fboundp 'coding-system-get)
                      (coding-system-get org-html-coding-system 'mime-charset))
         (org-html-doctype info)
         (concat "<html"
           (when (org-html-xhtml-p info)
              " xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"%s\" xml:lang=\"%s\""
              (plist-get info :language) (plist-get info :language)))
         (org-html--build-meta-info info)
         (org-html--build-head info)
         (org-html--build-mathjax-config info)
         (let ((link-up (org-trim (plist-get info :html-link-up)))
         (link-home (org-trim (plist-get info :html-link-home))))
           (unless (and (string= link-up "") (string= link-home ""))
             (format org-html-home/up-format
               (or link-up link-home)
               (or link-home link-up))))
         ;; Preamble.
         (org-html--build-pre/postamble 'preamble info)
         ;; Document contents.
         (format "<%s id=\"%s\">\n"
           (nth 1 (assq 'content org-html-divs))
           (nth 2 (assq 'content org-html-divs)))
         ;; Document title.
         (let ((title (plist-get info :title)))
           (format "<h1 class=\"title\">%s</h1>\n" (org-export-data (or title "") info)))
         ;; Author
         (let ((author (plist-get info :author)))
           (format "<h2 class=\"author\">%s</h2>\n" (org-export-data (or author "") info)))
         (format "</%s>\n"
           (nth 1 (assq 'content org-html-divs)))
         ;; Postamble.
         (org-html--build-pre/postamble 'postamble info)
         ;; Closing document.
  • 3
    This is absolutely the wrong way to to this!! Preferably, you need to make a derived-backed, see org-export-define-derived-backend and add the new template to the :translate-alist. For concrete examples check ox-beamer.el, ox-koma-script.el and e.g. ox-s5.el.
    – rasmus
    Jan 20, 2015 at 17:11

The most difficult problem I ran into with this is the conditional styling of different sections and the conditional numbering of different sections. This is a solution for both of these problems.

Here is my paper:

#+TITLE: Complex Tracking of Awesome Things
#+AUTHOR: Bastibe
#+INCLUDE: style.org

* Abstract

Lorem ipsum dolor sit amet...

* Introduction

* Methodology

* Results

* Conclusion

* Acknowledgements

First up, this includes an org file with some additional options. This file, called style.org above sets the HTML export to load a custom style sheet, and sets a few LaTeX options. If you are not exporting to LaTeX, you won't need those.

#+OPTIONS: tags:nil html-postamble:nil # toc:nil
#+STARTUP: nofold hideblocks
#+BIND: org-latex-title-command ""

#+HTML_MATHJAX: path:"MathJax/MathJax.js"
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="style.css" />

#+LATEX_CLASS: article
#+LATEX_CLASS_OPTIONS: [a4paper, 12pt]
#+LATEX_HEADER: \usepackage{setspace}
#+LATEX_HEADER: \onehalfspacing
#+LATEX_HEADER: \usepackage{fontspec}
#+LATEX_HEADER: \setmainfont{Cambria}
#+LATEX_HEADER: \setmonofont{PragmataPro}
#+LATEX_HEADER: \usepackage{polyglossia}
#+LATEX_HEADER: \setdefaultlanguage{english}
#+LATEX_HEADER: \usepackage[a4paper, scale=0.8]{geometry}
#+LATEX_HEADER: \usepackage{amsmath}
#+LATEX_HEADER: \usepackage{units}
#+LATEX_HEADER: \usepackage{titling}
#+LATEX_HEADER: \usepackage{listings}
#+LATEX_HEADER: \lstset{basicstyle=\ttfamily\footnotesize,showstringspaces=false}
#+LATEX_HEADER: \usepackage[hang]{caption}

In order to render this as paper-like HTML, a little CSS is enough (saved in style.css:

#content {
    max-width: 80ex;
    position: relative;
    margin: 5px auto;
    font-family: Cambria;
    text-align: justify;
    -moz-hyphens: auto;

.abstract {
    max-width: 65ex;
    margin: 5px auto;
    margin-top: 4em;
    margin-bottom: 4em;
    content: none;

p {
    text-indent: 5ex;
    margin-bottom: 0;
    margin-top: 0;

However, the section numbers will be wrong. Org mode can either number all sections, or none. Papers typically need numbers on the body sections, but not the Abstract and the Summary. The following piece of code will make Org put numbers in front of regular sections, but suppress the numbers if the property :NUMBERS: no is set:

(defun headline-numbering-filter (data backend info)
  "No numbering in headlines that have a property :numbers: no"
  (let* ((beg (next-property-change 0 data))
         (headline (if beg (get-text-property beg :parent data))))
    (if (string= (org-element-property :NUMBERS headline) "no")
        (cond ((eq backend 'latex)
                "\\1*" data nil nil 1))
              ((eq backend 'html)
                "\\1 class=\"nonumber\"\\2" data nil nil)))

(setq org-export-filter-headline-functions '(headline-numbering-filter))

This works well for the LaTeX export, but not in the HTML export. With modern CSS, browsers can do the numbering for you though (appended to style.css):

/* do not show section numbers */
span.section-number-2 { display: none; }
span.section-number-3 { display: none; }
span.section-number-4 { display: none; }
span.section-number-5 { display: none; }
span.section-number-6 { display: none; }

/* use LaTeX-style names for the counters */
h1 { counter-reset: section; }
h2 { counter-reset: subsection; }
h3 { counter-reset: subsubsection; }
h4 { counter-reset: paragraph; }
h5 { counter-reset: subparagraph; }

.nonumber::before { content: none; }

h2::before {
    content: counter(section) " ";
    counter-increment: section;

h3::before {
    content: counter(section) "." counter(subsection) " ";
    counter-increment: subsection;

h4::before {
    content: counter(section) "." counter(subsection) "." counter(subsubsection) " ";
    counter-increment: subsubsection;

h5::before {
    content: counter(section) "." counter(subsection) "." counter(subsubsection) "." counter(paragraph) " ";
    counter-increment: paragraph;

h6::before {
    content: counter(section) "." counter(subsection) "." counter(subsubsection) "." counter(paragraph) "." counter(subparagraph) " ";
    counter-increment: subparagraph;

With that, you can export your paper to both LaTeX and HTML.

  • "Org mode can either number all sections, or none." Uhm, how about passing the property UNNUMBERED: t to a headline? From ORG-NEWS: Headlines, for which the property UNNUMBERED is non-nil, are now exported without section numbers irrespective of their levels. The property is inherited by children.
    – rasmus
    Jan 21, 2015 at 16:31
  • @rasmus that's awesome! However, as far as I can tell, this was only introduced in org-mode 8.3, which is not released yet.
    – bastibe
    Jan 22, 2015 at 14:42
  • It's implemented in master and works on all backends. Org 8.3 is on the doorstep. That it has not been released means it's the perfect time to test it and post bug reports (as necessary)!
    – rasmus
    Jan 22, 2015 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.