Debian Codegraph @

texmf-dist/doc/lualatex/pyluatex/example/readme-example.tex

raw
1 %% Copyright 2021-2026 Tobias Enderle
2 %%
3 %% This work may be distributed and/or modified under the
4 %% conditions of the LaTeX Project Public License, either version 1.3c
5 %% of this license or (at your option) any later version.
6 %% The latest version of this license is in
7 %% http://www.latex-project.org/lppl.txt
8 %% and version 1.3c or later is part of all distributions of LaTeX
9 %% version 2005/12/01 or later.
10
11 % DESCRIPTION
12 % The example above
13
14 \documentclass{article}
15
16 \usepackage{pyluatex}
17
18 \begin{python}
19 import math
20 import random
21
22 random.seed(0)
23
24 greeting = 'Hello PyLuaTeX!'
25 \end{python}
26
27 \newcommand{\randint}[2]{\py{random.randint(#1, #2)}}
28
29 \begin{document}
30 \py{greeting}
31
32 $\sqrt{371} = \py{math.sqrt(371)}$
33
34 \randint{2}{5}
35 \end{document}