-
Notifications
You must be signed in to change notification settings - Fork 0
Code
Johannes Schackniß edited this page May 11, 2021
·
5 revisions
The package listings is used to display code in the paper. Package xcolor is used for code highlightung and to make it look fancy.
Short documentation
Long documentation
Short documentation
Long documentation
Input:
\lstinline$var myValue$
You can write normal text and inbetween \lstinline$comes the inline listing aka code snippet$. Afterwards you can just continue writing normal text.Output:
WIP
Input:
\begin{lstlisting}[caption={My caption}, label={lst:my-label-1}]
import numpy as np
\end{lstlisting}Output:
WIP
Input:
\lstinputlisting[caption={Here comes the caption},
label={lst:my-label-2}]
{resources/code/placeholder.py}Output:
WIP
WIP
Highlighting settings can be edited in config/packages.tex
| Parameter | usage |
|---|---|
language |
Enables code highlighting for this particular programming language (e.g. C++, Python, etc) |
morekeywords |
Add aditional keywords for highlighting (seperated by ,) |
captionpos |
Position of the caption (t = caption is displayed on top, b = caption is displayed on bottom) |
breaklines |
Automatic line-breaking (true/false) |
\definecolor{comment}{HTML}{0A943F}
\definecolor{linenumber}{HTML}{424445}
\definecolor{keyword}{HTML}{184FDB}
\definecolor{background}{HTML}{F2F2F2}
\definecolor{string}{HTML}{DB9418}
\lstdefinestyle{code}{
backgroundcolor=\color{background},
commentstyle=\color{comment},
keywordstyle=\color{keyword},
numberstyle=\tiny\color{linenumber},
stringstyle=\color{string},
basicstyle=\ttfamily\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2,
morekeywords={
var
}
}
LaTeX Introduction
- Hierarchy
- Figures
- Table
- Code
- Referencing
- Enumerations
- Citation
- Acronyms
- Special characters
- Page layout
- Hyphenation
Other tools