""" Adds functionality to make LaTeX figures from the raw TikZ code produced by
core.StreamerFlowchart.
"""
FIGURE = r'''\begin{{figure}}
\centering
\begin{{tikzpicture}}[{tikzoptions}]
{tikz}
\end{{tikzpicture}}
\caption{{Flowchart of {name}}}
\end{{figure}}'''
DOCUMENT = r'''\documentclass{{scrartcl}}
\usepackage{{fontspec}}
\usepackage{{tikz}}
\usetikzlibrary{{shapes, arrows, positioning}}
\usepackage{{xcolor}}
\input{{colors}}
\input{{tikzstyles}}
\begin{{document}}
{figures}
\end{{document}}
'''
[docs]def indent(spaces, multilinestring):
""" Indents a given multilinestring by a given number of spaces. This is
used to produce properly formatted LaTeX documents.
"""
indentation = ' ' * spaces
return '\n{}'.format(indentation).join(multilinestring.split('\n'))
[docs]def make_document(figures):
""" Generates a LaTeX document from a given list of figures produced by
hltflow.latex.make_figure.
"""
return DOCUMENT.format(figures='\n\n'.join(figures))