diff options
author | Karl Berry <karl@freefriends.org> | 2021-07-14 21:10:34 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-07-14 21:10:34 +0000 |
commit | 4afc0e03308d532d963e3fad3bbf4be9500276e7 (patch) | |
tree | cb819a8887384a9ff3bbe8379d47245bd886168b /Master/texmf-dist/doc/lualatex/pyluatex/README.md | |
parent | b235b9fd711ecd18d5db0a03640dc291f5a643cb (diff) |
pyluatex (14jul21)
git-svn-id: svn://tug.org/texlive/trunk@59928 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/lualatex/pyluatex/README.md')
-rw-r--r-- | Master/texmf-dist/doc/lualatex/pyluatex/README.md | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/lualatex/pyluatex/README.md b/Master/texmf-dist/doc/lualatex/pyluatex/README.md new file mode 100644 index 00000000000..f9e727fabfd --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/pyluatex/README.md @@ -0,0 +1,56 @@ +# PyLuaTeX +**Execute Python code on the fly in your LaTeX documents** + +PyLuaTeX allows you to execute Python code and to include the resulting output in your LaTeX documents in a *single compilation run*. +LaTeX documents must be compiled with LuaLaTeX for this to work. + + +## Example +1\. LaTeX document `example.tex` +```latex +\documentclass{article} + +\usepackage{pyluatex} + +\begin{python} +import math +import random + +random.seed(0) + +greeting = 'Hello PyLuaTeX!' +\end{python} + +\newcommand{\randint}[2]{\py{random.randint(#1, #2)}} + +\begin{document} +\py{greeting} + +$\sqrt{371} = \py{math.sqrt(371)}$ + +\randint{2}{5} +\end{document} +``` +2\. Compile using LuaLaTeX (shell escape is required) +``` +lualatex -shell-escape example.tex +``` + +**Note:** Running LaTeX with the shell escape option enabled allows arbitrary code to be +executed. For this reason, it is recommended to compile trusted documents only. + +## Requirements +* LuaLaTeX +* Python 3 +* Linux, macOS or Windows + +Our automated tests currently use TeX Live 2021 and Python 3.7+ on +Ubuntu 20.04, macOS Catalina 10.15 and Windows Server 2019. + +## License +[LPPL 1.3c](http://www.latex-project.org/lppl.txt) for LaTeX code and +[MIT license](https://opensource.org/licenses/MIT) for Python and Lua code. + +We use the great [json.lua](https://github.com/rxi/json.lua) library under the terms +of the [MIT license](https://opensource.org/licenses/MIT). + |