diff options
Diffstat (limited to 'support/latexindent/documentation/sec-default-user-local.tex')
-rw-r--r-- | support/latexindent/documentation/sec-default-user-local.tex | 327 |
1 files changed, 282 insertions, 45 deletions
diff --git a/support/latexindent/documentation/sec-default-user-local.tex b/support/latexindent/documentation/sec-default-user-local.tex index 2a657fae8a..e47115486b 100644 --- a/support/latexindent/documentation/sec-default-user-local.tex +++ b/support/latexindent/documentation/sec-default-user-local.tex @@ -18,15 +18,13 @@ \begin{commandshell} latexindent.pl myfile \end{commandshell} - \begin{wrapfigure}[8]{r}[0pt]{6cm} - \cmhlistingsfromfile[style=fileExtensionPreference]*{../defaultSettings.yaml}[width=.8\linewidth,before=\centering,yaml-TCB]{\texttt{fileExtensionPreference}}{lst:fileExtensionPreference} - \end{wrapfigure} - in which case the script will look for \texttt{myfile} with the extensions specified in \texttt{fileExtensionPreference} in their numeric order. If no match is found, the script will exit. As with all of the fields, you should change and/or add to this as necessary. + \cmhlistingsfromfile[style=fileExtensionPreference]*{../defaultSettings.yaml}[width=.8\linewidth,before=\centering,yaml-TCB]{\texttt{fileExtensionPreference}}{lst:fileExtensionPreference} + Calling \texttt{latexindent.pl myfile} with the (default) settings specified in \cref{lst:fileExtensionPreference} means that the script will first look for \texttt{myfile.tex}, then \texttt{myfile.sty}, \texttt{myfile.cls}, and @@ -128,14 +126,13 @@ copy myfile.bak4 to myfile.bak3 \yamltitle{noIndentBlock}*{fields} - \begin{wrapfigure}[8]{r}[0pt]{6cm} - \cmhlistingsfromfile[style=noIndentBlock]*{../defaultSettings.yaml}[width=.8\linewidth,before=\centering,yaml-TCB]{\texttt{noIndentBlock}}{lst:noIndentBlock} - \end{wrapfigure} If you have a block of code that you don't want \texttt{latexindent.pl} to touch (even if it is \emph{not} a verbatim-like environment) then you can wrap it in an environment from \texttt{noIndentBlock}; you can use any name you like for this, provided you populate it as demonstrate in \cref{lst:noIndentBlock}. + \cmhlistingsfromfile[style=noIndentBlock]*{../defaultSettings.yaml}[width=.4\linewidth,before=\centering,yaml-TCB]{\texttt{noIndentBlock}}{lst:noIndentBlock} + Of course, you don't want to have to specify these as null environments in your code, so you use them with a comment symbol, \lstinline!%!, followed by as many spaces (possibly none) as you like; see \cref{lst:noIndentBlockdemo} for example. @@ -152,35 +149,36 @@ copy myfile.bak4 to myfile.bak3 \yamltitle{removeTrailingWhitespace}*{fields}\label{yaml:removeTrailingWhitespace} - \begin{wrapfigure}[10]{r}[0pt]{7cm} - \cmhlistingsfromfile[style=removeTrailingWhitespace]*{../defaultSettings.yaml}[width=.8\linewidth,before=\centering,yaml-TCB]{removeTrailingWhitespace}{lst:removeTrailingWhitespace} - - \vspace{.1cm} - \begin{yaml}[numbers=none]{removeTrailingWhitespace (alt)}[width=.8\linewidth,before=\centering]{lst:removeTrailingWhitespace-alt} -removeTrailingWhitespace: 1 -\end{yaml} - \end{wrapfigure} Trailing white space can be removed both \emph{before} and \emph{after} processing the document, as detailed in \cref{lst:removeTrailingWhitespace}; each of the fields can take the values \texttt{0} or \texttt{1}. See \vref{lst:removeTWS-before,lst:env-mlb5-modAll,lst:env-mlb5-modAll-remove-WS} for before and after results. Thanks to \cite{vosskuhle} for providing this feature. + \begin{minipage}{.4\textwidth} + \cmhlistingsfromfile[style=removeTrailingWhitespace]*{../defaultSettings.yaml}[before=\centering,yaml-TCB]{removeTrailingWhitespace}{lst:removeTrailingWhitespace} + \end{minipage}% + \hfill + \begin{minipage}{.5\textwidth} + \begin{yaml}[numbers=none]{removeTrailingWhitespace (alt)}[before=\centering]{lst:removeTrailingWhitespace-alt} +removeTrailingWhitespace: 1 +\end{yaml} + \end{minipage}% + You can specify \texttt{removeTrailingWhitespace} simply as \texttt{0} or \texttt{1}, if you wish; in this case,% \announce{2017-06-28}{removeTrailingWhitespace} \texttt{latexindent.pl} will set both \texttt{beforeProcessing} and \texttt{afterProcessing} to the value you specify; see \cref{lst:removeTrailingWhitespace-alt}. \yamltitle{fileContentsEnvironments}*{field} - \begin{wrapfigure}[6]{r}[0pt]{6cm} - \cmhlistingsfromfile[style=fileContentsEnvironments]*{../defaultSettings.yaml}[width=.8\linewidth,before=\centering,yaml-TCB]{\texttt{fileContentsEnvironments}}{lst:fileContentsEnvironments} - \end{wrapfigure} Before \texttt{latexindent.pl} determines the difference between preamble (if any) and the main document, it first searches for any of the environments specified in \texttt{fileContentsEnvironments}, see \cref{lst:fileContentsEnvironments}. The behaviour of \texttt{latexindent.pl} on these environments is determined by their location (preamble or not), and the value \texttt{indentPreamble}, discussed next. + \cmhlistingsfromfile[style=fileContentsEnvironments]*{../defaultSettings.yaml}[width=.8\linewidth,before=\centering,yaml-TCB]{\texttt{fileContentsEnvironments}}{lst:fileContentsEnvironments} + \yamltitle{indentPreamble}{0|1} The preamble of a document can sometimes contain some trickier code for @@ -191,15 +189,14 @@ removeTrailingWhitespace: 1 \yamltitle{lookForPreamble}*{fields} - \begin{wrapfigure}[8]{r}[0pt]{5cm} - \cmhlistingsfromfile[style=lookForPreamble]*{../defaultSettings.yaml}[width=.8\linewidth,before=\centering,yaml-TCB]{lookForPreamble}{lst:lookForPreamble} - \end{wrapfigure} Not all files contain preamble; for example, \texttt{sty}, \texttt{cls} and \texttt{bib} files typically do \emph{not}. Referencing \cref{lst:lookForPreamble}, if you set, for example, \texttt{.tex} to \texttt{0}, then regardless of the setting of the value of \texttt{indentPreamble}, preamble will not be assumed when operating upon \texttt{.tex} files. + + \cmhlistingsfromfile[style=lookForPreamble]*{../defaultSettings.yaml}[width=.8\linewidth,before=\centering,yaml-TCB]{lookForPreamble}{lst:lookForPreamble} \yamltitle{preambleCommandsBeforeEnvironments}{0|1} Assuming that \texttt{latexindent.pl} is asked to operate upon the preamble of a document, when this switch is set to \texttt{0} then environment code blocks @@ -223,8 +220,13 @@ postfoothook=\end{mdframed}, \emph{remove} all indentation by setting \texttt{defaultIndent: ""}. \yamltitle{lookForAlignDelims}*{fields}\label{yaml:lookforaligndelims} - \begin{wrapfigure}[12]{r}[0pt]{5cm} - \begin{yaml}[numbers=none]{\texttt{lookForAlignDelims} (basic)}[width=.8\linewidth,before=\centering]{lst:aligndelims:basic} + This contains a list of environments and/or commands that are operated upon in a special + way by \texttt{latexindent.pl} (see \cref{lst:aligndelims:basic}). In fact, the fields in \texttt{lookForAlignDelims} can + actually take two different forms: the \emph{basic} version is shown in + \cref{lst:aligndelims:basic} and the \emph{advanced} version in + \cref{lst:aligndelims:advanced}; we will discuss each in turn. + + \begin{yaml}[numbers=none]{\texttt{lookForAlignDelims} (basic)}[width=.8\linewidth,before=\centering]{lst:aligndelims:basic} lookForAlignDelims: tabular: 1 tabularx: 1 @@ -233,12 +235,6 @@ lookForAlignDelims: matrix: 1 ... \end{yaml} - \end{wrapfigure} - This contains a list of environments and/or commands that are operated upon in a special - way by \texttt{latexindent.pl} (see \cref{lst:aligndelims:basic}). In fact, the fields in \texttt{lookForAlignDelims} can - actually take two different forms: the \emph{basic} version is shown in - \cref{lst:aligndelims:basic} and the \emph{advanced} version in - \cref{lst:aligndelims:advanced}; we will discuss each in turn. The environments specified in this field will be operated on in a special way by \texttt{latexindent.pl}. In particular, it will try and align each column by its @@ -261,7 +257,7 @@ lookForAlignDelims: delimiter-aligned block, then the advanced form of \texttt{lookForAlignDelims} shown in \cref{lst:aligndelims:advanced} is for you. - \cmhlistingsfromfile[style=yaml-LST]*{demonstrations/tabular.yaml}[yaml-TCB]{\texttt{tabular.yaml}}{lst:aligndelims:advanced} + \cmhlistingsfromfile*[style=lookForAlignDelims]*{../defaultSettings.yaml}[width=.8\linewidth,before=\centering,yaml-TCB]{\texttt{lookForAlignDelims} (advanced)}{lst:aligndelims:advanced} Note that you can use a mixture of the basic and advanced form: in \cref{lst:aligndelims:advanced} \texttt{tabular} and \texttt{tabularx} are advanced @@ -292,11 +288,25 @@ lookForAlignDelims: $\geq$ 0) of spaces to be placed \emph{After} ampersands (default: 1); \item \announce{2018-01-13}{justification of cells in ampersand alignment}\texttt{justification}: optionally specifies the justification of - each cell as either \emph{left} or \emph{right} (default: left). + each cell as either \emph{left} or \emph{right} (default: left); + \item \announce*{2020-03-21}{align final double back slash}{alignFinalDoubleBackSlash} optionally specifies if the + \emph{final} double back slash should be used for alignment (default: 0); + \item \announce*{2020-03-21}{don't measure feature}{dontMeasure} optionally specifies if + user-specified cells, rows or the largest entries should \emph{not} be + measured (default: 0); + \item \announce*{2020-03-21}{delimiter RegEx feature}{delimiterRegEx} optionally specifies the pattern + matching to be used for the alignment delimeter (default: \lstinline3 '(?<!\\)(&)'3); + \item \announce*{2020-03-21}{delimiter justification}{delimiterJustification} optionally specifies the justification + for the alignment delimeters (default: left); note that this feature is only useful if + you have delimiters of different lengths in the same column, discussed in + \cref{sec:delimiter-reg-ex}. \end{itemize} - We will explore each of these features using the file \texttt{tabular2.tex} in - \cref{lst:tabular2} (which contains a \lstinline!\multicolumn! command), and the YAML files in \crefrange{lst:tabular2YAML}{lst:tabular8YAML}. + We will explore most of these features using the file \texttt{tabular2.tex} in + \cref{lst:tabular2} (which contains a \lstinline!\multicolumn! command), and the YAML files in \crefrange{lst:tabular2YAML}{lst:tabular8YAML}; we will explore + \texttt{alignFinalDoubleBackSlash} in \cref{lst:tabular4}; the \texttt{dontMeasure} feature + will be described in \cref{sec:dontMeasure}, and \texttt{delimiterRegEx} in + \cref{sec:delimiter-reg-ex}. \cmhlistingsfromfile{demonstrations/tabular2.tex}{\texttt{tabular2.tex}}{lst:tabular2} \begin{minipage}{.45\textwidth} @@ -384,6 +394,34 @@ latexindent.pl tabular2.tex -l tabular2.yaml,tabular8.yaml correctly, because of the settings in \cref{lst:tabular2YAML}. \end{itemize} + We explore% + \announce*{2020-03-21}{alignFinalDoubleBackSlash demonstration} the + \texttt{alignFinalDoubleBackSlash} feature by using the file in \cref{lst:tabular4}. Upon + running the following commands + \begin{commandshell} +latexindent.pl tabular4.tex -o=+-default +latexindent.pl tabular4.tex -o=+-FDBS -y="lookForAlignDelims:tabular:alignFinalDoubleBackSlash:1" +\end{commandshell} + then we receive the respective outputs given in \cref{lst:tabular4-default} and + \cref{lst:tabular4-FDBS}. + + \begin{cmhtcbraster}[raster columns=3, + raster left skip=-3.75cm, + raster right skip=-2cm,] + \cmhlistingsfromfile*{demonstrations/tabular4.tex}{\texttt{tabular4.tex}}{lst:tabular4} + \cmhlistingsfromfile*{demonstrations/tabular4-default.tex}{\texttt{tabular4-default.tex}}{lst:tabular4-default} + \cmhlistingsfromfile*{demonstrations/tabular4-FDBS.tex}{\texttt{tabular4-FDBS.tex}}{lst:tabular4-FDBS} + \end{cmhtcbraster} + + We note that in: + \begin{itemize} + \item \cref{lst:tabular4-default}, by default, the \emph{first} set of double back + slashes in the first row of the \texttt{tabular} environment have been used for + alignment; + \item \cref{lst:tabular4-FDBS}, the \emph{final} set of double back slashes in the + first row have been used, because we specified \texttt{alignFinalDoubleBackSlash} as 1. + \end{itemize} + As of Version 3.0, the alignment routine works on mandatory and optional arguments within commands, and also within `special' code blocks (see \texttt{specialBeginEnd} on \cpageref{yaml:specialBeginEnd}); for example, assuming that you have a command called @@ -419,6 +457,207 @@ latexindent.pl matrix1.tex (see \vref{sec:noadd-indent-rules}), these comment-marked blocks are considered \texttt{environments}. +\subsection{lookForAlignDelims: the dontMeasure feature}\label{sec:dontMeasure} + The% + \announce*{2020-03-21}{don't measure feature} \texttt{lookForAlignDelims} + field can, optionally, receive the \texttt{dontMeasure} option which can be specified + in a few different ways. We will explore this feature in relation to the code given in + \cref{lst:tabular-DM}; the default output is shown in \cref{lst:tabular-DM-default}. + + \begin{cmhtcbraster} + \cmhlistingsfromfile*{demonstrations/tabular-DM.tex}{\texttt{tabular-DM.tex}}{lst:tabular-DM} + \cmhlistingsfromfile*{demonstrations/tabular-DM-default.tex}{\texttt{tabular-DM.tex} default output}{lst:tabular-DM-default} + \end{cmhtcbraster} + + The \texttt{dontMeasure} field can be specified as \texttt{largest}, and in + which case, the largest element will not be measured; with reference to the YAML file + given in \cref{lst:dontMeasure1}, we can run the command + \begin{commandshell} +latexindent.pl tabular-DM.tex -l=dontMeasure1.yaml +\end{commandshell} + and receive the output given in \cref{lst:tabular-DM-mod1}. + + \begin{cmhtcbraster} + \cmhlistingsfromfile*{demonstrations/tabular-DM-mod1.tex}{\texttt{tabular-DM.tex} using \cref{lst:dontMeasure1}}{lst:tabular-DM-mod1} + \cmhlistingsfromfile*{demonstrations/dontMeasure1.yaml}[yaml-TCB]{\texttt{dontMeasure1.yaml}}{lst:dontMeasure1} + \end{cmhtcbraster} + + We note that the \emph{largest} column entries have not contributed to the + measuring routine. + + The \texttt{dontMeasure} field can also be specified in the form demonstrated in + \cref{lst:dontMeasure2}. On running the following commands, + \begin{commandshell} +latexindent.pl tabular-DM.tex -l=dontMeasure2.yaml +\end{commandshell} + we receive the output in \cref{lst:tabular-DM-mod2}. + + \begin{cmhtcbraster} + \cmhlistingsfromfile*{demonstrations/tabular-DM-mod2.tex}{\texttt{tabular-DM.tex} using \cref{lst:dontMeasure2} or \cref{lst:dontMeasure3}}{lst:tabular-DM-mod2} + \cmhlistingsfromfile*{demonstrations/dontMeasure2.yaml}[yaml-TCB]{\texttt{dontMeasure2.yaml}}{lst:dontMeasure2} + \end{cmhtcbraster} + + We note that in \cref{lst:dontMeasure2} we have specified entries not to be measured, one + entry per line. + + The \texttt{dontMeasure} field can also be specified in the forms demonstrated in + \cref{lst:dontMeasure3} and \cref{lst:dontMeasure4}. Upon running the commands + \begin{commandshell} +latexindent.pl tabular-DM.tex -l=dontMeasure3.yaml +latexindent.pl tabular-DM.tex -l=dontMeasure4.yaml +\end{commandshell} + we receive the output given in \cref{lst:tabular-DM-mod3} + \begin{cmhtcbraster}[raster columns=3, + raster left skip=-3.5cm, + raster right skip=-2cm, + raster column skip=.03\linewidth] + \cmhlistingsfromfile*{demonstrations/tabular-DM-mod3.tex}{\texttt{tabular-DM.tex} using \cref{lst:dontMeasure3} or \cref{lst:dontMeasure3}}{lst:tabular-DM-mod3} + \cmhlistingsfromfile*{demonstrations/dontMeasure3.yaml}[yaml-TCB]{\texttt{dontMeasure3.yaml}}{lst:dontMeasure3} + \cmhlistingsfromfile*{demonstrations/dontMeasure4.yaml}[yaml-TCB]{\texttt{dontMeasure4.yaml}}{lst:dontMeasure4} + \end{cmhtcbraster} + We note that in: + \begin{itemize} + \item \cref{lst:dontMeasure3} we have specified entries not to be measured, each one has a + \emph{string} in the \texttt{this} + field, together with an optional specification of \texttt{applyTo} as + \texttt{cell}; + \item \cref{lst:dontMeasure4} we have specified entries not to be measured as a + \emph{regular expression} using + the \texttt{regex} field, together with an optional specification of + \texttt{applyTo} as \texttt{cell} field, together with an optional + specification of \texttt{applyTo} as \texttt{cell}. + \end{itemize} + In both cases, the default value of \texttt{applyTo} is \texttt{cell}, + and does not need to be specified. + + We may also specify the \texttt{applyTo} field as \texttt{row}, a + demonstration of which is given in \cref{lst:dontMeasure5}; upon running + \begin{commandshell} +latexindent.pl tabular-DM.tex -l=dontMeasure5.yaml +\end{commandshell} + we receive the output in \cref{lst:tabular-DM-mod5}. + \begin{cmhtcbraster} + \cmhlistingsfromfile*{demonstrations/tabular-DM-mod5.tex}{\texttt{tabular-DM.tex} using \cref{lst:dontMeasure5}}{lst:tabular-DM-mod5} + \cmhlistingsfromfile*{demonstrations/dontMeasure5.yaml}[yaml-TCB]{\texttt{dontMeasure5.yaml}}{lst:dontMeasure5} + \end{cmhtcbraster} + + Finally, the \texttt{applyTo} field can be specified as \texttt{row}, + together with a \texttt{regex} expression. For example, for the settings given + in \cref{lst:dontMeasure6}, upon running + \begin{commandshell} +latexindent.pl tabular-DM.tex -l=dontMeasure6.yaml +\end{commandshell} + we receive the output in \cref{lst:tabular-DM-mod6}. + + \begin{cmhtcbraster} + \cmhlistingsfromfile*{demonstrations/tabular-DM-mod6.tex}{\texttt{tabular-DM.tex} using \cref{lst:dontMeasure6}}{lst:tabular-DM-mod6} + \cmhlistingsfromfile*{demonstrations/dontMeasure6.yaml}[yaml-TCB]{\texttt{dontMeasure6.yaml}}{lst:dontMeasure6} + \end{cmhtcbraster} + +\subsection{lookForAlignDelims: the delimiterRegEx and delimiterJustification feature}\label{sec:delimiter-reg-ex} + The delimiter alignment% + \announce*{2020-03-21}{delimiterRegEx feature} will, by + default, align code blocks at the ampersand character. The behaviour is controlled by the + \texttt{delimiterRegEx} field within \texttt{lookForAlignDelims}; the default value is + \lstinline3'(?<!\\)(&)'3, which can be read as: \emph{an ampersand, as long as it is not immediately preceeded by a backslash}. + + \begin{warning} + Important: note the `capturing' parenthesis in the \lstinline!(&)! which are necessary; if you + intend to customise this field, then be sure to include them appropriately. + \end{warning} + + We demonstrate how to customise this with respect to the code given in + \cref{lst:tabbing}; the default output from \lstinline!latexindent.pl! is given in + \cref{lst:tabbing-default}. + + \begin{cmhtcbraster} + \cmhlistingsfromfile*{demonstrations/tabbing.tex}{\texttt{tabbing.tex}}{lst:tabbing} + \cmhlistingsfromfile*{demonstrations/tabbing-default.tex}{\texttt{tabbing.tex} default output}{lst:tabbing-default} + \end{cmhtcbraster} + + Let's say that we wish to align the code at either the \lstinline!\=! or + \lstinline!\>!. We employ the settings given in \cref{lst:delimiterRegEx1} and run + the command + \begin{commandshell} +latexindent.pl tabbing.tex -l=delimiterRegEx1.yaml +\end{commandshell} + to receive the output given in \cref{lst:tabbing-mod1}. + + \begin{cmhtcbraster} + \cmhlistingsfromfile*{demonstrations/tabbing-mod1.tex}{\texttt{tabbing.tex} using \cref{lst:delimiterRegEx1}}{lst:tabbing-mod1} + \cmhlistingsfromfile*{demonstrations/delimiterRegEx1.yaml}[yaml-TCB]{\texttt{delimiterRegEx1.yaml}}{lst:delimiterRegEx1} + \end{cmhtcbraster} + We note that: + \begin{itemize} + \item in \cref{lst:tabbing-mod1} the code has been aligned, as intended, at both the + \lstinline!\=! and \lstinline!\>!; + \item in \cref{lst:delimiterRegEx1} we have heeded the warning and captured the expression using + grouping parenthesis, specified a backslash using \lstinline!\\! and said that + it must be followed by either \lstinline!=! or \lstinline!>!. + \end{itemize} + We can explore \texttt{delimiterRegEx} a little further using the settings in + \cref{lst:delimiterRegEx2} and run the command + \begin{commandshell} +latexindent.pl tabbing.tex -l=delimiterRegEx2.yaml +\end{commandshell} + to receive the output given in \cref{lst:tabbing-mod2}. + + \begin{cmhtcbraster} + \cmhlistingsfromfile*{demonstrations/tabbing-mod2.tex}{\texttt{tabbing.tex} using \cref{lst:delimiterRegEx2}}{lst:tabbing-mod2} + \cmhlistingsfromfile*{demonstrations/delimiterRegEx2.yaml}[yaml-TCB]{\texttt{delimiterRegEx2.yaml}}{lst:delimiterRegEx2} + \end{cmhtcbraster} + We note that only the \lstinline!\>! have been aligned. + + Of course, the other lookForAlignDelims options can be used alongside the + \texttt{delimiterRegEx}; regardless of the type of delimiter being used (ampersand or + anything else), the fields from \vref{lst:aligndelims:advanced} remain the same; for example, + using the settings in \cref{lst:delimiterRegEx3}, and running + \begin{commandshell} +latexindent.pl tabbing.tex -l=delimiterRegEx3.yaml +\end{commandshell} + to receive the output given in \cref{lst:tabbing-mod3}. + + \begin{cmhtcbraster} + \cmhlistingsfromfile*{demonstrations/tabbing-mod3.tex}{\texttt{tabbing.tex} using \cref{lst:delimiterRegEx3}}{lst:tabbing-mod3} + \cmhlistingsfromfile*{demonstrations/delimiterRegEx3.yaml}[yaml-TCB]{\texttt{delimiterRegEx3.yaml}}{lst:delimiterRegEx3} + \end{cmhtcbraster} + + It is possible that delimiters specified within \texttt{delimiterRegEx} can be of + different lengths. Consider the file in \cref{lst:tabbing1}, and associated YAML in + \cref{lst:delimiterRegEx4}. Note that the \cref{lst:delimiterRegEx4} specifies the + option for the delimiter to be either \lstinline!#! or \lstinline!\>!, + \emph{which are different lengths}. Upon running the command + \begin{commandshell} +latexindent.pl tabbing1.tex -l=delimiterRegEx4.yaml -o=+-mod4 +\end{commandshell} + we receive the output in \cref{lst:tabbing1-mod4}. + + \begin{cmhtcbraster}[raster columns=3, + raster left skip=-3.5cm, + raster right skip=-2cm, + raster column skip=.03\linewidth] + \cmhlistingsfromfile*{demonstrations/tabbing1.tex}{\texttt{tabbing1.tex}}{lst:tabbing1} + \cmhlistingsfromfile*{demonstrations/tabbing1-mod4.tex}{\texttt{tabbing1-mod4.tex}}{lst:tabbing1-mod4} + \cmhlistingsfromfile*{demonstrations/delimiterRegEx4.yaml}[yaml-TCB]{\texttt{delimiterRegEx4.yaml}}{lst:delimiterRegEx4} + \end{cmhtcbraster} + + You can set the \emph{delimiter} justification as either \texttt{left} (default) + or \texttt{right}, which will only have effect when delimiters in the same + column have different lengths. Using the settings in \cref{lst:delimiterRegEx5} and running + the command + \begin{commandshell} +latexindent.pl tabbing1.tex -l=delimiterRegEx5.yaml -o=+-mod5 +\end{commandshell} + gives the output in \cref{lst:tabbing1-mod5}. + + \begin{cmhtcbraster} + \cmhlistingsfromfile*{demonstrations/tabbing1-mod5.tex}{\texttt{tabbing1-mod5.tex}}{lst:tabbing1-mod5} + \cmhlistingsfromfile*{demonstrations/delimiterRegEx5.yaml}[yaml-TCB]{\texttt{delimiterRegEx5.yaml}}{lst:delimiterRegEx5} + \end{cmhtcbraster} + + Note that in \cref{lst:tabbing1-mod5} the second set of delimiters have been + \emph{right aligned} -- it is quite subtle! + \yamltitle{indentAfterItems}*{fields} The environment names specified in \texttt{indentAfterItems} tell \texttt{latexindent.pl} to look for \lstinline!\item! commands; if these switches are set to @@ -435,9 +674,6 @@ latexindent.pl matrix1.tex \end{cmhtcbraster} \yamltitle{itemNames}*{fields} - \begin{wrapfigure}[5]{r}[0pt]{5cm} - \cmhlistingsfromfile[style=itemNames]*{../defaultSettings.yaml}[width=.8\linewidth,before=\centering,yaml-TCB]{\texttt{itemNames}}{lst:itemNames} - \end{wrapfigure} If you have your own \texttt{item} commands (perhaps you prefer to use \texttt{myitem}, for example) then you can put populate them in \texttt{itemNames}. For example, users of the \texttt{exam} document class @@ -446,6 +682,8 @@ latexindent.pl matrix1.tex \vref{sec:indentconfig} for details of how to configure user settings, and \vref{lst:mysettings} \\ in particular \label{page:examsettings}.) + \cmhlistingsfromfile[style=itemNames]*{../defaultSettings.yaml}[width=.8\linewidth,before=\centering,yaml-TCB]{\texttt{itemNames}}{lst:itemNames} + \yamltitle{specialBeginEnd}*{fields}\label{yaml:specialBeginEnd} The fields specified% \announce{2017-08-21}*{specialBeginEnd} in @@ -568,21 +806,20 @@ latexindent.pl special3.tex -l=special-verb1 \end{cmhtcbraster} \yamltitle{indentAfterHeadings}*{fields} - \begin{wrapfigure}[17]{r}[0pt]{8cm} - \cmhlistingsfromfile[style=indentAfterHeadings]*{../defaultSettings.yaml}[width=.8\linewidth,before=\centering,yaml-TCB]{\texttt{indentAfterHeadings}}{lst:indentAfterHeadings} - \end{wrapfigure} This field enables the user to specify indentation rules that take effect after heading commands such as \lstinline!\part!, \lstinline!\chapter!, \lstinline!\section!, \lstinline!\subsection*!, or indeed any user-specified command written in this field.\footnote{There is a slight difference in interface for this field when comparing Version 2.2 to Version 3.0; see \vref{app:differences} for details.} + \cmhlistingsfromfile[style=indentAfterHeadings]*{../defaultSettings.yaml}[width=.8\linewidth,before=\centering,yaml-TCB]{\texttt{indentAfterHeadings}}{lst:indentAfterHeadings} + The default settings do \emph{not} place indentation after a heading, but - you can easily switch them on by changing \\ \texttt{indentAfterThisHeading: 0} to \\ - \texttt{indentAfterThisHeading: 1}. The \texttt{level} field tells \texttt{latexindent.pl} - the hierarchy of the heading structure in your document. You might, for example, like to - have both \texttt{section} and \texttt{subsection} set with - \texttt{level: 3} because you do not want the indentation to go too deep. + you can easily switch them on by changing \texttt{indentAfterThisHeading} from 0 to 1. The + \texttt{level} field tells \texttt{latexindent.pl} the hierarchy of the heading + structure in your document. You might, for example, like to have both + \texttt{section} and \texttt{subsection} set with \texttt{level: 3} + because you do not want the indentation to go too deep. You can add any of your own custom heading commands to this field, specifying the \texttt{level} as appropriate. You can also specify your own indentation in @@ -733,5 +970,5 @@ mand arg text \end{table} We will refer to these code blocks in what follows.% - \announce*{2019-07-13}{fine tuning of code blocks} Note that the fine tuning of the definition of the code blocks + \announce{2019-07-13}{fine tuning of code blocks} Note that the fine tuning of the definition of the code blocks detailed in \cref{tab:code-blocks} is discussed in \vref{sec:finetuning}. |