updated minted

This commit is contained in:
Sven Vogel 2023-09-27 17:38:46 +02:00
parent ed3c2bdc2e
commit 94cfc039fd
3 changed files with 73 additions and 4 deletions

3
.gitignore vendored
View File

@ -301,3 +301,6 @@ TSWLatexianTemp*
# Uncomment the next line to have this generated file ignored.
#*Notes.bib
.tmp
.build
*.pdf

64
minted/.latexmkrc Normal file
View File

@ -0,0 +1,64 @@
# =====================================================================
# Custom latex make file to bew used with TexLive and Latexmk
# _ _ __ __ _ ______ ____
# | | __ _| |_ _____ _| \/ | |/ / _ \ / ___|
# | |/ _` | __/ _ \ \/ / |\/| | ' /| |_) | |
# | | (_| | || __/> <| | | | . \| _ <| |___
# |_|\__,_|\__\___/_/\_\_| |_|_|\_\_| \_\\____|
# main file to compile
# this is the entry point file
@default_files = ('main.tex');
# =====================================================================
# custom folders to store auxilary and build files inside
# so they don't clutter everything
# Move all axuiliary files to a separate directory, so they do not clutter up the project directory
$emulate_aux = 1;
$aux_dir = ".tmp";
# Move the compiled files (and synctex) to a separate directory
$out_dir = '.tmp';
# command to compile and run
$pdflatex = 'pdflatex %O -interaction=nonstopmode -shell-escape %S';
# =====================================================================
# bibtex
# Specify the bibliography
$bibtex = 'bibtex %O %B';
$makeglossaries = 'makeglossaries %O %B';
# Continuous preview mode
$continuous_mode = 1;
# Set the program used to generate the PDF
# 1: pdflatex
# 2: postscript conversion, don't use this
# 3: dvi conversion, don't use this
# 4: lualatex
# 5: xelatex
$pdf_mode = 1;
# Keep auxiliary files
$clean_ext = " ";
# =====================================================================
# custom dependency handling for glossaries
add_cus_dep( 'acn', 'acr', 0, 'makeglossaries' );
add_cus_dep( 'glo', 'gls', 0, 'makeglossaries' );
$clean_ext .= " acr acn alg glo gls glg";
sub makeglossaries {
my ($base_name, $path) = fileparse( $_[0] );
my @args = ( "-q", "-d", $path, $base_name );
if ($silent) { unshift @args, "-q"; }
return system "makeglossaries", "-d", $path, $base_name;
}
# =====================================================================
# Silence warnings
$silent = 1;

View File

@ -21,17 +21,17 @@
% include the required package
% make sure this is installed:
% > tlmgr install minted
\usepackage{minted}
\usepackage[outputdir=.tmp]{minted}
% ===================================================
% set global style for minted
\usemintedstyle{borland}
\usemintedstyle{tango}
% set global options for all listings
% these can also be applied locally to individual listings
\setminted {
linenos=true, % enable line numbers
bgcolor=lightgray, % background color
bgcolor=white, % background color
resetmargins=true,
tabsize=4, % white spaces for tabs
xleftmargin=24pt, % margin to the left side. can be used to include line numbers
@ -60,8 +60,9 @@ The following will show some syntax highlighted source code:
% every minted block is wrapped in a listing block for alignment and
% the option to add some caption and label
\begin{listing}[ht]
% vvvvvvvv <= specifiy language
% specifiy language
\begin{minted}{python}
def incmatrix(genl1,genl2):
for i in range(m-1):
for j in range(i+1, m):
@ -83,6 +84,7 @@ def incmatrix(genl1,genl2):
VT = np.zeros((n*m,1), int)
return M
\end{minted}
\caption{Some python code} % add a caption
\label{listing:1} % add a label for referencing