diff options
Diffstat (limited to 'Master/texmf-dist/doc/support/latexindent/subsubsec-environments-and-their-arguments.tex')
-rw-r--r-- | Master/texmf-dist/doc/support/latexindent/subsubsec-environments-and-their-arguments.tex | 114 |
1 files changed, 62 insertions, 52 deletions
diff --git a/Master/texmf-dist/doc/support/latexindent/subsubsec-environments-and-their-arguments.tex b/Master/texmf-dist/doc/support/latexindent/subsubsec-environments-and-their-arguments.tex index b151d2d7676..ebd37ac4f03 100644 --- a/Master/texmf-dist/doc/support/latexindent/subsubsec-environments-and-their-arguments.tex +++ b/Master/texmf-dist/doc/support/latexindent/subsubsec-environments-and-their-arguments.tex @@ -6,8 +6,8 @@ \cmhlistingsfromfile{demonstrations/myenvironment-simple.tex}{\texttt{myenv.tex}}{lst:myenvtex} \yamltitle{noAdditionalIndent}*{fields} - If we do not wish \texttt{myenv} to receive any additional indentation, we have a - few choices available to us, as demonstrated in \cref{lst:myenv-noAdd1,lst:myenv-noAdd2}. + If we do not wish \texttt{myenv} to receive any additional indentation, we have a few + choices available to us, as demonstrated in \cref{lst:myenv-noAdd1,lst:myenv-noAdd2}. \begin{minipage}{.45\textwidth} \cmhlistingsfromfile[style=yaml-LST]*{demonstrations/myenv-noAdd1.yaml}[width=.8\linewidth,before=\centering,yaml-TCB]{\texttt{myenv-noAdd1.yaml}}{lst:myenv-noAdd1} @@ -24,13 +24,13 @@ latexindent.pl myenv.tex -l myenv-noAdd1.yaml latexindent.pl myenv.tex -l myenv-noAdd2.yaml \end{commandshell} we obtain the output given in \cref{lst:myenv-output}; note in particular that the - environment \texttt{myenv} has not received any \emph{additional} - indentation, but that the \texttt{outer} environment \emph{has} still - received indentation. + environment \texttt{myenv} has not received any \emph{additional} indentation, but that + the \texttt{outer} environment \emph{has} still received indentation. \cmhlistingsfromfile{demonstrations/myenvironment-simple-noAdd-body1.tex}{\texttt{myenv.tex} output (using either \cref{lst:myenv-noAdd1} or \cref{lst:myenv-noAdd2})}{lst:myenv-output} - Upon changing the YAML files to those shown in \cref{lst:myenv-noAdd3,lst:myenv-noAdd4}, and running either + Upon changing the YAML files to those shown in \cref{lst:myenv-noAdd3,lst:myenv-noAdd4}, + and running either \index{switches!-l demonstration} \begin{commandshell} latexindent.pl myenv.tex -l myenv-noAdd3.yaml @@ -48,8 +48,8 @@ latexindent.pl myenv.tex -l myenv-noAdd4.yaml \cmhlistingsfromfile{demonstrations/myenvironment-simple-noAdd-body4.tex}{\texttt{myenv.tex output} (using either \cref{lst:myenv-noAdd3} or \cref{lst:myenv-noAdd4})}{lst:myenv-output-4} - Let's now allow \texttt{myenv} to have some optional and mandatory arguments, as - in \cref{lst:myenv-args}. + Let's now allow \texttt{myenv} to have some optional and mandatory arguments, as in + \cref{lst:myenv-args}. \cmhlistingsfromfile{demonstrations/myenvironment-args.tex}{\texttt{myenv-args.tex}}{lst:myenv-args} @@ -58,15 +58,16 @@ latexindent.pl myenv.tex -l myenv-noAdd4.yaml \begin{commandshell} latexindent.pl -l=myenv-noAdd1.yaml myenv-args.tex \end{commandshell} - we obtain the output shown in \cref{lst:myenv-args-noAdd1}; note that the optional argument, - mandatory argument and body \emph{all} have received no additional indent. - This is because, when \texttt{noAdditionalIndent} is specified in `scalar' form (as in - \cref{lst:myenv-noAdd1}), then \emph{all} parts of the environment (body, - optional and mandatory arguments) are assumed to want no additional indent. + we obtain the output shown in \cref{lst:myenv-args-noAdd1}; note that the optional + argument, mandatory argument and body \emph{all} have received no additional indent. This + is because, when \texttt{noAdditionalIndent} is specified in `scalar' form (as in + \cref{lst:myenv-noAdd1}), then \emph{all} parts of the environment (body, optional and + mandatory arguments) are assumed to want no additional indent. \cmhlistingsfromfile{demonstrations/myenvironment-args-noAdd-body1.tex}{\texttt{myenv-args.tex} using \cref{lst:myenv-noAdd1}}{lst:myenv-args-noAdd1} We may customise \texttt{noAdditionalIndent} for optional and mandatory arguments of the - \texttt{myenv} environment, as shown in, for example, \cref{lst:myenv-noAdd5,lst:myenv-noAdd6}. + \texttt{myenv} environment, as shown in, for example, + \cref{lst:myenv-noAdd5,lst:myenv-noAdd6}. \begin{minipage}{.49\textwidth} \cmhlistingsfromfile[style=yaml-LST]*{demonstrations/myenv-noAdd5.yaml}[width=.8\linewidth,before=\centering,yaml-TCB]{\texttt{myenv-noAdd5.yaml}}{lst:myenv-noAdd5} @@ -82,11 +83,12 @@ latexindent.pl -l=myenv-noAdd1.yaml myenv-args.tex latexindent.pl myenv.tex -l myenv-noAdd5.yaml latexindent.pl myenv.tex -l myenv-noAdd6.yaml \end{commandshell} - we obtain the respective outputs given in \cref{lst:myenv-args-noAdd5,lst:myenv-args-noAdd6}. Note that in - \cref{lst:myenv-args-noAdd5} the text for the \emph{optional} argument has not - received any additional indentation, and that in \cref{lst:myenv-args-noAdd6} the - \emph{mandatory} argument has not received any additional indentation; in both - cases, the \emph{body} has not received any additional indentation. + we obtain the respective outputs given in + \cref{lst:myenv-args-noAdd5,lst:myenv-args-noAdd6}. Note that in + \cref{lst:myenv-args-noAdd5} the text for the \emph{optional} argument has not received + any additional indentation, and that in \cref{lst:myenv-args-noAdd6} the \emph{mandatory} + argument has not received any additional indentation; in both cases, the \emph{body} has + not received any additional indentation. \begin{minipage}{.45\textwidth} \cmhlistingsfromfile{demonstrations/myenvironment-args-noAdd5.tex}{\texttt{myenv-args.tex} using \cref{lst:myenv-noAdd5}}{lst:myenv-args-noAdd5} @@ -112,9 +114,8 @@ latexindent.pl myenv.tex -l myenv-rules1.yaml latexindent.pl myenv.tex -l myenv-rules2.yaml \end{commandshell} we obtain the output given in \cref{lst:myenv-rules-output}; note in particular that the - environment \texttt{myenv} has received one tab (from the - \texttt{outer} environment) plus three spaces from \cref{lst:myenv-rules1} or - \ref{lst:myenv-rules2}. + environment \texttt{myenv} has received one tab (from the \texttt{outer} environment) + plus three spaces from \cref{lst:myenv-rules1} or \ref{lst:myenv-rules2}. \cmhlistingsfromfile[showtabs=true,showspaces=true]{demonstrations/myenv-rules1.tex}{\texttt{myenv.tex} output (using either \cref{lst:myenv-rules1} or \cref{lst:myenv-rules2})}{lst:myenv-rules-output} @@ -127,9 +128,10 @@ latexindent.pl myenv.tex -l myenv-rules2.yaml \begin{commandshell} latexindent.pl myenv-args.tex -l=myenv-rules1.yaml \end{commandshell} - we obtain the output in \cref{lst:myenv-args-rules1}; note that the body, optional argument - and mandatory argument of \texttt{myenv} have \emph{all} received - the same customised indentation. \cmhlistingsfromfile[showtabs=true,showspaces=true]{demonstrations/myenvironment-args-rules1.tex}{\texttt{myenv-args.tex} using \cref{lst:myenv-rules1}}{lst:myenv-args-rules1} + we obtain the output in \cref{lst:myenv-args-rules1}; note that the body, optional + argument and mandatory argument of \texttt{myenv} have \emph{all} received the same + customised indentation. + \cmhlistingsfromfile[showtabs=true,showspaces=true]{demonstrations/myenvironment-args-rules1.tex}{\texttt{myenv-args.tex} using \cref{lst:myenv-rules1}}{lst:myenv-args-rules1} You can specify different indentation rules for the different features using, for example, \cref{lst:myenv-rules3,lst:myenv-rules4} @@ -148,7 +150,8 @@ latexindent.pl myenv-args.tex -l=myenv-rules1.yaml latexindent.pl myenv-args.tex -l myenv-rules3.yaml latexindent.pl myenv-args.tex -l myenv-rules4.yaml \end{commandshell} - then we obtain the respective outputs given in \cref{lst:myenv-args-rules3,lst:myenv-args-rules4}. + then we obtain the respective outputs given in + \cref{lst:myenv-args-rules3,lst:myenv-args-rules4}. \begin{widepage} \begin{minipage}{.5\textwidth} @@ -160,8 +163,8 @@ latexindent.pl myenv-args.tex -l myenv-rules4.yaml \end{minipage} \end{widepage} - Note that in \cref{lst:myenv-args-rules3}, the optional argument has only received a single - space of indentation, while the mandatory argument has received the default (tab) + Note that in \cref{lst:myenv-args-rules3}, the optional argument has only received a + single space of indentation, while the mandatory argument has received the default (tab) indentation; the environment body has received three spaces of indentation. In \cref{lst:myenv-args-rules4}, the optional argument has received the default (tab) @@ -172,11 +175,12 @@ latexindent.pl myenv-args.tex -l myenv-rules4.yaml \begin{wrapfigure}[6]{r}[0pt]{7cm} \cmhlistingsfromfile[style=noAdditionalIndentGlobalEnv]*{../defaultSettings.yaml}[width=.8\linewidth,before=\centering,yaml-TCB]{\texttt{noAdditionalIndentGlobal}}{lst:noAdditionalIndentGlobal:environments} \end{wrapfigure} - Assuming that your environment name is not found within neither \texttt{noAdditionalIndent} - nor \texttt{indentRules}, the next place that \texttt{latexindent.pl} will look is - \texttt{noAdditionalIndentGlobal}, and in particular \emph{for the environments} key (see - \cref{lst:noAdditionalIndentGlobal:environments}). Let's say that you change the value of \texttt{environments} - to \texttt{1} in \cref{lst:noAdditionalIndentGlobal:environments}, and that you run + Assuming that your environment name is not found within neither + \texttt{noAdditionalIndent} nor \texttt{indentRules}, the next place that + \texttt{latexindent.pl} will look is \texttt{noAdditionalIndentGlobal}, and in particular + \emph{for the environments} key (see \cref{lst:noAdditionalIndentGlobal:environments}). + Let's say that you change the value of \texttt{environments} to \texttt{1} in + \cref{lst:noAdditionalIndentGlobal:environments}, and that you run \index{switches!-l demonstration} \begin{widepage} @@ -186,12 +190,13 @@ latexindent.pl myenv-args.tex -l myenv-rules1.yaml,env-noAdditionalGlobal.yaml \end{commandshell} \end{widepage} - The respective output from these two commands are in \cref{lst:myenv-args-no-add-global1,lst:myenv-args-no-add-global2}; in + The respective output from these two commands are in + \cref{lst:myenv-args-no-add-global1,lst:myenv-args-no-add-global2}; in \cref{lst:myenv-args-no-add-global1} notice that \emph{both} environments receive no - additional indentation but that the arguments of \texttt{myenv} still - \emph{do} receive indentation. In \cref{lst:myenv-args-no-add-global2} notice that the - \emph{outer} environment does not receive additional indentation, but because - of the settings from \texttt{myenv-rules1.yaml} (in \vref{lst:myenv-rules1}), the \texttt{myenv} environment + additional indentation but that the arguments of \texttt{myenv} still \emph{do} receive + indentation. In \cref{lst:myenv-args-no-add-global2} notice that the \emph{outer} + environment does not receive additional indentation, but because of the settings from + \texttt{myenv-rules1.yaml} (in \vref{lst:myenv-rules1}), the \texttt{myenv} environment still \emph{does} receive indentation. \begin{minipage}{.45\textwidth} @@ -202,8 +207,9 @@ latexindent.pl myenv-args.tex -l myenv-rules1.yaml,env-noAdditionalGlobal.yaml \cmhlistingsfromfile{demonstrations/myenvironment-args-rules1-noAddGlobal2.tex}{\texttt{myenv-args.tex} using \cref{lst:noAdditionalIndentGlobal:environments,lst:myenv-rules1}}{lst:myenv-args-no-add-global2} \end{minipage} - In fact, \texttt{noAdditionalIndentGlobal} also contains keys that control the indentation of - optional and mandatory arguments; on referencing \cref{lst:opt-args-no-add-glob,lst:mand-args-no-add-glob} + In fact, \texttt{noAdditionalIndentGlobal} also contains keys that control the + indentation of optional and mandatory arguments; on referencing + \cref{lst:opt-args-no-add-glob,lst:mand-args-no-add-glob} \begin{minipage}{.49\textwidth} \cmhlistingsfromfile[style=yaml-LST]*{demonstrations/opt-args-no-add-glob.yaml}[width=.8\linewidth,before=\centering,yaml-TCB]{\texttt{opt-args-no-add-glob.yaml}}{lst:opt-args-no-add-glob} @@ -219,7 +225,8 @@ latexindent.pl myenv-args.tex -l myenv-rules1.yaml,env-noAdditionalGlobal.yaml latexindent.pl myenv-args.tex -local opt-args-no-add-glob.yaml latexindent.pl myenv-args.tex -local mand-args-no-add-glob.yaml \end{commandshell} - which produces the respective outputs given in \cref{lst:myenv-args-no-add-opt,lst:myenv-args-no-add-mand}. Notice that in + which produces the respective outputs given in + \cref{lst:myenv-args-no-add-opt,lst:myenv-args-no-add-mand}. Notice that in \cref{lst:myenv-args-no-add-opt} the \emph{optional} argument has not received any additional indentation, and in \cref{lst:myenv-args-no-add-mand} the \emph{mandatory} argument has not received any additional indentation. @@ -237,8 +244,8 @@ latexindent.pl myenv-args.tex -local mand-args-no-add-glob.yaml \cmhlistingsfromfile[style=indentRulesGlobalEnv]*{../defaultSettings.yaml}[width=.8\linewidth,before=\centering,yaml-TCB]{\texttt{indentRulesGlobal}}{lst:indentRulesGlobal:environments} \end{wrapfigure} The final check that \texttt{latexindent.pl} will make is to look for - \texttt{indentRulesGlobal} as detailed in \cref{lst:indentRulesGlobal:environments}; if you change the - \texttt{environments} field to anything involving horizontal space, say + \texttt{indentRulesGlobal} as detailed in \cref{lst:indentRulesGlobal:environments}; if + you change the \texttt{environments} field to anything involving horizontal space, say \lstinline!" "!, and then run the following commands \index{switches!-l demonstration} @@ -246,12 +253,14 @@ latexindent.pl myenv-args.tex -local mand-args-no-add-glob.yaml latexindent.pl myenv-args.tex -l env-indentRules.yaml latexindent.pl myenv-args.tex -l myenv-rules1.yaml,env-indentRules.yaml \end{commandshell} - then the respective output is shown in \cref{lst:myenv-args-indent-rules-global1,lst:myenv-args-indent-rules-global2}. Note that in - \cref{lst:myenv-args-indent-rules-global1}, both the environment blocks have received a single-space - indentation, whereas in \cref{lst:myenv-args-indent-rules-global2} the \texttt{outer} environment - has received single-space indentation (specified by \texttt{indentRulesGlobal}), but - \texttt{myenv} has received \lstinline!" "!, as specified by the - particular \texttt{indentRules} for \texttt{myenv} \vref{lst:myenv-rules1}. + then the respective output is shown in + \cref{lst:myenv-args-indent-rules-global1,lst:myenv-args-indent-rules-global2}. Note that + in \cref{lst:myenv-args-indent-rules-global1}, both the environment blocks have received + a single-space indentation, whereas in \cref{lst:myenv-args-indent-rules-global2} the + \texttt{outer} environment has received single-space indentation (specified by + \texttt{indentRulesGlobal}), but \texttt{myenv} has received \lstinline!" "!, as + specified by the particular \texttt{indentRules} for \texttt{myenv} + \vref{lst:myenv-rules1}. \begin{minipage}{.45\textwidth} \cmhlistingsfromfile[showspaces=true]{demonstrations/myenvironment-args-global-rules1.tex}{\texttt{myenv-args.tex} using \cref{lst:indentRulesGlobal:environments}}{lst:myenv-args-indent-rules-global1} @@ -278,9 +287,10 @@ latexindent.pl myenv-args.tex -l myenv-rules1.yaml,env-indentRules.yaml latexindent.pl myenv-args.tex -local opt-args-indent-rules-glob.yaml latexindent.pl myenv-args.tex -local mand-args-indent-rules-glob.yaml \end{commandshell} - we obtain the respective outputs in \cref{lst:myenv-args-indent-rules-global3,lst:myenv-args-indent-rules-global4}. Note that the - \emph{optional} argument in \cref{lst:myenv-args-indent-rules-global3} has received two tabs worth - of indentation, while the \emph{mandatory} argument has done so in + we obtain the respective outputs in + \cref{lst:myenv-args-indent-rules-global3,lst:myenv-args-indent-rules-global4}. Note that + the \emph{optional} argument in \cref{lst:myenv-args-indent-rules-global3} has received + two tabs worth of indentation, while the \emph{mandatory} argument has done so in \cref{lst:myenv-args-indent-rules-global4}. \begin{widepage} |