Add minted back

This commit is contained in:
2026-02-20 18:28:34 +01:00
parent 35bd979c98
commit 2c37a724ee
2 changed files with 96 additions and 0 deletions

View File

@@ -692,6 +692,55 @@
\DeclareMathOperator\arcsinh{arcsinh}
% ┌ ┐
% │ Minted │
% └ ┘
\usepackage{minted}
\usepackage{fancyvrb}
% Args: Code.
% Alternative: Use \mint{<language>}|code|
\newcommand{\inlinecode}[1]{\shade{gray}{\texttt{#1}}}
% Args: Language, Code
\newenvironment{code}[1]{
\VerbatimEnvironment
\begin{minted}[
autogobble,
breaklines,
breakindentnchars=2,
frame=lines,
framesep=2mm,
mathescape,
baselinestretch=1.1,
linenos
]{#1}}
{\end{minted}}
% Args: Language, file relative to root file
\newcommand{\inputcode}[2]{
\inputminted[
autogobble,
breaklines,
breakindentnchars=2,
frame=lines,
framesep=2mm,
mathescape,
baselinestretch=1.1,
linenos
]{#1}{#2}
}
% Args: Language, Base directory (with trailing slash), file (no slash at start)
\newcommand{\inputcodewithfilename}[3]{
\begin{figure}[h!]
\texttt{File: \detokenize{#3}}
\rmvspace
\inputcode{#1}{#2#3}
\end{figure}
}
% ┌ ┐
% │ Index │
% └ ┘