Replies: 1 comment
-
Suggestion \documentclass{article}
\usepackage{pyluatex}
\directlua{file = io.open("pythonq_output.py", "w")}
\AtEndDocument{\directlua{file:close()}}
% \string is required for TeX not to interpret \n as TeX command
% On Windows you might need an additional \r
\AddToHook{env/pythonq/after}{%
\directlua{file:write(table.concat(pyluatex.get_last_code(), "\string\n") .. "\string\n")}}
\begin{document}
\begin{pythonq}
a = 5
b = 7
\end{pythonq}
\begin{pythonq}
c = 9
\end{pythonq}
\py{a + b + c}
\end{document} Content of
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'd like to be able sometimes to run some code directly in a Python editor.
Is it possible to write the contents of
pythonq
environments to an external python file ? (if there are severalpythonq
, the code will be added to the previous python file). I don't know if it's possible to do this easily with pyluatex.Beta Was this translation helpful? Give feedback.
All reactions