| 1 |
\errorcontextlines=100 |
| 2 |
\documentclass[DIV=12]{scrartcl} |
| 3 |
|
| 4 |
\usepackage{libertinus-otf} |
| 5 |
\usepackage[force]{hvpygmentex} |
| 6 |
\usepackage{url} |
| 7 |
\title{Typeset highlited sourcecode} |
| 8 |
\author{Herbert Voß} |
| 9 |
\begin{document} |
| 10 |
\maketitle |
| 11 |
|
| 12 |
\section{Introduction} |
| 13 |
This package is fully compatible to package \texttt{pygmentex}. Read |
| 14 |
the package documentation (\url{http://ctan.org/pkg/pygmentex}) for the |
| 15 |
supported languages a.s.o. |
| 16 |
|
| 17 |
\begin{verbatim} |
| 18 |
usepackage[options]{hvpygmentex} |
| 19 |
\end{verbatim} |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
With \texttt{hvpygmentex} one do not needs the external Python run to |
| 24 |
create the formatted tex snippets which are inserted into the document. |
| 25 |
With the optional argument \texttt{--shell-escape} for the \LaTeX\ run |
| 26 |
\TeX\ is allowed to run the external program \texttt{pygmentize} from within the document and |
| 27 |
no additional action by the user is required. |
| 28 |
|
| 29 |
This package itself has an additional option \texttt{force} which is |
| 30 |
preset to \texttt{true}. Without using it the external |
| 31 |
formatted \TeX\ snippets for the listings will not be recreated by following \LaTeX\ runs. This |
| 32 |
may speed up the \LaTeX\ runs and, of course, makes only sense, if you are sure that there |
| 33 |
are no changes in the source code listings. |
| 34 |
|
| 35 |
|
| 36 |
\section{Example} |
| 37 |
|
| 38 |
\begin{pygmented}[lang=tex,font=\ttfamily\small] |
| 39 |
\bgroup |
| 40 |
\initcatcodetable1 |
| 41 |
\aftergroup{\global\catcode`¡=12}% |
| 42 |
\catcode`\_=12 \catcode`\^=12 \catcode`\$=12 \catcode`\%=12 \catcode`\#=12 |
| 43 |
\catcode`\&=12 \catcode`\{=12 \catcode`\}=12 \catcode`\~=12 \catcode`¡=0 |
| 44 |
\catcode`\\=12 |
| 45 |
¡savecatcodetable1 |
| 46 |
¡egroup |
| 47 |
\end{pygmented} |
| 48 |
|
| 49 |
|
| 50 |
This document was run with |
| 51 |
|
| 52 |
\begin{verbatim} |
| 53 |
lualatex --shell-escape hvpygmentex.tex |
| 54 |
\end{verbatim} |
| 55 |
|
| 56 |
In the terminal output you'll find something like |
| 57 |
|
| 58 |
\begin{verbatim} |
| 59 |
[...] |
| 60 |
>>>> running pygmentex (option force=true) ... |
| 61 |
>>>> ... done. |
| 62 |
[...] |
| 63 |
\end{verbatim} |
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
\end{document} |