0

Why this does not work?

\fbox{
  \begin{pycode}
     print (1+1)
  \end{pycode}
 }

Is there a way around?

  • 1
    Could you expand your code to a MWE? – Alenanno Jul 10 '16 at 18:57
  • @Alenanno I have been preceded by egreg (see answer below). – Primo Petri Jul 11 '16 at 6:41
  • Yes, I saw that. Please remember about it next time. :) – Alenanno Jul 11 '16 at 8:52
3

You can't use the pycode environment in the argument to another command.

\documentclass{article}
\usepackage{pythontex}

\newsavebox{\pycodebox}

\begin{document}

\begin{lrbox}{\pycodebox}
\begin{pycode}
print (1+1)
\end{pycode}
\end{lrbox}

\fbox{\usebox{\pycodebox}}

\end{document}

enter image description here

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.