I just discovered the python package, and I'm trying to use it in Tikz code. Unfortunately, this doesn't work:
\documentclass[oneside]{memoir}
\usepackage{pgfplots}
\usepackage{python}
\begin{document}
\begin{figure}[H]
\centering
\begin{tikzpicture}
\draw (0, 0) -- (
\begin{python}
print(1) # note that my default Python version is 3.2, so this works outside the tikzpicture environment.
\end{python}
, 0);
\end{tikzpicture}
\caption{Blah.}
\end{figure}
\end{document}
The first error I get is:
Runaway argument? {pgf@tempcolor}{\def \@currenvir {python}\edef \@currenvline {\on@line \ETC. ! Paragraph ended before \XC@definec@lor was complete. \par l.13 print(1)
I suspect you've forgotten a `}', causing me to apply this control sequence to too much text. How can we recover? My plan is to forget the whole thing and hope for the best.
Is it possible to get something like this work? Maybe with a different python package? Also, is there a way to make it so that the Python definitions persist between embedded environments?