Debian Codegraph @

texmf-dist/doc/latex/pythonhighlight/README.md

raw
1 Python highlighting in LaTeX
2 ============================
3
4 A simple Python highlighting style to be used with LaTeX.
5
6 The package is loaded by the following line:
7
8 ```tex
9 \usepackage{pythonhighlight}
10 ```
11
12 It is then possible to include a Python snippet directly in the code using:
13
14 ```tex
15 \begin{python}
16 def f(x):
17 return x
18 \end{python}
19 ```
20
21 It is also possible to include inline Python code in LaTeX with ``\pyth``:
22
23 ```tex
24 The special method \pyth{__init__}...
25 ```
26
27 Last but not least, you can load an external Python file with:
28 ```tex
29 \inputpythonfile{python_file.py}[23][50]
30 ```
31 to display the contents of the file ``python_file`` from line 23 to line 50,
32 or with
33 ```tex
34 \inputpythonfile{python_file.py}
35 ```
36 to input the whole Python file.