From 94cfc039fd21487fb96b861f61f28b64e3836fca Mon Sep 17 00:00:00 2001 From: servostar Date: Wed, 27 Sep 2023 17:38:46 +0200 Subject: [PATCH] updated minted --- .gitignore | 3 +++ minted/.latexmkrc | 64 +++++++++++++++++++++++++++++++++++++++++++++++ minted/main.tex | 10 +++++--- 3 files changed, 73 insertions(+), 4 deletions(-) create mode 100644 minted/.latexmkrc diff --git a/.gitignore b/.gitignore index 747d42e..05b3b28 100644 --- a/.gitignore +++ b/.gitignore @@ -301,3 +301,6 @@ TSWLatexianTemp* # Uncomment the next line to have this generated file ignored. #*Notes.bib +.tmp +.build +*.pdf \ No newline at end of file diff --git a/minted/.latexmkrc b/minted/.latexmkrc new file mode 100644 index 0000000..9cbefa7 --- /dev/null +++ b/minted/.latexmkrc @@ -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; \ No newline at end of file diff --git a/minted/main.tex b/minted/main.tex index 7d0f724..fa2cacb 100644 --- a/minted/main.tex +++ b/minted/main.tex @@ -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