0

Why this does not work?

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

Is there a way around?

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

1 Answer 1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .