3

I'm trying to use PythonTex (v 0.14), its pyconsole environment, and custom commands, and having some trouble. Here is an MWE:

\documentclass[article,letterpaper,times,11pt]{article}
\usepackage[gobble=auto]{pythontex}

\pythontexcustomc{py}{a=1; b=2} 

\begin{document}

\begin{pyconsole}
print a
\end{pyconsole}

\end{document}

The result is an error that a is undefined. How can I execute custom code for pyconsole? I've tried \pythontexcustomc{pyconsole}, \pythontexcustomc{py}, and \pythontexcustomc{console}.

mankoff
  • 2,756

1 Answers1

6

You want \pythontexcustomc{pycon}{a=1; b=2}. pycon goes with the pyconsole environment, while py goes with the pycode environment. Everything console-related uses pycon somewhere in the name.

G. Poore
  • 12,417