This MWE is self explanatory:

% Compile this with pdflatex -> pythontex.py -> pdflatex




$\pi$ is \py{pi}





The \py and \pyb commands are executed via a Python script. The pyconsole environment is executed in a console emulation. So there isn't overlap between the two, and variables aren't shared. (Regular Python commands/environments always start with py, while everything console-related starts with pycon.)

You probably want to look into the \pycon and \pyconc commands. The first is used for getting the value of a variable, while the second allows you to run console code without showing anything. There is currently not a \pyconb. My reasoning is that showing code without output isn't console-like. But I might consider adding such a command in the future.

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.