Skip to content

Issue with pythonrepl with last version (0.62) #26

@cpierquet

Description

@cpierquet

Hi- I've updated my texlive (with 0.6.2 pyluatex) and since I've got problem with repl environment...
When I want to show several repl, the first isn't executed, and the second show the first, etc

\documentclass[a4paper,11pt]{article}
\usepackage{listings}
\lstset{basicstyle=\footnotesize\ttfamily,breaklines=true,tabsize=4}
\usepackage[executable=python]{pyluatex}

\NewDocumentEnvironment{PitonREPL}{ !O{} }% le ! est obligatoire
{
	\PyLTVerbatimEnv
	\begin{pythonrepl}
}
{
		\directlua
		{
			tex.print("\\begin{lstlisting}[language=Python]")
			tex.print(pyluatex.get_last_output())
			tex.print("\\end{lstlisting}")
			tex.print("")
		}
	\end{pythonrepl}
}

\begin{document}

\section{First attempt}

\begin{lstlisting}[language=Python]
# Table de multiplication par nb jusqu’à dernier×nb
def table_mult(nb, dernier) :
	for i in range(0, dernier+1) :
		print(f"{i}*{nb}={i*nb}")
\end{lstlisting}

\begin{PitonREPL}
def table_mult(nb,dernier) :
	for i in range(0, dernier+1) :
		print(f"{i}*{nb}={i*nb}")

table_mult(7,10)
table_mult(4,5)
\end{PitonREPL}

\section{Second attempt}

\begin{lstlisting}[language=Python]
# Factorielle
def factorielle(n) :
	Fact = 1
	for i in range(1,n+1):
		Fact = Fact*i
	return(Fact)
\end{lstlisting}

\begin{PitonREPL}
# Factorielle
def factorielle(n) :
	Fact = 1
	for i in range(1,n+1):
		Fact = Fact*i
	return(Fact)

factorielle(5)
factorielle(47)
\end{PitonREPL}

\end{document}

image

Edit : with 0.6.1 (restored via tlmgr) it's working

image

Céd-

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions