Pandoc Cheat Sheet

Posted on  by 



Pandoc Cheat Sheet. Created on: 2019-01-21. A quick reference to Pandoc. Created on: 2019-01-20. Using Pencil Project as GUI prototyping tool. PostgreSQL Cheat Sheet. Created on: 2019-01-22. A quick reference to PostgreSQL. Publish Sphinx doc with GitHub Pages.

  • USAGE
    • Setting document-specific options
  • EXTRAS
  • EXAMPLE
    • Extended example using post-processing options

pdoc - typeset pandoc documents with document-specific, default options

Read and Write to CSV. pd.readcsv('file.csv', header=None, nrows=5). Pandoc supports lua and python based filters to aid in formatting of the documents. For example: pandoc-citeproc parses the citations included in markdown files, pandoc-crossref allows numbering and cross-referencing of figures, tables and equations across the document.

version 0.10.0

This is just a small executable and a hack to pandoc: you can use it to set document-specific, default options for pandoc in the typesetting process. Of course, you can safely ignore these settings and return to the standard way of doing things at all times.

Usage is absolutely straight-forward:

Usage on the commandline

Pandoc Cheat Sheet Template

If you want your file to be typeset using the document-specific default options, run

If you want standard processing of that file, simply run pandoc as usual:

Setting document-specific options

Setting options

Sprinkle <!--+ --pandoc-option1 --pandoc--option2 +--> all over your pandoc file -- just as your would use them on the shell. pdoc will read these and add them to the commandline that is passed to a standard pandoc typesetting.

Defining post-processing behavior

Use <!--& (some post processing action) &--> as the special markup to pdoc for post-processing options. These will be concatenated to the pandoc-commandline that is generated via &&, just like so:

This is just a simple hack reading out specially marked comments in your pandoc source. Everything will stay usable as always. When typesetting in the standard manner, these comments are simply ignored.

See the executable for the details.

Shell variables

You can use shell variables as usual, e.g. $HOME, etc.

Use policies

When doing more complicatd things (see example below) I like to use so-called pandoc-policies (as I call them).

I keep a folder ~/.pandoc/policies next to ~/.pandoc/templates containing files like ~/.pandoc/policies/columns.latex (handling column-layouts) ~/.pandoc/policies/squeeze.latex (for whitespace squeezing), and so on...

Pandoc

All of these policies are to be included by pandoc's -H / --include-in-header=-switch, so it makes:

Suppose you have a squeeze and a columns-policy in your policy-folder, your document might look like this:

Extended example using post-processing options

Pandoc Cheat Sheet Free

Here is a somewhat more complicated example: the cheat-sheet generator that I'm currently using while learning for my final examination:

This cheat-sheet generator can simply be called using pdoc cheatsheet.pandoc and will additionally use pdfjam to squeeze even more of the resulting pdf pages together. On a Mac, it will additionally open the file after the final pdfjam rendering for quality inspection ;-).

Things to note

  • Note how several policies are grouped together on shell level, using curly-bracket expansion:

Pandoc cheat sheet template
  • Also note, how additional options are set via pandoc's -V-switch, and how even more options are smuggled in into pandoc's own latex template. (The latter you can find using pandoc -D latex) in using

  • pandoc: http://johnmacfarlane.net/pandoc/

  • pdfjam: http://go.warwick.ac.uk/pdfjam

DBR <dbr@cpan.org>

This software is Copyright (c) 2012 by DBR.

This is free software, licensed under:

To install App::PDoc, copy and paste the appropriate command in to your terminal.

For more information on module installation, please visit the detailed CPAN module installation guide.





Coments are closed