I try to define an environment called "codeaux" printing a piece of python code inside a mdframed environment. After that my aim will be to redefine "codeaux" in a pyconsole version (pyblock/verbatim for student notes, and pyconsole for teacher notes).
I tried the following solution, but it doesn't work and I don't know why.
\documentclass[a4paper,8pt,table]{book}
\usepackage{color}
\usepackage{tikz,tikzpagenodes,tkz-tab}
\usepackage{tikzsymbols}
\usetikzlibrary{shadows,matrix,arrows,decorations.pathmorphing,snakes,arrows,shapes,plotmarks,shapes.geometric,decorations.markings,positioning,calc}
\usepackage{pythontex}
\usepackage[usetwoside=false]{mdframed}
\newenvironment{code}{%
\begin{mdframed}[linecolor=green,innerrightmargin=30pt,innerleftmargin=30pt,backgroundcolor=white,skipabove=10pt,skipbelow=10pt,roundcorner=5pt,splitbottomskip=6pt,splittopskip=12pt]
}{%
\end{mdframed}
}
\newenvironment{codeaux}{\begin{code}
\begin{pyblock}[][numbers=left]
}
{\end{pyblock}
\end{code}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{code}
\begin{pyverbatim}[][numbers=left]
type(42)
type(2.5)
type('Bonjour')
\end{pyverbatim}
\end{code}
\begin{pyblock}
type(42)
type(2.5)
type('Bonjour')
\end{pyblock}
\begin{codeaux}
type(42)
type(2.5)
type('Bonjour')
\end{codeaux}
\end{document}
\VerbatimEnvironment. See https://tex.stackexchange.com/a/171712/10742. – G. Poore Oct 12 '18 at 23:16pyblockworks fine for me. If you can't get it working, consider either updating this question with your current code, or asking a new question. – G. Poore Oct 15 '18 at 13:55