summaryrefslogtreecommitdiff
path: root/support/latexindent/documentation/subsubsec-special.tex
blob: 128bd781ca93feadbd8f306424ee1e37a7fc528a (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
% arara: pdflatex: {files: [latexindent]}
\subsubsection{specialBeginEnd code blocks}
 Let's use the example from \vref{lst:specialbefore} which has default output shown in
 \vref{lst:specialafter}.

 It is recommended to specify \texttt{noAdditionalIndent} and \texttt{indentRules} in the
 `scalar' form for these type of code blocks, although the `field' form would work,
 assuming that \texttt{body} was specified. Examples are shown in
 \cref{lst:displayMath-noAdd,lst:displayMath-indent-rules}.
 \index{specialBeginEnd!noAdditionalIndent} \index{specialBeginEnd!indentRules example}

 \begin{minipage}{.49\textwidth}
  \cmhlistingsfromfile[style=yaml-LST]{demonstrations/displayMath-noAdd.yaml}[width=.9\linewidth,before=\centering,yaml-TCB]{\texttt{displayMath-noAdd.yaml}}{lst:displayMath-noAdd}
 \end{minipage}
 \hfill
 \begin{minipage}{.49\textwidth}
  \cmhlistingsfromfile[style=yaml-LST]{demonstrations/displayMath-indent-rules.yaml}[width=.9\linewidth,before=\centering,yaml-TCB]{\texttt{displayMath-indent-rules.yaml}}{lst:displayMath-indent-rules}
 \end{minipage}

 After running the following commands, \index{switches!-l demonstration}
 \begin{commandshell}
latexindent.pl special1.tex -local displayMath-noAdd.yaml  
latexindent.pl special1.tex -l displayMath-indent-rules.yaml  
\end{commandshell}
 we receive the respective output given in
 \cref{lst:special1-output-noAdd,lst:special1-output-indent-rules}; note that in
 \cref{lst:special1-output-noAdd}, the \texttt{displayMath} code block has \emph{not}
 received any additional indentation, while in \cref{lst:special1-output-indent-rules},
 the \texttt{displayMath} code block has received three tabs worth of indentation.

 \begin{minipage}{.45\textwidth}
  \cmhlistingsfromfile{demonstrations/special1-noAdd.tex}{\texttt{special1.tex} using \cref{lst:displayMath-noAdd}}{lst:special1-output-noAdd}
 \end{minipage}
 \hfill
 \begin{minipage}{.45\textwidth}
  \cmhlistingsfromfile[showtabs=true]{demonstrations/special1-indent-rules.tex}{\texttt{special1.tex} using \cref{lst:displayMath-indent-rules}}{lst:special1-output-indent-rules}
 \end{minipage}

 We may specify \texttt{noAdditionalIndentGlobal} and \texttt{indentRulesGlobal} as in
 \cref{lst:special-noAdd-glob,lst:special-indent-rules-global}.

 \begin{minipage}{.49\textwidth}
  \cmhlistingsfromfile[style=yaml-LST]{demonstrations/special-noAdd-glob.yaml}[width=.9\linewidth,before=\centering,yaml-TCB]{\texttt{special-noAdd-glob.yaml}}{lst:special-noAdd-glob}
 \end{minipage}
 \hfill
 \begin{minipage}{.49\textwidth}
  \cmhlistingsfromfile[style=yaml-LST]{demonstrations/special-indent-rules-global.yaml}[width=.9\linewidth,before=\centering,yaml-TCB]{\texttt{special-indent-rules-global.yaml}}{lst:special-indent-rules-global}
 \end{minipage}

 Upon running the following commands \index{switches!-l demonstration}
 \begin{commandshell}
latexindent.pl special1.tex -local special-noAdd-glob.yaml  
latexindent.pl special1.tex -l special-indent-rules-global.yaml  
\end{commandshell}
 we receive the outputs in
 \cref{lst:special1-output-noAdd-glob,lst:special1-output-indent-rules-global}; notice
 that in \cref{lst:special1-output-noAdd-glob} neither of the \texttt{special} code blocks
 have received indentation, while in \cref{lst:special1-output-indent-rules-global} both
 code blocks have received a single space of indentation.

 \begin{minipage}{.45\textwidth}
  \cmhlistingsfromfile{demonstrations/special1-noAdd-glob.tex}{\texttt{special1.tex} using \cref{lst:special-noAdd-glob}}{lst:special1-output-noAdd-glob}
 \end{minipage}
 \hfill
 \begin{minipage}{.45\textwidth}
  \cmhlistingsfromfile[showspaces=true]{demonstrations/special1-indent-rules-global.tex}{\texttt{special1.tex} using \cref{lst:special-indent-rules-global}}{lst:special1-output-indent-rules-global}
 \end{minipage}