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}.

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.