Home About Performances Teaching Collaborations Tech AVWorks 100 Sketches Calendar Blog

Formatting Academic Papers in Emacs Orgmode

Published on: 2025-05-14

Introduction

The process of writing academic papers can be fun, but when you are asked to conform to standards that very clearly derive from the MS Word hegemony it detracts a bit from the enjoyment. If your stomach sinks a bit at the thought of having to work in an inferior text processing environment (MS Word, LibreOffice et al) instead of in a superior one (vim, emacs). I am an emacs guy, so I'll use org mode to do this, but a lot of this is just pure latex, so it should be possible to translate directly to any latex-capable environment.

Basic Emacs Setup

These are the default settings for latex export from org mode. They are heavily based on https://github.com/GeneKao/orgmode-latex-templates and go into my init.el. Don't ask me what they all do… There may be a fair bit of cargo cult programming going on here, and at some point I will have to clean this out.

(add-to-list 'org-latex-classes
             '("article"
               "\\documentclass[12pt,a4paper]{article}
\\usepackage[a4paper, vmargin=2.5cm, bottom=3cm]{geometry}
\\usepackage[utf8]{inputenc}
\\usepackage[T1]{fontenc}
\\usepackage{fixltx2e}
\\usepackage{graphicx}
\\usepackage{longtable}
\\usepackage{float}
\\usepackage{wrapfig}
\\usepackage{rotating}
\\usepackage[normalem]{ulem}
\\usepackage{amsmath}
\\usepackage{textcomp}
\\usepackage{marvosym}
\\usepackage{wasysym}
\\usepackage{amssymb}
\\usepackage{hyperref}
\\usepackage{mathpazo}
\\usepackage{color}
\\usepackage{parskip}
\\usepackage{enumerate}
\\definecolor{bg}{rgb}{0.95,0.95,0.95}
\\tolerance=1000
      [NO-DEFAULT-PACKAGES]
      [PACKAGES]
      [EXTRA]
\\linespread{1.1}
\\hypersetup{pdfborder=0 0 0}"
               ("\\section{%s}" . "\\section*{%s}")
               ("\\subsection{%s}" . "\\subsection*{%s}")
               ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
               ("\\paragraph{%s}" . "\\paragraph*{%s}")))

Orgmode Basic Setup

In the org document I add these headers and commands:

#+options: ':nil *:t -:t ::t <:t H:3 \n:nil ^:t arch:headline
#+options: author:t broken-links:nil c:nil creator:nil
#+options: d:(not "LOGBOOK") date:t e:t email:nil expand-links:t f:t
#+options: inline:t num:t p:nil pri:nil prop:nil stat:t tags:t
#+options: tasks:t tex:t timestamp:nil title:t toc:nil todo:t |:t
#+latex_header: \usepackage{fullpage}
#+latex_header: \usepackage{widows-and-orphans}
#+latex_header: \usepackage{svg}
#+latex_header: \usepackage{newtxtext}
#+latex_header: \usepackage{setspace}
#+latex_header: \usepackage{fancyhdr}
#+latex_header: \usepackage[bottom]{footmisc}
#+latex_header: \usepackage{titlesec}
#+title: <title of the paper>
#+author: <me>
#+date: <today's date>
#+language: en

\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\fancyhf{}
\titleformat*{\section}{\normalfont\large\bfseries}
\titleformat*{\subsection}{\normalfont\normalsize\bfseries}
\pagenumbering{gobble}
\pagebreak
\onehalfspacing
\rfoot{\thepage}
\pagenumbering{arabic}
\setcounter{page}{2}
\parskip=6pt plus 1pt
\frenchspacing
\urlstyle{same}

Font

Set up the font. My academy really likes Times New Roman. The newtxtext latex package provides this. If you also want math symbols in the same font, you should add the mathptmx package.

\documentclass[12pt,a4paper]{article}

in init.el and

#+latex_header: \usepackage{newtxtext}

in the document, overriding the default latex font that I much prefer in my other documents.

Margins

The requirement is to have a 2.5 cm margin on top and a 3 cm margin at the bottom of the page. This takes care of that:

\usepackage[a4paper, vmargin=2.5cm, bottom=3cm]{geometry}

Titles

The default titles are too big. I get around this by using the titlesec package and adding these commands:

\titleformat*{\section}{\normalfont\large\bfseries}
\titleformat*{\subsection}{\normalfont\normalsize\bfseries}

I don't generally use anything deeper than a subsection, but if needed it's easy enough to add subsubsection.

Line Spacing

1.5 line space is the requirement:

\onehalfspacing

Additionally I need the distance between paragraphs to be 6 pt:

\parskip=6pt plus 1pt

URL Style

I generally like my hyperlinks to be magenta-flavored, but that won't fly in this context. So, boring urls it is:

\urlstyle{same}

Single Space After Period

The default in latex is to insert a double (or more) blank space after a period. This looks good, but the academy wants a single space:

\frenchspacing

Why French? Ask Wikipedia!

Generate a Table of Contents

In order to get a proper table of contents with page numbers etc, you will need to set the org-mode export option num to t. This will produce numbered headers. After that you can either set the toc option to a numerical value for the number of levels you want in you toc, or you can insert it manually in the document where you want it:

\singlespacing
\renewcommand*\contentsname{Table of Contents}
#+TOC: headlines 3

Note that you can rename the table of contents to anything you want rather than the default Contents. I also added the \singlespacing command to get a more compact outline.