-
-
Save petereichinger/c4715f7b7cd2c4af7ed4 to your computer and use it in GitHub Desktop.
markdown to pdf with additional packages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, sys | |
markdown_name = sys.argv[1] | |
name = markdown_name.split(".")[0] | |
latex_name = name + ".tex" | |
os.system("pandoc -f markdown -t latex %s -o %s" % (markdown_name, latex_name)) | |
with open(latex_name, "r") as latex_file: | |
latex_content = latex_file.read() | |
latex_content = """ | |
\documentclass[a4paper,12pt,parskip=full]{scrartcl} | |
\usepackage{setspace} | |
\usepackage{graphicx} | |
\usepackage{hyperref} | |
\usepackage{longtable} | |
\usepackage{booktabs} | |
\doublespacing | |
\\begin{document} | |
%s | |
\end{document} | |
""" % (latex_content) | |
with open(latex_name, "w") as latex_file: | |
latex_file.write(latex_content) | |
os.system("pdflatex %s" % (latex_name)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Adds graphics hyperref longtable and booktabs packages