Skip to content

Instantly share code, notes, and snippets.

@twsh
twsh / scrlttr2.latex
Created June 15, 2023 15:44
The template from https://github.com/JensErat/pandoc-scrlttr2 updated for Pandoc 2.17.1.1
% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode$for(hyperrefoptions)$,$hyperrefoptions$$endfor$}{hyperref}
\PassOptionsToPackage{hyphens}{url}
$if(colorlinks)$
\PassOptionsToPackage{dvipsnames,svgnames,x11names}{xcolor}
$endif$
$if(CJKmainfont)$
\PassOptionsToPackage{space}{xeCJK}
$endif$
%
import re
import sys
# open and read the first argument
with open(sys.argv[1], "r") as in_file:
bibliography = in_file.read()
# Make sets of the citekeys found in the file, and of the entries
# The self_keys regex matches an upper or lower case cite, citep, citeyear, citeauthor,
# citeyearpar, and then anything between that and the first bracket