diff options
Diffstat (limited to 'Master/texmf-dist/doc')
-rw-r--r-- | Master/texmf-dist/doc/lualatex/pyluatex/README.md | 1 | ||||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.pdf | bin | 78301 -> 79524 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.tex | 17 |
3 files changed, 13 insertions, 5 deletions
diff --git a/Master/texmf-dist/doc/lualatex/pyluatex/README.md b/Master/texmf-dist/doc/lualatex/pyluatex/README.md index 6c8015dce92..3165301bd89 100644 --- a/Master/texmf-dist/doc/lualatex/pyluatex/README.md +++ b/Master/texmf-dist/doc/lualatex/pyluatex/README.md @@ -36,7 +36,6 @@ $\sqrt{371} = \py{math.sqrt(371)}$ \randint{2}{5} \end{document} ``` - 2\. Compile using LuaLaTeX (shell escape is required) ``` lualatex -shell-escape example.tex diff --git a/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.pdf b/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.pdf Binary files differindex 58d2de88e15..49fee5afac4 100644 --- a/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.pdf +++ b/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.pdf diff --git a/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.tex b/Master/texmf-dist/doc/lualatex/pyluatex/pyluatex.tex index ffaf503914c..d6c03253508 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.2.0 (2021/07/26)} +\date{v0.3.0 (2021/08/07)} \begin{document} \maketitle \raggedright @@ -58,8 +58,6 @@ $\sqrt{371} = \py{math.sqrt(371)}$ \randint{2}{5} \end{document} \end{tcblisting} -\end{enumerate} -\begin{enumerate} \item Compile using Lua\LaTeX{} (shell escape is required) \begin{tcblisting}{breakable,listing only, size=fbox,colframe=black!8,boxrule=3pt,colback=black!8} @@ -178,6 +176,16 @@ For an example, see the Typesetting Code section. \item \inlcode|pythonq|\\[0.5ex] Same as the \inlcode|python| environment, but any output is suppressed. \end{itemize} +You can create your own environments based on the \inlcode|python| and \inlcode|pythonq| environments. +However, since they are verbatim environments, you have to use the macro \inlcode|\PyLTVerbatimEnv| +in your environment definition, e.g. +\begin{tcblisting}{breakable,listing only, + size=fbox,colframe=black!8,boxrule=3pt,colback=black!8} +\newenvironment{custompy} +{\PyLTVerbatimEnv\begin{python}} +{\end{python}} +\end{tcblisting} + \section{Requirements} \begin{itemize} \item Lua\LaTeX{} @@ -194,7 +202,7 @@ However, PyLuaTeX has a \textbf{code and output buffer} which you can use to cre This provides a lot of flexibility for your typesetting. After a PyLuaTeX macro or environment has been executed, the corresponding Python code and output can be accessed via the Lua functions \inlcode|pyluatex.get_last_code()| and \inlcode|pyluatex.get_last_output()|, respectively. -Both functions return a Lua table\footnote{\url{https://www.lua.org/pil/2.5.html}} where each table item corresponds to a line of code or output. +Both functions return a Lua table\footnote{\url{https://www.lua.org/pil/2.5.html}} (basically an array) where each table item corresponds to a line of code or output. A simple example for typesetting code and output using the \textit{listings} package would be: \begin{tcblisting}{breakable,listing only, @@ -238,6 +246,7 @@ Notice that we use the \inlcode|pythonq| environment, which suppresses any outpu After that, the custom macro \inlcode|\pytypeset| is responsible for typesetting the code and its output. Using a different code listings package like \textit{minted}, or typesetting inline code is very easy. +You can also define your own environments that combine Python code and typesetting. See the \inlcode|typesetting-*.tex| examples in the \inlcode|example| folder. \section{How It Works} |