diff options
Diffstat (limited to 'support/latexindent/documentation/sec-replacements.tex')
-rw-r--r-- | support/latexindent/documentation/sec-replacements.tex | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/support/latexindent/documentation/sec-replacements.tex b/support/latexindent/documentation/sec-replacements.tex index a31ad0721b..a36c4199cf 100644 --- a/support/latexindent/documentation/sec-replacements.tex +++ b/support/latexindent/documentation/sec-replacements.tex @@ -1,4 +1,4 @@ -% arara: pdflatex: {shell: yes, files: [latexindent]} +% arara: pdflatex: { files: [latexindent]} \section{The -r, -rv and -rr switches}\label{sec:replacements} \fancyhead[R]{\bfseries\thepage% \tikz[remember picture,overlay] { @@ -41,7 +41,7 @@ \texttt{-rv} or \texttt{-rr} switches are active; when discussing YAML settings related to the replacement-mode switches, we will use the style given in \cref{lst:replacements}. - \cmhlistingsfromfile[style=replacements]*{../defaultSettings.yaml}[width=0.95\linewidth,before=\centering,replace-TCB]{\texttt{replacements}}{lst:replacements} + \cmhlistingsfromfile[style=replacements]{../defaultSettings.yaml}[width=0.95\linewidth,before=\centering,replace-TCB]{\texttt{replacements}}{lst:replacements} The first entry within the \texttt{replacements} field is \texttt{amalgamate}, and is \emph{optional}; by default it is set to 1, so that replacements will be amalgamated from @@ -81,7 +81,7 @@ latexindent.pl -r replace1.tex -l=replace1.yaml \begin{cmhtcbraster}[raster column skip=.01\linewidth] \cmhlistingsfromfile{demonstrations/replace1-mod1.tex}{\texttt{replace1.tex} using \cref{lst:replace1-yaml}}{lst:replace1-mod1} - \cmhlistingsfromfile[style=yaml-LST]*{demonstrations/replace1.yaml}[replace-TCB]{\texttt{replace1.yaml}}{lst:replace1-yaml} + \cmhlistingsfromfile[style=yaml-LST]{demonstrations/replace1.yaml}[replace-TCB]{\texttt{replace1.yaml}}{lst:replace1-yaml} \end{cmhtcbraster} Note that in \cref{lst:replace1-yaml} we have specified \texttt{amalgamate} as 0 so that @@ -125,7 +125,7 @@ latexindent.pl -r colsep.tex -l=colsep.yaml then we achieve the output in \cref{lst:colsep-mod0}. \begin{cmhtcbraster}[raster column skip=.01\linewidth] \cmhlistingsfromfile{demonstrations/colsep-mod0.tex}{\texttt{colsep.tex} using \cref{lst:colsep}}{lst:colsep-mod0} - \cmhlistingsfromfile[style=yaml-LST]*{demonstrations/colsep.yaml}[replace-TCB]{\texttt{colsep.yaml}}{lst:colsep-yaml} + \cmhlistingsfromfile[style=yaml-LST]{demonstrations/colsep.yaml}[replace-TCB]{\texttt{colsep.yaml}}{lst:colsep-yaml} \end{cmhtcbraster} Note that in \cref{lst:colsep-yaml}, we have specified \emph{two} separate fields, each with their own `\emph{this}' field; furthermore, for both of the separate fields, we have not specified `\texttt{that}', so the \texttt{that} field @@ -145,7 +145,7 @@ latexindent.pl -r colsep.tex -l=colsep1.yaml raster force size=false, raster column 1/.style={add to width=-.1\textwidth}] \cmhlistingsfromfile{demonstrations/colsep-mod1.tex}{\texttt{colsep.tex} using \cref{lst:colsep1}}{lst:colsep-mod1} - \cmhlistingsfromfile[style=yaml-LST]*{demonstrations/colsep1.yaml}[replace-TCB,width=0.6\textwidth]{\texttt{colsep1.yaml}}{lst:colsep1} + \cmhlistingsfromfile[style=yaml-LST]{demonstrations/colsep1.yaml}[replace-TCB,width=0.6\textwidth]{\texttt{colsep1.yaml}}{lst:colsep1} \end{cmhtcbraster} The code given in \cref{lst:colsep1} is an example of a \emph{regular expression}, which we may abbreviate to \emph{regex} @@ -181,7 +181,7 @@ latexindent.pl -r colsep.tex -l=multi-line.yaml then we achieve the output in \cref{lst:colsep-mod2}. \begin{cmhtcbraster}[raster column skip=.01\linewidth] \cmhlistingsfromfile{demonstrations/colsep-mod2.tex}{\texttt{colsep.tex} using \cref{lst:multi-line}}{lst:colsep-mod2} - \cmhlistingsfromfile[style=yaml-LST]*{demonstrations/multi-line.yaml}[replace-TCB]{\texttt{multi-line.yaml}}{lst:multi-line} + \cmhlistingsfromfile[style=yaml-LST]{demonstrations/multi-line.yaml}[replace-TCB]{\texttt{multi-line.yaml}}{lst:multi-line} \end{cmhtcbraster} With reference to \cref{lst:multi-line}, we have specified a \emph{multi-line} version of \texttt{this} by employing the \emph{literal} YAML style \lstinline!|-!. See, for example, \href{https://stackoverflow.com/questions/3790454/in-yaml-how-do-i-break-a-string-over-multiple-lines}{https://stackoverflow.com/questions/3790454/in-yaml-how-do-i-break-a-string-over-multiple-lines} @@ -200,7 +200,7 @@ latexindent.pl -r colsep.tex -l=multi-line1.yaml then we achieve the output in \cref{lst:colsep-mod3}. \begin{cmhtcbraster}[raster column skip=.01\linewidth] \cmhlistingsfromfile{demonstrations/colsep-mod3.tex}{\texttt{colsep.tex} using \cref{lst:multi-line1}}{lst:colsep-mod3} - \cmhlistingsfromfile[style=yaml-LST]*{demonstrations/multi-line1.yaml}[replace-TCB]{\texttt{multi-line1.yaml}}{lst:multi-line1} + \cmhlistingsfromfile[style=yaml-LST]{demonstrations/multi-line1.yaml}[replace-TCB]{\texttt{multi-line1.yaml}}{lst:multi-line1} \end{cmhtcbraster} We note that, because we have specified \texttt{when: after}, that \texttt{latexindent.pl} has not found the string specified in \cref{lst:multi-line1} within the file in \vref{lst:colsep}. As it has looked for the string within \cref{lst:multi-line1} \emph{after} the indentation has been performed. After @@ -236,7 +236,7 @@ latexindent.pl -r displaymath.tex -l=displaymath1.yaml \begin{cmhtcbraster}[raster left skip=-3.75cm, raster right skip=-2cm,] \cmhlistingsfromfile{demonstrations/displaymath-mod1.tex}{\texttt{displaymath.tex} using \cref{lst:displaymath1}}{lst:displaymath-mod1} - \cmhlistingsfromfile[style=yaml-LST]*{demonstrations/displaymath1.yaml}[replace-TCB]{\texttt{displaymath1.yaml}}{lst:displaymath1} + \cmhlistingsfromfile[style=yaml-LST]{demonstrations/displaymath1.yaml}[replace-TCB]{\texttt{displaymath1.yaml}}{lst:displaymath1} \end{cmhtcbraster} A few notes about \cref{lst:displaymath1}: @@ -265,7 +265,7 @@ latexindent.pl -r -m displaymath.tex -l=displaymath1.yaml,equation.yaml raster column 1/.style={add to width=-.1\textwidth}, raster column skip=.06\linewidth] \cmhlistingsfromfile{demonstrations/displaymath-mod2.tex}{\texttt{displaymath.tex} using \cref{lst:displaymath1,lst:equation}}{lst:displaymath-mod2} - \cmhlistingsfromfile[style=yaml-LST]*{demonstrations/equation.yaml}[MLB-TCB,width=0.55\textwidth]{\texttt{equation.yaml}}{lst:equation} + \cmhlistingsfromfile[style=yaml-LST]{demonstrations/equation.yaml}[MLB-TCB,width=0.55\textwidth]{\texttt{equation.yaml}}{lst:equation} \end{cmhtcbraster} \end{example} @@ -288,7 +288,7 @@ latexindent.pl -r phrase.tex -l=hspace.yaml \begin{cmhtcbraster} \cmhlistingsfromfile{demonstrations/phrase-mod1.tex}{\texttt{phrase.tex} using \cref{lst:hspace}}{lst:phrase-mod1} - \cmhlistingsfromfile[style=yaml-LST]*{demonstrations/hspace.yaml}[replace-TCB]{\texttt{hspace.yaml}}{lst:hspace} + \cmhlistingsfromfile[style=yaml-LST]{demonstrations/hspace.yaml}[replace-TCB]{\texttt{hspace.yaml}}{lst:hspace} \end{cmhtcbraster} The \lstinline!\h+! setting in \cref{lst:hspace} say to replace \emph{at least one horizontal space} with a single space. @@ -311,7 +311,7 @@ latexindent.pl -r references.tex -l=reference.yaml \cmhlistingsfromfile{demonstrations/references-mod1.tex}{\texttt{references.tex} using \cref{lst:reference}}{lst:references-mod1} - \cmhlistingsfromfile[style=yaml-LST]*{demonstrations/reference.yaml}[replace-TCB]{\texttt{reference.yaml}}{lst:reference} + \cmhlistingsfromfile[style=yaml-LST]{demonstrations/reference.yaml}[replace-TCB]{\texttt{reference.yaml}}{lst:reference} Referencing \cref{lst:reference}, the \lstinline!|! means \emph{or}, we have used \emph{capture groups}, together with an example of an \emph{optional} pattern, \lstinline!(?:eq)?!. @@ -323,7 +323,7 @@ latexindent.pl -r references.tex -l=reference.yaml \begin{cmhtcbraster} \cmhlistingsfromfile{demonstrations/verb1.tex}{\texttt{verb1.tex}}{lst:verb1} - \cmhlistingsfromfile[style=yaml-LST]*{demonstrations/verbatim1.yaml}[replace-TCB]{\texttt{verbatim1.yaml}}{lst:verbatim1-yaml} + \cmhlistingsfromfile[style=yaml-LST]{demonstrations/verbatim1.yaml}[replace-TCB]{\texttt{verbatim1.yaml}}{lst:verbatim1-yaml} \end{cmhtcbraster} Upon running the following commands, |