\errorcontextlines=100 \documentclass[DIV=12]{scrartcl} \usepackage{libertinus-otf} \usepackage[force]{hvpygmentex} \usepackage{url} \title{Typeset highlited sourcecode} \author{Herbert Voß} \begin{document} \maketitle \section{Introduction} This package is fully compatible to package \texttt{pygmentex}. Read the package documentation (\url{http://ctan.org/pkg/pygmentex}) for the supported languages a.s.o. \begin{verbatim} usepackage[options]{hvpygmentex} \end{verbatim} With \texttt{hvpygmentex} one do not needs the external Python run to create the formatted tex snippets which are inserted into the document. With the optional argument \texttt{--shell-escape} for the \LaTeX\ run \TeX\ is allowed to run the external program \texttt{pygmentize} from within the document and no additional action by the user is required. This package itself has an additional option \texttt{force} which is preset to \texttt{true}. Without using it the external formatted \TeX\ snippets for the listings will not be recreated by following \LaTeX\ runs. This may speed up the \LaTeX\ runs and, of course, makes only sense, if you are sure that there are no changes in the source code listings. \section{Example} \begin{pygmented}[lang=tex,font=\ttfamily\small] \bgroup \initcatcodetable1 \aftergroup{\global\catcode`¡=12}% \catcode`\_=12 \catcode`\^=12 \catcode`\$=12 \catcode`\%=12 \catcode`\#=12 \catcode`\&=12 \catcode`\{=12 \catcode`\}=12 \catcode`\~=12 \catcode`¡=0 \catcode`\\=12 ¡savecatcodetable1 ¡egroup \end{pygmented} This document was run with \begin{verbatim} lualatex --shell-escape hvpygmentex.tex \end{verbatim} In the terminal output you'll find something like \begin{verbatim} [...] >>>> running pygmentex (option force=true) ... >>>> ... done. [...] \end{verbatim} \end{document}