I have a problem with PythonTeX and Beamer : I don't understand why the code below doesn't work: \stdoutpythontex
is supposed to print the last output of the last block of python instructions, but it doesn't here.
Moreover, when you call \stderrpythontex
, the line number is false, even with the option fragile=singleslide
.
Could you please help me with this?
\documentclass{beamer}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[framemethod=TikZ]{mdframed}
\usepackage[makestderr]{pythontex}
\usepackage{multicol}
\begin{document}
\begin{frame}[fragile]
\frametitle{Affichage à l'écran: Commande \pyv{print()} }
\begin{itemize}
\item En mode console: résultats automatiquement affichés.
\item Dans l'éditeur: utiliser \pyv{print()}
\end{itemize}
%
\begin{pyblock}[][numbers=left]
a, b = 2, 3
print(a, 'hello', a+b)
\end{pyblock}
%
a pour résultat
\stdoutpythontex
De plus,
\begin{pyblock}[][numbers=left]
a = 5
print('a vaut ' a)
\end{pyblock}
donne
\stderrpythontex
\end{frame}
\end{document}
`
to mark your inline code as I did in my edit.