Skip to content

Instantly share code, notes, and snippets.

@lf-araujo
Last active April 14, 2019 20:22
Show Gist options
  • Save lf-araujo/607dd7c9bd616c174c81ed4d2088f80a to your computer and use it in GitHub Desktop.
Save lf-araujo/607dd7c9bd616c174c81ed4d2088f80a to your computer and use it in GitHub Desktop.
LaTeX Titling & Pandoc

In a previous post on how to render complex documents using plain text, it was shown a way to handle titles in the body of the document. This is a good solution for larger documents, but these configurations will only appear if a latex engine is used. There is a way of keeping the title in all pandoc output types as well. That is what will be shown here.

The trick is to use the titling latex package. It allows you to use the standard title variable, which means title will appear in any of the output formats pandoc supports, but also helps to save space and maintain consistency.

I used this method in my PhD thesis and this is how it looked:

![]( /images/Captura de tela de 2017-12-26 20-24-15.png )

Here is an example of how it works. Define the title and authors as you would in any pandoc yaml:

---
title: Super long title goes in here
author: And the brilliant author here
---

One can configure several elements of the title, like spacing, order, position and so on, with the \preauthor, \postauthor, \predate, \postdate latex commands:

header-includes: |
	\preauthor{\begin{center}\pagenumbering{gobble}\Large}
	\postauthor{\\  \footnotesize orcid.org/0000-0000-0000-0000 \\ \vspace{4cm} \normalsize Doctor of Philosophy \\ December 2017 \\ \vspace{2cm} \normalsize Department of XXXX \\ Building\\ The University  \\ \vspace{4cm} Submitted in total fulfilment of the requirements of the degree of\\Doctor of Philosophy \end{center}}

This is an overall better approach as it allows the writer to publish the document in all pandoc format types, but to add some styling to the PDF version through LaTeX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment