gpoore / pythontex

A LaTeX package that executes Python and other code in LaTeX documents, and includes the output
880 stars 99 forks source link

Figure environment for tikzfigure #88

Closed TheChymera closed 7 years ago

TheChymera commented 8 years ago

I am trying to create my first LaTeX poster, and obviously I would want PythonTeX to be part of it. As far as I could tell the best package for that atm is tikzposter, however, the normal LaTeX figure environment seems to not work in tikzposter documents, and instead they recommend using a tikzfigure environment:

\begin{tikzfigure}[Ascending serotonergic projections alone innervate the majority of cortical and subcortical areas \cite{Oegren2008}]
    \label{fig:fig2}
    \includegraphics[scale=0.6]{img/drn_mr_p.png}
\end{tikzfigure}

I found some talk on the web about how that would not work with the usual PythonTeX figure environment. However, I saw no example of how to make it work. There is this example but it does not actually call on matplotlib to create a figure. Have you had any exposure to this, any idea how I could best deal with this?

gpoore commented 8 years ago

I haven't used tikzposter, and the documentation and tex.stackexchange.com don't have any information about working with verbatim content. So you will probably just have to experiment.

My guess is that the PythonTeX environments should work outside of the tikzposter environments. They might not work inside the tikzposter environments, but it's likely that the PythonTeX commands would still work.

In the example you linked to, the basic problem was that due to the way TikZ works, it's usually not possible to use \py or \pyc or an environment to insert Python output within a line of TikZ code. However, using Python to output a complete line of TikZ code works fine. I would expect that tikzposter will be similar.