Hello!
I more or less work on a project, where I would like to use a neat graphics package to include into my LaTeX code, that I execute from the python flask script. I am quite happy (LaTeX support since 2012, as I read in one of your blog articles, great stuff!) that I can render with the pre-installed texLive simple PDFs, but the moment I include the tikz package in the code, it seems to evoke problems. Tikz is part of the PGF macro package for LaTeX. Would it be possible, or feasible from your perspective .. to be installed by one of you PAnywherians in the center of things, please? Or of course as well I'd be happy to get any advice how to install the macro package PGF myself / yet I think it's too hardcore package installing, not comparable to the pip install python package installing.. I think I could not easily transfer the task to a python graphics libraries. Thanks in advance!
Greetings,
Robert
So, to clarify, when I in the code below exchanged the content = r''' ... ''' with something very simple LaTeX, it would work and produce a valid PDF.
Possibly, you don't need any code example, because it is some kind of dependencies question. Nevertheless, this is my code I try to run - which by the way basically should produce some spiral text:
import argparse
import os
import subprocess
content = r'''\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{decorations.text}
\begin{document}
\begin{tikzpicture}[
decoration={
reverse path,
text effects along path,
text={Lorem ipsum dolor sit amet, consectetur adipisicing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt
inculpa qui officia deserunt mollit anim id est laborum.},
text effects/.cd,
text along path,
character count=\i, character total=\n,
characters={scale=1-\i/\n}
}
]
\draw [decorate] (0,0)
\foreach \i [evaluate={\r=(\i/2000)^2;}] in {0,5,...,2880}{ -- (\i:\r)};
\end{tikzpicture}
\end{document}'''
parser = argparse.ArgumentParser()
parser.add_argument('-c', '--course')
parser.add_argument('-t', '--title')
parser.add_argument('-n', '--name',)
parser.add_argument('-s', '--school', default='My U')
args = parser.parse_args()
with open('cover.tex','w') as f:
f.write(content%args.__dict__)
cmd = ['pdflatex', '-interaction', 'nonstopmode', 'cover2.tex']
proc = subprocess.Popen(cmd)
proc.communicate()
retcode = proc.returncode
if not retcode == 0:
os.unlink('cover.pdf')
raise ValueError('Error {} executing command: {}'.format(retcode, ' '.join(cmd)))
os.unlink('cover2.tex')
os.unlink('cover2.log')