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” 2017)

As you look at Listing 5Listing 10, 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 personalize your indentation scheme.

In each of the samples given in Listing 5Listing 10 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 5 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 6 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 7 tikzset.tex
\tikzset{
shrink inner sep/.code={
\pgfkeysgetvalue...
\pgfkeysgetvalue...
}
}
Listing 8 tikzset.tex default output
\tikzset{
	shrink inner sep/.code={
			\pgfkeysgetvalue...
			\pgfkeysgetvalue...
		}
}
Listing 9 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 10 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.” 2017. Accessed February 21. https://www.youtube.com/watch?v=wo38aaH2F4E&spfreload=10.