Authoring PDFs from Pandoc's Markdown Formatted Files
Creating a polished PDF document from a collection of markdown-formatted text files is a multifaceted process that involves seamlessly integrating various technologies.
This concise tutorial introduces Pandoc's Markdown flavor. It serves as a starting point for demonstrating an efficient workflow, which seamlessly integrates Pandoc and Typst as a PDF engine using a set of PowerShell scripts.
Pandoc, both a command-line tool and a library, supports an enhanced Markdown syntax for input text files. Noteworthy features include unnumbered headings, fancy lists, task lists, and four distinct table types. These interesting features are implemented as extensions and can be selectively removed when needed
When using Pandoc from the command line, you'll typically execute it with a set of options to specify the format of the input and output files. Here's a typical example of a Pandoc command line:
pandoc input.md --from markdown -o output.pdf
In this example:
- input.md represents the input Markdown file.
- -o specifies the output option.
- output.pdf is the desired output file format (in this case, a PDF).
An extension can be enabled by adding +EXTENSION to the format name and disabled by adding -EXTENSION. For example the option --from markdown-footnotes-pipe_tables is pandoc's Markdown without footnotes or pipe tables.
Overview
Let's have an overview of Pandoc's Markdown. We'll begin by exploring how to create section headings with and without numbering. Pandoc allows you to create also unnumbered headings, as shown in the video below.
Fancy lists remove the need for traditional numerals as ordered list markers. Pandoc's markdown supports also task lists, following the same syntax as GitHub-Flavored Markdown.
A line containing a row of three or more asterisk or minus characters (optionally separated by spaces) produces a horizontal rule.
Pandoc's Markdown also supports tables in various formats. In this example, the pipe separators indicate column boundaries. Notably, columns need not be vertically aligned, as demonstrated here. A caption may optionally be provided with all kinds of table.
Below the text file edited in the video.
```{=html}
<details>
<summary>Click here for details</summary>
filename: ~\workplace\devlocal\pspandoc\Manuscript\docs\chapter0.md
</details>
```
# Overview
## Level II heading
### Level III heading
## Unnumbered {-}
## Fancy lists
#. One
#. Two
## Task Lists
- [ ] Todo
- [x] Done
## Horizontal Rules
* * * *
---
## Tables
| factors | a | b |
| ------------- |------------- | ------- |
| f1 | Y | N |
| f2 | Y | N |
: Table
It's also possible to include LaTeX macros. For instance:
\newcommand{\myvec}[1]{\vec{#1}}
You can then display this as TeX math using the following notation:
$\myvec{a}$
The \newcommand defines a custom macro named \myvec that takes one argument and applies the vector arrow (\vec) to it.