Created
August 27, 2015 04:24
-
-
Save Tabea-K/cfe179ea2c09e41fef8d to your computer and use it in GitHub Desktop.
Uses TeX to create a pdf file with the visualization of an alignment.
This file contains 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
#!/usr/bin/env python | |
""" | |
Creates a pdf alignment | |
""" | |
import sys | |
import os | |
import tempfile | |
input_filename = sys.argv[1] | |
tex_document = r"""\documentclass[12pt]{amsart} | |
\usepackage{geometry} | |
\geometry{a4paper} | |
\usepackage{texshade} | |
\begin{document} | |
\section*{%s} | |
\begin{texshade}{%s} | |
\end{texshade} | |
\end{document} | |
""" % (input_filename, input_filename) | |
temp_tex_file = tempfile.NamedTemporaryFile(delete=False) | |
temp_tex_filename = temp_tex_file.name | |
with open(temp_tex_filename, 'w') as fh: | |
fh.write(tex_document) | |
print('pdflatex %s' % temp_tex_filename) | |
os.system('pdflatex %s' % temp_tex_filename) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment