summaryrefslogtreecommitdiff
path: root/support/latexindent/documentation/subsubsec-headings.tex
blob: 3cbe5996ea9d00c600795000ba3b4d761145f9c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
% arara: pdflatex: {shell: yes, files: [latexindent]}
\subsubsection{afterHeading code blocks}\label{subsubsec-headings-no-add-indent-rules}
	Let's use the example \cref{lst:headings2} for demonstration throughout this
	\namecref{subsubsec-headings-no-add-indent-rules}. As discussed on \cpageref{lst:headings1}, by default
	\texttt{latexindent.pl} will not add indentation after headings.

	\cmhlistingsfromfile{demonstrations/headings2.tex}{\texttt{headings2.tex}}{lst:headings2}

	On using the YAML file in \cref{lst:headings3yaml} by running the command
	\index{switches!-l demonstration}
	\begin{commandshell}
latexindent.pl headings2.tex -l headings3.yaml      
\end{commandshell}
	we obtain the output in \cref{lst:headings2-mod3}. Note that the argument of
	\texttt{paragraph} has received (default) indentation, and that the body after the
	heading statement has received (default) indentation.

	\begin{cmhtcbraster}[raster column skip=.1\linewidth]
		\cmhlistingsfromfile{demonstrations/headings2-mod3.tex}{\texttt{headings2.tex} using \cref{lst:headings3yaml}}{lst:headings2-mod3}
		\cmhlistingsfromfile[style=yaml-LST]*{demonstrations/headings3.yaml}[yaml-TCB]{\texttt{headings3.yaml}}{lst:headings3yaml}
	\end{cmhtcbraster}

	If we specify \texttt{noAdditionalIndent} as in \cref{lst:headings4yaml} and run the command
	\index{switches!-l demonstration}
	\begin{commandshell}
latexindent.pl headings2.tex -l headings4.yaml      
\end{commandshell}
	then we receive the output in \cref{lst:headings2-mod4}. Note that the arguments
	\emph{and} the body after the heading of \texttt{paragraph} has received
	no additional indentation, because we have specified \texttt{noAdditionalIndent} in scalar
	form.

	\begin{cmhtcbraster}[raster column skip=.1\linewidth]
		\cmhlistingsfromfile{demonstrations/headings2-mod4.tex}{\texttt{headings2.tex} using \cref{lst:headings4yaml}}{lst:headings2-mod4}
		\cmhlistingsfromfile[style=yaml-LST]*{demonstrations/headings4.yaml}[yaml-TCB]{\texttt{headings4.yaml}}{lst:headings4yaml}
	\end{cmhtcbraster}

	Similarly, if we specify \texttt{indentRules} as in \cref{lst:headings5yaml} and run
	analogous commands to those above, we receive the output in \cref{lst:headings2-mod5}; note
	that the \emph{body}, \emph{mandatory argument} and content
	\emph{after the heading} of \texttt{paragraph} have \emph{all} received
	three tabs worth of indentation.

	\begin{cmhtcbraster}[raster force size=false,
			raster column 1/.style={add to width=1cm},
			raster column 2/.style={add to width=-1cm},
		]
		\cmhlistingsfromfile[showtabs=true]{demonstrations/headings2-mod5.tex}{\texttt{headings2.tex} using \cref{lst:headings5yaml}}{lst:headings2-mod5}
		\cmhlistingsfromfile[style=yaml-LST]*{demonstrations/headings5.yaml}[yaml-TCB]{\texttt{headings5.yaml}}{lst:headings5yaml}
	\end{cmhtcbraster}

	We may, instead, specify \texttt{noAdditionalIndent} in `field' form, as in
	\cref{lst:headings6yaml} which gives the output in \cref{lst:headings2-mod6}.

	\begin{cmhtcbraster}
		\cmhlistingsfromfile{demonstrations/headings2-mod6.tex}{\texttt{headings2.tex} using \cref{lst:headings6yaml}}{lst:headings2-mod6}
		\cmhlistingsfromfile[style=yaml-LST]*{demonstrations/headings6.yaml}[yaml-TCB]{\texttt{headings6.yaml}}{lst:headings6yaml}
	\end{cmhtcbraster}

	Analogously, we may specify \texttt{indentRules} as in \cref{lst:headings7yaml} which
	gives the output in \cref{lst:headings2-mod7}; note that mandatory argument text has only
	received a single space of indentation, while the body after the heading has received
	three tabs worth of indentation.

	\begin{cmhtcbraster}
		\cmhlistingsfromfile[showtabs=true]{demonstrations/headings2-mod7.tex}{\texttt{headings2.tex} using \cref{lst:headings7yaml}}{lst:headings2-mod7}
		\cmhlistingsfromfile[style=yaml-LST]*{demonstrations/headings7.yaml}[yaml-TCB]{\texttt{headings7.yaml}}{lst:headings7yaml}
	\end{cmhtcbraster}

	Finally, let's consider \texttt{noAdditionalIndentGlobal} and \texttt{indentRulesGlobal} shown in
	\cref{lst:headings8yaml,lst:headings9yaml} respectively, with respective output in \cref{lst:headings2-mod8,lst:headings2-mod9}.
	Note that in \cref{lst:headings8yaml} the \emph{mandatory argument} of \texttt{paragraph}
	has received a (default) tab's worth of indentation, while the body after the heading has
	received \emph{no additional indentation}. Similarly, in \cref{lst:headings2-mod9}, the
	\emph{argument} has received both a (default) tab plus two spaces of indentation
	(from the global rule specified in \cref{lst:headings9yaml}), and the remaining body after
	\texttt{paragraph} has received just two spaces of indentation.

	\begin{cmhtcbraster}
		\cmhlistingsfromfile{demonstrations/headings2-mod8.tex}{\texttt{headings2.tex} using \cref{lst:headings8yaml}}{lst:headings2-mod8}
		\cmhlistingsfromfile[style=yaml-LST]*{demonstrations/headings8.yaml}[yaml-TCB]{\texttt{headings8.yaml}}{lst:headings8yaml}
	\end{cmhtcbraster}

	\begin{cmhtcbraster}
		\cmhlistingsfromfile[showspaces=true,showtabs=true]{demonstrations/headings2-mod9.tex}{\texttt{headings2.tex} using \cref{lst:headings9yaml}}{lst:headings2-mod9}
		\cmhlistingsfromfile[style=yaml-LST]*{demonstrations/headings9.yaml}[yaml-TCB]{\texttt{headings9.yaml}}{lst:headings9yaml}
	\end{cmhtcbraster}