[Code] Add better code snippets

This commit is contained in:
2025-09-28 20:05:58 +02:00
parent 14210ca1da
commit 4a98d7d3af
3 changed files with 34 additions and 0 deletions

Binary file not shown.

View File

@@ -432,6 +432,7 @@ This outputs as
\end{fullTable}
\subsection{Index}
\textit{Included in \texttt{most} and up}
@@ -439,6 +440,8 @@ If you want to use index, add \verb|\prepareIndex| to the preamble. Using \verb|
Using \verb|\addIndex|\{\textit{string}\}, you can do the same, but the text remains normal and using \verb|\addIndexItalic|\{\textit{string}\}, it is printed in italics
\newpage
\subsection{Extras}
\subsubsection{BibTeX}
\textit{Included in \texttt{recommended} and up}
@@ -454,3 +457,20 @@ Use \verb|\setupGlossary| in the preamble to prepare, then use the normal glossa
\textit{Included in \texttt{full}}
No extra configs or commands provided by this one, simply an import for minted. Be sure to enable \texttt{shell-escape} for your compiler!
When \texttt{minted} is available via these helpers, you will also have access to the \texttt{codesnippet} macro:
\begin{minted}{latex}
\begin{code}{language}
//Code goes here
\end{code}
\end{minted}
This is nothing different than a wrapper for a minted environment with a box drawn around it.
Example (in python):
\begin{code}{python}
def hello_world():
print("hello world!")
\end{code}

View File

@@ -1 +1,15 @@
\usepackage{minted}
\usepackage{fancyvrb}
\newenvironment{code}[1]{
\VerbatimEnvironment
\begin{minted}[
autogobble,
breaklines,
breakindentnchars=2,
frame=lines,
framesep=2mm,
baselinestretch=1.1,
linenos]{#1}}
{\end{minted}}