Better notes with pandoc

Jun 14 2016

The Problem

I am constantly sitting in some meetings, taking notes about the things that are bespoken. While I am pretty fast in writing with the keyboard, I am not that fast in creating beautiful minutes of meeting - until now !

In opposite to my colleagues I prefer to write my notes in a plain editor like vim or gedit. Both are pretty powerful editors, but all that they can give you is a plain text file, without any nice formatting. Since my colleagues prefer as result to have beautiful PDF documents with table of contents and beautiful formulas, I had to find a way how to transform these notes into such a beautiful document.

The Solution

Well, one solution would be to utilize LaTex - but to be honest: It is way complicated to write a whole LaTex document during a meeting, since it soaks up your time with formatting and so on and in the end you keep loosing track of what is happening around you.

Idea

The better way is to write the minutes of meeting is to use a kind of wiki syntax (e.g. with the markdown syntax). Depending on the syntax this will give you nearly no overhead, but already nice readable plain text documents.

The next step is to convert you text file into something beautiful. This is where pandoc enters the game. The idea looks like this:

pandoc.png

  1. The notes are written in a syntax that is supported in pandoc (like markdown, reStructuredText, textile, HTML, DocBook, LaTeX, MediaWiki markup, TWiki markup, OPML, ...). For the sake of simplicicity we are choosing the markdown syntax (*.md)
  2. Pandoc is invoked via commandline to render a pdf from the given markdown file
    1. Therefore it uses internal templates - which can be modified to fit your needs
    2. If you want to have pdfs, then it uses LaTex / PdfTex toolchain to produce the pdf document. This is not part of the pandoc standard installation packages. If you want to have other output formats, then this should be possible as well - have a look at the demo page
  3. You get a pdf as result.

Implementation

The implementation is pretty simple. All you have to do is to start pandoc with the right parameters. Let assume that we have the following markdown file:

---
title: Pandoc test document
author: Günther Hutter
date: 2016-07-14
abstract: This is a simple pandoc demo document - try it on your own.
...


\maketitle
\tableofcontents
\pagebreak

Inroduction
===========
This is a small introduction. It is automatically included in the table of contents. Furthermore we can do some bullet points:

* First topic
* Second topic


Formulas
--------
It also works withou formulas[^1], but they are simple to use, and they look very beautiful.
$$m = \frac{m_0}{\sqrt{1-\frac{v^2}{c^2}}}$$

[^1]: You dont have to use them if you don't want to.

Tables
------
Tables are also possible. And they look awesome.

Bezeichnung               Min.      Max.    Einheit    Messverfahren
-------------------  ---------   -------   ---------   ---------------------
Zylinderhub               0.00   1000.00      mm       Rope
Cylinderforce         -1150.00   1150.00      kN       DMS
Oil                       0.01      0.05     per m     Ultrasonic
Pump                      0.00    300.00      bar      Pressure sensor
Pressure                  0.00    300.00      bar      Pressure sensor


Definitions
-----------
Lets make some simple definitions - and of course, these can occur everywhere in the document.

Triangle
  : A plane figure that has three straight bounding sides. There are also triagles with a 90 degree angle: $c = \sqrt{a^2 + b^2}$

Quadrilateral
  : A plane figure that has four straight bounding sides.

Square
  : A rhombus that is a rectangle.

Beside the fact that this already looks awesome - have a look at the result, which is created by this one-liner:

pandoc -f markdown Sample.md -t latex -o Sample.md.pdf

page1.png

page2.png

Nice - Isn't it ?

You can easily automate the whole creation process. If you use vim as an editor you can simple call an external command, or if you prefer the GUI way then by writing a simple gedit macro:

gedit_pandoc_automation.png

Get Social


(c) 2024, by bytebang e.U. - Impressum - Datenschutz / Nutzungsbedingungen
-