summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/support/latexindent/subsubsec-ifelsefi.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-02-24 22:07:42 +0000
committerKarl Berry <karl@freefriends.org>2017-02-24 22:07:42 +0000
commit990e60c6ed4437e5b632b7c9acf7f2237bbda871 (patch)
tree4dc9ea04f5fa46cc8ac59faa8dd62e4f8bc6835b /Master/texmf-dist/doc/support/latexindent/subsubsec-ifelsefi.tex
parent2e70942b44a972908c3180dd7a3c68be51afc466 (diff)
latexindent (23feb17)
git-svn-id: svn://tug.org/texlive/trunk@43326 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/support/latexindent/subsubsec-ifelsefi.tex')
-rw-r--r--Master/texmf-dist/doc/support/latexindent/subsubsec-ifelsefi.tex70
1 files changed, 70 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/support/latexindent/subsubsec-ifelsefi.tex b/Master/texmf-dist/doc/support/latexindent/subsubsec-ifelsefi.tex
new file mode 100644
index 00000000000..5c9a37dbb22
--- /dev/null
+++ b/Master/texmf-dist/doc/support/latexindent/subsubsec-ifelsefi.tex
@@ -0,0 +1,70 @@
+% arara: pdflatex: {shell: yes, files: [latexindent]}
+\subsubsection{ifelsefi code blocks}
+ Let's use the simple example shown in \cref{lst:ifelsefi1}; when
+ \texttt{latexindent.pl} operates on this file, the output as in \cref{lst:ifelsefi1-default};
+ note that the body of each of the \lstinline!\if! statements have been indented,
+ and that the \lstinline!\else! statement has been accounted for correctly.
+
+ \begin{minipage}{.45\textwidth}
+ \cmhlistingsfromfile{demonstrations/ifelsefi1.tex}{\texttt{ifelsefi1.tex}}{lst:ifelsefi1}
+ \end{minipage}%
+ \hfill
+ \begin{minipage}{.54\textwidth}
+ \cmhlistingsfromfile{demonstrations/ifelsefi1-default.tex}{\texttt{ifelsefi1.tex} default output}{lst:ifelsefi1-default}
+ \end{minipage}
+
+ It is recommended to specify \texttt{noAdditionalIndent} and \texttt{indentRules} in the `scalar' form only
+ for these type of code blocks, although the `field' form would work, assuming that \texttt{body} was specified.
+ Examples are shown in \cref{lst:ifnum-noAdd,lst:ifnum-indent-rules}.
+
+ \begin{minipage}{.45\textwidth}
+ \cmhlistingsfromfile[style=yaml-LST]{demonstrations/ifnum-noAdd.yaml}[width=.8\linewidth,before=\centering,yaml-TCB]{\texttt{ifnum-noAdd.yaml}}{lst:ifnum-noAdd}
+ \end{minipage}
+ \hfill
+ \begin{minipage}{.45\textwidth}
+ \cmhlistingsfromfile[style=yaml-LST]{demonstrations/ifnum-indent-rules.yaml}[width=.8\linewidth,before=\centering,yaml-TCB]{\texttt{ifnum-indent-rules.yaml}}{lst:ifnum-indent-rules}
+ \end{minipage}
+
+ After running the following commands,
+ \begin{commandshell}
+latexindent.pl ifelsefi1.tex -local ifnum-noAdd.yaml
+latexindent.pl ifelsefi1.tex -l ifnum-indent-rules.yaml
+\end{commandshell}
+ we receive the respective output given in \cref{lst:ifelsefi1-output-noAdd,lst:ifelsefi1-output-indent-rules}; note that
+ in \cref{lst:ifelsefi1-output-noAdd}, the \texttt{ifnum} code block has \emph{not} received any additional indentation,
+ while in \cref{lst:ifelsefi1-output-indent-rules}, the \texttt{ifnum} code block has received one tab and two spaces of indentation.
+
+ \begin{minipage}{.45\textwidth}
+ \cmhlistingsfromfile{demonstrations/ifelsefi1-noAdd.tex}{\texttt{ifelsefi1.tex} using \cref{lst:ifnum-noAdd}}{lst:ifelsefi1-output-noAdd}
+ \end{minipage}
+ \hfill
+ \begin{minipage}{.5\textwidth}
+ \cmhlistingsfromfile{demonstrations/ifelsefi1-indent-rules.tex}{\texttt{ifelsefi1.tex} using \cref{lst:ifnum-indent-rules}}{lst:ifelsefi1-output-indent-rules}
+ \end{minipage}
+
+ We may specify \texttt{noAdditionalIndentGlobal} and \texttt{indentRulesGlobal} as in \cref{lst:ifelsefi-noAdd-glob,lst:ifelsefi-indent-rules-global}.
+
+ \begin{minipage}{.49\textwidth}
+ \cmhlistingsfromfile[style=yaml-LST]{demonstrations/ifelsefi-noAdd-glob.yaml}[width=.9\linewidth,before=\centering,yaml-TCB]{\texttt{ifelsefi-noAdd-glob.yaml}}{lst:ifelsefi-noAdd-glob}
+ \end{minipage}
+ \hfill
+ \begin{minipage}{.49\textwidth}
+ \cmhlistingsfromfile[style=yaml-LST]{demonstrations/ifelsefi-indent-rules-global.yaml}[width=.9\linewidth,before=\centering,yaml-TCB]{\texttt{ifelsefi-indent-rules-global.yaml}}{lst:ifelsefi-indent-rules-global}
+ \end{minipage}
+
+ Upon running the following commands
+ \begin{commandshell}
+latexindent.pl ifelsefi1.tex -local ifelsefi-noAdd-glob.yaml
+latexindent.pl ifelsefi1.tex -l ifelsefi-indent-rules-global.yaml
+\end{commandshell}
+ we receive the outputs in \cref{lst:ifelsefi1-output-noAdd-glob,lst:ifelsefi1-output-indent-rules-global}; notice that in
+ \cref{lst:ifelsefi1-output-noAdd-glob} neither of the \texttt{ifelsefi} code blocks have received indentation, while in
+ \cref{lst:ifelsefi1-output-indent-rules-global} both code blocks have received a single space of indentation.
+
+ \begin{minipage}{.45\textwidth}
+ \cmhlistingsfromfile{demonstrations/ifelsefi1-noAdd-glob.tex}{\texttt{ifelsefi1.tex} using \cref{lst:ifelsefi-noAdd-glob}}{lst:ifelsefi1-output-noAdd-glob}
+ \end{minipage}
+ \hfill
+ \begin{minipage}{.45\textwidth}
+ \cmhlistingsfromfile{demonstrations/ifelsefi1-indent-rules-global.tex}{\texttt{ifelsefi1.tex} using \cref{lst:ifelsefi-indent-rules-global}}{lst:ifelsefi1-output-indent-rules-global}
+ \end{minipage}