2. Demonstration: before and after

Let’s give a demonstration of some before and after code – after all, you probably won’t want to try the script if you don’t much like the results. You might also like to watch the video demonstration I made on youtube (“Video Demonstration of Latexindent.pl on Youtube” n.d.)

As you look at Listing 31Listing 36, remember that latexindent.pl is just following its rules, and there is nothing particular about these code snippets. All of the rules can be modified so that you can personalise your indentation scheme.

In each of the samples given in Listing 31Listing 36 the ‘before’ case is a ‘worst case scenario’ with no effort to make indentation. The ‘after’ result would be the same, regardless of the leading white space at the beginning of each line which is stripped by latexindent.pl (unless a verbatim-like environment or noIndentBlock is specified – more on this in Section 5).

Listing 31 filecontents1.tex
\begin{filecontents}{mybib.bib}
@online{strawberryperl,
title="Strawberry Perl",
url="http://strawberryperl.com/"}
@online{cmhblog,
title="A Perl script ...
url="...
}
\end{filecontents}
Listing 32 filecontents1.tex default output
\begin{filecontents}{mybib.bib}
	@online{strawberryperl,
		title="Strawberry Perl",
		url="http://strawberryperl.com/"}
	@online{cmhblog,
		title="A Perl script ...
		url="...
	}
\end{filecontents}
Listing 33 tikzset.tex
\tikzset{
shrink inner sep/.code={
\pgfkeysgetvalue...
\pgfkeysgetvalue...
}
}
Listing 34 tikzset.tex default output
\tikzset{
	shrink inner sep/.code={
			\pgfkeysgetvalue...
			\pgfkeysgetvalue...
		}
}
Listing 35 pstricks.tex
\def\Picture#1{%
\def\stripH{#1}%
\begin{pspicture}[showgrid}
\psforeach{\row}{%
{{3,2.8,2.7,3,3.1}},%
{2.8,1,1.2,2,3},%
...
}{%
\expandafter...
}
\end{pspicture}}
Listing 36 pstricks.tex default output
\def\Picture#1{%
	\def\stripH{#1}%
	\begin{pspicture}[showgrid}
		\psforeach{\row}{%
			{{3,2.8,2.7,3,3.1}},%
			{2.8,1,1.2,2,3},%
			...
		}{%
			\expandafter...
		}
	\end{pspicture}}

“Video Demonstration of Latexindent.pl on Youtube.” n.d. Accessed February 21, 2017. https://www.youtube.com/watch?v=wo38aaH2F4E&spfreload=10.