Skip to content

Instantly share code, notes, and snippets.

@Beyamor
Created August 6, 2013 00:34
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save Beyamor/6160968 to your computer and use it in GitHub Desktop.
Save Beyamor/6160968 to your computer and use it in GitHub Desktop.
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}
\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))
@kapad
Copy link

kapad commented Mar 30, 2018

what's the usage for this script?

@kapad
Copy link

kapad commented Mar 30, 2018

I've downloaded a wiki from a github project (by replacing .git with .wiki) in the clone url. Now I want to convert that entire wiki to a single pdf.. Can will this script work for that?

@evolunis-ws
Copy link

If you face problems with packages, use pandoc -s to use pandoc templates instead of introducing headers and footers manually

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