I use the packages listings
and minted
for my syntax highlighting in LaTeX.
My problem is that my indent is way too large (normal tabulator) and I don't want to use space. Is it possible to change the tabsize here? Something like tabsize=2 don't work.
And is it possible to auto indent my programcode? I mean, that listings
(or any other package) recognize if-statements and so on and auto indent my whole code.
Here is a short example:
\documentclass{article}
\usepackage{listings}
\usepackage{minted}
\begin{document}
\begin{minted}{bash}
#!/bin/bash
parameter1=$1
#some commentary
if [ "$parameter1" == "-h" ] || [ "$parameter1" == "--help" ] ;
then
echo my helpfile
else
#the rest of my programcode
\end{minted}
\end{document}
The if-statement should look something like this:
if [ "$parameter1" == "-h" ] || [ "$parameter1" == "--help" ] ;
then
echo my helpfile
else
#the rest of my programcode
\documentclass{...}
and ending with\end{document}
.