Skip to content

Instantly share code, notes, and snippets.

@avonmoll
Last active September 29, 2021 14:57
Show Gist options
  • Save avonmoll/1e01e6fac89d3037526998774f7904f3 to your computer and use it in GitHub Desktop.
Save avonmoll/1e01e6fac89d3037526998774f7904f3 to your computer and use it in GitHub Desktop.
Extremely Simple Pandoc Memo

Instructions

  1. Put makememo on path somewhere
  2. Make sure pandoc-crossref and pandoc-citeproc are somewhere on your path
  3. Set the location of your bibliography file in metadata of memo-template.md
  4. Set the location of your CSL file in metadata of memo-template.md
  5. Create a markdown file such as memo-example.md
    • The metadata fields (title, subtitle, author, date) are optional
    • Other metadata fields set here will not be used
  6. Call the bash script: make-memo memo-example.md
  7. Open memo-example.pdf after it has been created :crystal-ball:
#!/bin/bash
ln -sf $PWD/makememo ~/bin
ln -sf $PWD/memo-template.md ~/.pandoc/templates
#!/bin/bash
if [ "$1" == "-h" ]; then
echo "Usage: `basename $0` [-h] [file.md] -- program to create PDF version of memo using simple template
where:
-h show this help text"
exit 0
else
fname=$1
name=$(echo $fname | cut -d'.' -f 1)
echo `pandoc $fname --template=memo-template.md -t markdown | pandoc --pdf-engine=xelatex --filter=pandoc-crossref --filter=pandoc-citeproc -o $name.pdf`
exit 0
fi
title subtitle footer
A test
First of its Kind
Nice footer

Is this an easy to write template?

Reference to [@vonmoll2014recent] and see [@eq:label], below.

$$ math $$ {#eq:label}

References

Display the source blob
Display the rendered blob
Raw
Error in user YAML: (<unknown>): could not find expected ':' while scanning a simple key at line 17 column 1
---
documentclass: article
fontsize: 11pt
bibliography: '/home/alex/library.bib'
csl: '/home/alex/.csl/ieee.csl'
biblatexoptions: 
 - sorting=none
 - backend=biber
header-includes:
 - \usepackage{fullpage}
 - \usepackage{hyperref}
 - \linespread{1.05}
 - \setmainfont{TeX Gyre Pagella}
 - \setsansfont{TeX Gyre Heros}
 - \setmathfont{TeX Gyre Pagella Math}
 - \setlength{\parindent}{0pt}
 - \setlength{\parskip}{.7em}
$if(footer)$
 - \usepackage{fancyhdr}
 - \pagestyle{fancy}
 - \renewcommand{\headrulewidth}{0pt}
 - \fancyhead{}
 - \fancyfoot[RO,RE]{$footer$}
 - \fancyfoot[CO,CE]{\thepage}
$endif$
$for(header-includes)$
 - $header-includes$
$endfor$
link-citations: true
colorlinks: true
---

\noindent \large\textbf{$title$}\hfill\textbf{$if(author)$$author$$else$Alexander Von Moll$endif$}\newline \noindent \normalsize $if(subtitle)$$subtitle$$endif$\hfill$if(date)$ $date$$else$\today$endif$

$body$

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