~brhiggins/pandoc-template-letter

ff4e2278003f1bae11656f6cdd6d729712747dbc — Benjamin Higgins 2 years ago
Add template and example
7 files changed, 483 insertions(+), 0 deletions(-)

A .gitignore
A LICENSE
A README.md
A example.md
A example.pdf
A makefile
A template.tex
A  => .gitignore +324 -0
@@ 1,324 @@
example.tex

# Created by https://www.toptal.com/developers/gitignore/api/vim,latex
# Edit at https://www.toptal.com/developers/gitignore?templates=vim,latex

### LaTeX ###
## Core latex/pdflatex auxiliary files:
*.aux
*.lof
*.log
*.lot
*.fls
*.out
*.toc
*.fmt
*.fot
*.cb
*.cb2
.*.lb

## Intermediate documents:
*.dvi
*.xdv
*-converted-to.*
# these rules might exclude image files for figures etc.
# *.ps
# *.eps
# *.pdf

## Generated if empty string is given at "Please type another file name for output:"
.pdf

## Bibliography auxiliary files (bibtex/biblatex/biber):
*.bbl
*.bcf
*.blg
*-blx.aux
*-blx.bib
*.run.xml

## Build tool auxiliary files:
*.fdb_latexmk
*.synctex
*.synctex(busy)
*.synctex.gz
*.synctex.gz(busy)
*.pdfsync

## Build tool directories for auxiliary files
# latexrun
latex.out/

## Auxiliary and intermediate files from other packages:
# algorithms
*.alg
*.loa

# achemso
acs-*.bib

# amsthm
*.thm

# beamer
*.nav
*.pre
*.snm
*.vrb

# changes
*.soc

# comment
*.cut

# cprotect
*.cpt

# elsarticle (documentclass of Elsevier journals)
*.spl

# endnotes
*.ent

# fixme
*.lox

# feynmf/feynmp
*.mf
*.mp
*.t[1-9]
*.t[1-9][0-9]
*.tfm

#(r)(e)ledmac/(r)(e)ledpar
*.end
*.?end
*.[1-9]
*.[1-9][0-9]
*.[1-9][0-9][0-9]
*.[1-9]R
*.[1-9][0-9]R
*.[1-9][0-9][0-9]R
*.eledsec[1-9]
*.eledsec[1-9]R
*.eledsec[1-9][0-9]
*.eledsec[1-9][0-9]R
*.eledsec[1-9][0-9][0-9]
*.eledsec[1-9][0-9][0-9]R

# glossaries
*.acn
*.acr
*.glg
*.glo
*.gls
*.glsdefs
*.lzo
*.lzs

# uncomment this for glossaries-extra (will ignore makeindex's style files!)
# *.ist

# gnuplottex
*-gnuplottex-*

# gregoriotex
*.gaux
*.glog
*.gtex

# htlatex
*.4ct
*.4tc
*.idv
*.lg
*.trc
*.xref

# hyperref
*.brf

# knitr
*-concordance.tex
# TODO Uncomment the next line if you use knitr and want to ignore its generated tikz files
# *.tikz
*-tikzDictionary

# listings
*.lol

# luatexja-ruby
*.ltjruby

# makeidx
*.idx
*.ilg
*.ind

# minitoc
*.maf
*.mlf
*.mlt
*.mtc[0-9]*
*.slf[0-9]*
*.slt[0-9]*
*.stc[0-9]*

# minted
_minted*
*.pyg

# morewrites
*.mw

# newpax
*.newpax

# nomencl
*.nlg
*.nlo
*.nls

# pax
*.pax

# pdfpcnotes
*.pdfpc

# sagetex
*.sagetex.sage
*.sagetex.py
*.sagetex.scmd

# scrwfile
*.wrt

# sympy
*.sout
*.sympy
sympy-plots-for-*.tex/

# pdfcomment
*.upa
*.upb

# pythontex
*.pytxcode
pythontex-files-*/

# tcolorbox
*.listing

# thmtools
*.loe

# TikZ & PGF
*.dpth
*.md5
*.auxlock

# todonotes
*.tdo

# vhistory
*.hst
*.ver

# easy-todo
*.lod

# xcolor
*.xcp

# xmpincl
*.xmpi

# xindy
*.xdy

# xypic precompiled matrices and outlines
*.xyc
*.xyd

# endfloat
*.ttt
*.fff

# Latexian
TSWLatexianTemp*

## Editors:
# WinEdt
*.bak
*.sav

# Texpad
.texpadtmp

# LyX
*.lyx~

# Kile
*.backup

# gummi
.*.swp

# KBibTeX
*~[0-9]*

# TeXnicCenter
*.tps

# auto folder when using emacs and auctex
./auto/*
*.el

# expex forward references with \gathertags
*-tags.tex

# standalone packages
*.sta

# Makeindex log files
*.lpz

# xwatermark package
*.xwm

# REVTeX puts footnotes in the bibliography by default, unless the nofootinbib
# option is specified. Footnotes are the stored in a file with suffix Notes.bib.
# Uncomment the next line to have this generated file ignored.
#*Notes.bib

### LaTeX Patch ###
# LIPIcs / OASIcs
*.vtc

# glossaries
*.glstex

### Vim ###
# Swap
[._]*.s[a-v][a-z]
!*.svg  # comment out if you don't need vector files
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]

# Session
Session.vim
Sessionx.vim

# Temporary
.netrwhist
*~
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~

# End of https://www.toptal.com/developers/gitignore/api/vim,latex

A  => LICENSE +24 -0
@@ 1,24 @@
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <https://unlicense.org>

A  => README.md +13 -0
@@ 1,13 @@
# Pandoc letter template

A simple Pandoc template for writing a letter.

See [example.pdf](./example.pdf) for an example, generated from `example.md`.

Check the `makefile` for the build command.

Requires pandoc and latex installed obviously. On my Arch Linux system I can build with
the following packages: `pandoc-bin`, `texlive-bin`, `texlive-core`,
`texlive-latexextra`.

Public domain, use as you wish.

A  => example.md +49 -0
@@ 1,49 @@
---
author: Joe Bloggs
date: 01 Jan 2000
address: 
	- To name
	- To street
	- To city
	- To postcode
return-address: 
	- From address
	- From city
	- From postcode
opening: Dear Sir or Madam,
closing: Yours faithfully,
subject: Optional subject
...

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec varius ex purus, vel
malesuada risus laoreet non. Nam efficitur, massa eu consectetur aliquam, ligula lectus
convallis nunc, eu fermentum lorem purus a elit. Vivamus lobortis, ante a blandit
blandit, magna arcu blandit turpis, eu ullamcorper mi lacus id justo. Sed eget venenatis
eros, ultricies tincidunt ante. Fusce molestie nisi ut lacus placerat lacinia id vitae
mi. In a cursus nisi. Nulla consectetur enim at imperdiet fringilla. Proin sit amet
malesuada odio. Mauris ac elementum magna, vitae ultricies ex. Integer ac laoreet mi.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi volutpat lobortis justo,
vel venenatis lorem posuere vel. Mauris non auctor erat, et ultricies lacus. Interdum et
malesuada fames ac ante ipsum primis in faucibus. Mauris pulvinar consequat tortor, vel
volutpat erat porttitor vel. Interdum et malesuada fames ac ante ipsum primis in
faucibus.

Morbi eleifend neque at sollicitudin euismod. Cras id euismod nibh, eu efficitur ex.
Vivamus viverra tincidunt dui, ac finibus libero tincidunt at. Donec elementum accumsan
tellus. Sed bibendum efficitur enim et laoreet. Proin vulputate, velit quis rhoncus
porttitor, mi orci vulputate mi, id ultricies lectus nisl eget leo. Morbi eros ante,
laoreet a est vitae, scelerisque rutrum elit. Mauris iaculis magna ex, sit amet vehicula
enim fermentum sed. Praesent sapien erat, maximus vel arcu id, sagittis vestibulum
justo. Curabitur eu urna in mi commodo dignissim. Donec malesuada erat ac eros
consectetur efficitur. Maecenas ultrices, eros eget maximus auctor, urna magna maximus
urna, nec suscipit ex eros vel augue. Sed sed condimentum mi, vitae egestas magna.
Nullam non quam at risus sodales tempus consequat fermentum sapien. Etiam vel tristique
metus, vel viverra orci. Proin sit amet sollicitudin metus, quis pretium risus.

Integer faucibus elit urna, et sollicitudin urna maximus ac. Quisque nec orci elementum,
blandit magna at, mollis nunc. Nunc euismod, est ac ultricies mattis, eros nibh egestas
nisl, a vulputate ex felis ac risus. Nullam in tellus quis leo sollicitudin porttitor.
Donec libero leo, placerat nec ullamcorper sed, tempus sed nibh. Sed dapibus scelerisque
sapien, ut aliquet lectus. Vivamus vitae elit lacinia, ultricies lectus et, ornare arcu.
Pellentesque id justo porta, laoreet urna ut, fringilla lectus. Praesent id urna non est
mattis bibendum.

A  => example.pdf +0 -0
A  => makefile +11 -0
@@ 1,11 @@
.PHONY: pdf
pdf: example.pdf

.PHONY: latex
latex: example.tex
	
example.pdf:
	pandoc --from markdown --to pdf --template template.tex -o example.pdf example.md
	
example.tex:
	pandoc --from markdown --to pdf --template template.tex -o example.tex example.md

A  => template.tex +62 -0
@@ 1,62 @@
\documentclass{letter}
\usepackage[
	a4paper,
	margin=1in,
]{geometry}

\usepackage{hyperref}
\hypersetup{
$if(meta-lang)$
	pdflang={$meta-lang$},
$endif$
$if(meta-keywords)$
	pdfkeywords={$for(meta-keywords)$$meta-keywords$$sep$, $endfor$},
$endif$
	pdfauthor={$author$},
	pdfcreator={LaTeX via pandoc},
	colorlinks=true,
	linkcolor=blue,
	citecolor=blue,
	urlcolor=blue
  }

% Support for pandoc's {.underline} class
\newcommand{\uline}{\underline}

% https://github.com/aaronwolen/pandoc-letter/blob/b0fd7342b352ebb87aea17614ec014f68d48747f/template-letter.tex#L163
% Make links footnotes instead of hotlinks:
\DeclareRobustCommand{\href}[2]{#2\footnote{\url{#1}}}

% https://github.com/aaronwolen/pandoc-letter/blob/b0fd7342b352ebb87aea17614ec014f68d48747f/template-letter.tex#L248
\usepackage{mdframed} % color is loaded by mdframed
\definecolor{greyborder}{RGB}{221,221,221}
\definecolor{greytext}{RGB}{119,119,119}
\newmdenv[rightline=false,bottomline=false,topline=false,linewidth=3pt,linecolor=greyborder,skipabove=\parskip]{blockquote}
\renewenvironment{quote}{\begin{blockquote}\list{}{\rightmargin=0em\leftmargin=0em}%
\item\relax\color{greytext}\ignorespaces}{\unskip\unskip\endlist\end{blockquote}}

\signature{$author$}
\address{$author$\\$for(return-address)$$return-address$$sep$\\$endfor$}
\date{$date$}

\begin{document}

\begin{letter}{$for(address)$$address$$sep$\\$endfor$$if(subject)$\\ ~ \\ \textbf{$subject$}$endif$}

\opening{$opening$}

$body$

\longindentation=0pt
\closing{$closing$}

$if(ps)$
\ps{$ps$}
$endif$

$if(encl)$
\encl{$for(encl)$$encl$$sep$\\$endfor$}
$endif$

\end{letter}
\end{document}