From 80aa3b5de37b11d9f895cf844adcd9bb8fc127d2 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 5 Jun 2022 21:02:04 +0000 Subject: pyluatex (5jun22) git-svn-id: svn://tug.org/texlive/trunk@63491 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/lualatex/pyluatex/README.md | 6 +-- .../doc/lualatex/pyluatex/example/beamer.tex | 38 +++++++++++------- .../doc/lualatex/pyluatex/example/repl.tex | 4 +- .../texmf-dist/doc/lualatex/pyluatex/pyluatex.pdf | Bin 81863 -> 82658 bytes .../texmf-dist/doc/lualatex/pyluatex/pyluatex.tex | 43 +++++++++++---------- 5 files changed, 51 insertions(+), 40 deletions(-) (limited to 'Master/texmf-dist/doc') diff --git a/Master/texmf-dist/doc/lualatex/pyluatex/README.md b/Master/texmf-dist/doc/lualatex/pyluatex/README.md index a6faac70c23..c93a3b8c8bf 100644 --- a/Master/texmf-dist/doc/lualatex/pyluatex/README.md +++ b/Master/texmf-dist/doc/lualatex/pyluatex/README.md @@ -34,7 +34,7 @@ $\sqrt{371} = \py{math.sqrt(371)}$ ``` **Note:** PyLuaTeX starts Python 3 using the command `python3` by default. If `python3` does not start Python 3 on your system, find the correct command -and replace `\usepackage{pyluatex}` with `\usepackage[executable={your python command}]{pyluatex}`. +and replace `\usepackage{pyluatex}` with `\usepackage[executable=]{pyluatex}`. For example, `\usepackage[executable=python.exe]{pyluatex}`. 2\. Compile using LuaLaTeX (shell escape is required) @@ -49,8 +49,8 @@ executed. For this reason, it is recommended to compile trusted documents only. * Python 3 * Linux, macOS or Windows -Our automated tests currently use TeX Live 2021 and Python 3.7+ on -Ubuntu 20.04, macOS Big Sur 11 and Windows Server 2019. +The automated tests currently use TeX Live 2022 and Python 3.8+ on +Ubuntu 20.04, macOS Big Sur 11 and Windows Server 2022. ## License [LPPL 1.3c](http://www.latex-project.org/lppl.txt) for LaTeX code and diff --git a/Master/texmf-dist/doc/lualatex/pyluatex/example/beamer.tex b/Master/texmf-dist/doc/lualatex/pyluatex/example/beamer.tex index 6dea2ea6c96..31ba69db821 100644 --- a/Master/texmf-dist/doc/lualatex/pyluatex/example/beamer.tex +++ b/Master/texmf-dist/doc/lualatex/pyluatex/example/beamer.tex @@ -8,7 +8,7 @@ %% and version 1.3c or later is part of all distributions of LaTeX %% version 2005/12/01 or later. -\documentclass{beamer} +\documentclass[t]{beamer} \usepackage{pyluatex} \usepackage{listings} @@ -64,13 +64,17 @@ end %%%%%%%%%%%%%%%%%%%%%% frame \begin{frame}{Important} -Using PyLuaTeX environments (\emph{python} or \emph{pythonq}) inside BEAMER frames -requires the \emph{fragile} option for those frames. +Using PyLuaTeX environments (\texttt{python}, \texttt{pythonq}, or \texttt{pythonrepl}) inside BEAMER frames +requires the \texttt{fragile} option for those frames. + +\medskip +If you don't use overlays in a frame, i.e. the frame contains only a single slide, +you can use the \texttt{fragile=singleslide} option. \end{frame} %%%%%%%%%%%%%%%%%%%%%% frame -\begin{frame}[fragile]{Slide 1} +\begin{frame}[fragile=singleslide]{Python environment inside frame} \begin{pythonq} msg = 'Hello slide 1' @@ -96,27 +100,31 @@ msg = 'Hello slide 2' print(msg) \end{pythonq} -\begin{frame}{Slide 1} +\begin{frame}{Python environment outside frame} \pytypeset -The \emph{fragile} option is not required in this frame because -the \emph{pythonq} environment is outside the frame. -Only the macro \emph{\textbackslash pytypeset} for typesetting the code and output is inside +The \texttt{fragile} option is not required in this frame because +the \texttt{pythonq} environment is outside the frame. +Only the macro \texttt{\textbackslash pytypeset} for typesetting the code and output is inside the frame. + +\medskip +Inline Python still works: The result of \pyq{17 + 300}$\coderaw$ is \outputraw \end{frame} %%%%%%%%%%%%%%%%%%%%%% frame -\newenvironment{typesetpython} - {\PyLTVerbatimEnv\begin{pythonq}} - {\end{pythonq}\pytypeset} - -\begin{frame}[fragile]{Slide 2} -\begin{typesetpython} +\begin{frame}[fragile]{Overlays} +\begin{pythonq} msg = 'Custom environment' print(msg) -\end{typesetpython} +\end{pythonq} +\pytypeset +\pause + +In this frame, \texttt{fragile} is required instead of \texttt{fragile=singleslide}, +because we use overlays. \end{frame} \end{document} diff --git a/Master/texmf-dist/doc/lualatex/pyluatex/example/repl.tex b/Master/texmf-dist/doc/lualatex/pyluatex/example/repl.tex index 28de0090cf9..8622223ef3c 100644 --- a/Master/texmf-dist/doc/lualatex/pyluatex/example/repl.tex +++ b/Master/texmf-dist/doc/lualatex/pyluatex/example/repl.tex @@ -57,9 +57,9 @@ square(5) \maketitle PyLuaTeX allows you to run and typeset Python code in an interactive console -or read–eval–print loop (REPL) fashion. Very much like in an IPython session, +or read–eval–print loop (REPL) fashion. Very much like in an interactive python session, code is prefixed with \verb|>>>| (or \verb|...| in case of multi-line commands) -and the results are printed automatically. +and the results are added to the output buffer automatically. Both code and output are stored in PyLuaTeX's ouput buffer and can be accessed by \verb|pyluatex.get_last_output()|. In this way, you can adjust the typesetting diff --git a/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.pdf b/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.pdf index 82ff4f85bf1..c7710f6f78c 100644 Binary files a/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.pdf and b/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.pdf differ diff --git a/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.tex b/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.tex index c4a10738ac0..366a7ae8dae 100644 --- a/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.tex +++ b/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.tex @@ -15,7 +15,7 @@ \usepackage{url} \title{The \emph{pyluatex} package} \author{Tobias Enderle\\\url{https://github.com/tndrle/PyLuaTeX}} -\date{v0.4.4 (2022/03/16)} +\date{v0.5.0 (2022/06/05)} \begin{document} \maketitle \raggedright @@ -56,7 +56,7 @@ $\sqrt{371} = \py{math.sqrt(371)}$ \end{tcblisting} \textbf{Note:} PyLuaTeX starts Python 3 using the command \inlcode|python3| by default. If \inlcode|python3| does not start Python 3 on your system, find the correct command -and replace \inlcode|\usepackage{pyluatex}| with \inlcode|\usepackage[executable={your python command}]{pyluatex}|. +and replace \inlcode|\usepackage{pyluatex}| with \inlcode|\usepackage[executable=]{pyluatex}|. For example, \inlcode|\usepackage[executable=python.exe]{pyluatex}|. \item Compile using Lua\LaTeX{} (shell escape is required) \begin{tcblisting}{breakable,listing only, @@ -131,32 +131,35 @@ The package options \inlcode|verbose| and \inlcode|ignoreerrors| can be changed \subsection{Macros} \begin{itemize} -\item \inlcode|\py{code}|\\[0.5ex] - Executes (object-like) \inlcode|code| and writes its string representation to the document.\\[0.5ex] +\item \inlcode|\py{}|\\[0.5ex] + Executes (object-like) \inlcode|| and writes its string representation to the document.\\[0.5ex] \textit{Example:} \inlcode|\py{3 + 7}| -\item \inlcode|\pyq{code}|\\[0.5ex] - Executes (object-like) \inlcode|code|. Any output is suppressed.\\[0.5ex] +\item \inlcode|\pyq{}|\\[0.5ex] + Executes (object-like) \inlcode||. Any output is suppressed.\\[0.5ex] \textit{Example:} \inlcode|\pyq{3 + 7}| -\item \inlcode|\pyc{code}|\\[0.5ex] - Executes \inlcode|code|. Output (e.g. from a call to \inlcode|print()|) is written to the document.\\[0.5ex] +\item \inlcode|\pyc{}|\\[0.5ex] + Executes \inlcode||. Output (e.g. from a call to \inlcode|print()|) is written to the document.\\[0.5ex] \textit{Examples:} \inlcode|\pyc{x = 5}|, \inlcode|\pyc{print('hello')}| -\item \inlcode|\pycq{code}|\\[0.5ex] - Executes \inlcode|code|. Any output is suppressed.\\[0.5ex] +\item \inlcode|\pycq{}|\\[0.5ex] + Executes \inlcode||. Any output is suppressed.\\[0.5ex] \textit{Example:} \inlcode|\pycq{x = 5}| -\item \inlcode|\pyfile{path}|\\[0.5ex] - Executes the Python file specified by \inlcode|path|. Output (e.g. from a call to \inlcode|print()|) is written to the document.\\[0.5ex] +\item \inlcode|\pyfile{}|\\[0.5ex] + Executes the Python file specified by \inlcode||. Output (e.g. from a call to \inlcode|print()|) is written to the document.\\[0.5ex] \textit{Example:} \inlcode|\pyfile{main.py}| -\item \inlcode|\pyfileq{path}|\\[0.5ex] - Executes the Python file specified by \inlcode|path|. Any output is suppressed.\\[0.5ex] +\item \inlcode|\pyfileq{}|\\[0.5ex] + Executes the Python file specified by \inlcode||. Any output is suppressed.\\[0.5ex] \textit{Example:} \inlcode|\pyfileq{main.py}| -\item \inlcode|\pysession{session}|\\[0.5ex] - Selects \inlcode|session| as Python session for subsequent Python code.\\[0.5ex] +\item \inlcode|\pysession{}|\\[0.5ex] + Selects \inlcode|| as Python session for subsequent Python code.\\[0.5ex] The session that is active at the beginning is \inlcode|default|.\\[0.5ex] \textit{Example:} \inlcode|\pysession{main}| -\item \inlcode|\pyoption{option}{value}|\\[0.5ex] - Assigns \inlcode|value| to the package option \inlcode|option| anywhere in the document. For more information consider +\item \inlcode|\pyoption{