diff options
author | Norbert Preining <norbert@preining.info> | 2021-06-20 03:01:22 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2021-06-20 03:01:22 +0000 |
commit | 0b024adf546cd484554e4de5bd1a9919a4fdd03d (patch) | |
tree | f688c8afa79d522868966c9c91e09088f28b5248 /support/latexindent/documentation/sec-fine-tuning.tex | |
parent | daa6873fe1d06863ffc2980970295b39071f02ba (diff) |
CTAN sync 202106200301
Diffstat (limited to 'support/latexindent/documentation/sec-fine-tuning.tex')
-rw-r--r-- | support/latexindent/documentation/sec-fine-tuning.tex | 63 |
1 files changed, 60 insertions, 3 deletions
diff --git a/support/latexindent/documentation/sec-fine-tuning.tex b/support/latexindent/documentation/sec-fine-tuning.tex index ccd04ffb47..928b3a0909 100644 --- a/support/latexindent/documentation/sec-fine-tuning.tex +++ b/support/latexindent/documentation/sec-fine-tuning.tex @@ -29,7 +29,7 @@ \end{warning} \begin{widepage} - \cmhlistingsfromfile[style=fineTuning]*{../defaultSettings.yaml}[width=0.95\linewidth,before=\centering,yaml-TCB]{\texttt{fineTuning}}{lst:fineTuning} + \cmhlistingsfromfile*[style=fineTuning]*{../defaultSettings.yaml}[width=.95\linewidth,before=\centering,yaml-TCB]{\texttt{fineTuning}}{lst:fineTuning} \end{widepage} The fields given in \cref{lst:fineTuning} are all \emph{regular expressions}. This manual @@ -171,6 +171,63 @@ latexindent.pl -m -y='modifyLineBreaks:oneSentencePerLine:manipulateSentences: 1 \end{commandshell} gives the output shown in \cref{lst:finetuning3-mod1}. - \cmhlistingsfromfile*{demonstrations/finetuning3.tex}{\texttt{finetuning3.tex}}{lst:finetuning3} - \cmhlistingsfromfile*{demonstrations/finetuning3-mod1.tex}{\texttt{finetuning3.tex} using -y switch}{lst:finetuning3-mod1} + \cmhlistingsfromfile{demonstrations/finetuning3.tex}{\texttt{finetuning3.tex}}{lst:finetuning3} + \cmhlistingsfromfile{demonstrations/finetuning3-mod1.tex}{\texttt{finetuning3.tex} using -y switch}{lst:finetuning3-mod1} + \end{example} + + \begin{example} + We can tweak the \texttt{fineTuning} for how trailing comments are classified. For motivation, let's consider + the code given in \cref{lst:finetuning4} + + \cmhlistingsfromfile*{demonstrations/finetuning4.tex}{\texttt{finetuning4.tex}}{lst:finetuning4} + + We will compare the settings given in \cref{lst:href1,lst:href2}. + + \begin{cmhtcbraster}[raster column skip=.01\linewidth, + raster left skip=0cm, + raster right skip=-0.5cm,] + \cmhlistingsfromfile*[style=yaml-LST]*{demonstrations/href1.yaml}[MLB-TCB]{\texttt{href1.yaml}}{lst:href1} + \cmhlistingsfromfile*[style=yaml-LST]*{demonstrations/href2.yaml}[MLB-TCB]{\texttt{href2.yaml}}{lst:href2} + \end{cmhtcbraster} + + Upon running the following commands + \begin{commandshell} +latexindent.pl -m finetuning4.tex -o=+-mod1 -l=href1 +latexindent.pl -m finetuning4.tex -o=+-mod2 -l=href2 +\end{commandshell} + we receive the respective output in \cref{lst:finetuning4-mod1,lst:finetuning4-mod2}. + + \begin{widepage} + \cmhlistingsfromfile*{demonstrations/finetuning4-mod1.tex}{\texttt{finetuning4.tex} using \cref{lst:href1}}{lst:finetuning4-mod1} + + \cmhlistingsfromfile*{demonstrations/finetuning4-mod2.tex}{\texttt{finetuning4.tex} using \cref{lst:href2}}{lst:finetuning4-mod2} + \end{widepage} + + We note that in: + \begin{itemize} + \item \cref{lst:finetuning4-mod1} the trailing comments are assumed to be everything following the + first comment symbol, which has meant that everything following it has been moved to the + end of the line; this is undesirable, clearly! + \item \cref{lst:finetuning4-mod2} has fine-tuned the trailing comment matching, and says that + \lstinline!%! cannot + be immediately preceeded by the words `Handbook', `for' or `Spoken', which means that + none of the \lstinline!%! symbols have been treated as trailing comments, and + the output is desirable. + \end{itemize} + + Another approach to this situation, which does not use \texttt{fineTuning}, is to use \texttt{noIndentBlock} + which we discussed in \vref{lst:noIndentBlock}; + using the settings in \cref{lst:href3} and running the command + \begin{commandshell} +latexindent.pl -m finetuning4.tex -o=+-mod3 -l=href3 +\end{commandshell} + then we receive the same output given in \cref{lst:finetuning4-mod2}; see also \texttt{paragraphsStopAt} + in \vref{lst:paragraphsStopAt}. + + \cmhlistingsfromfile*[style=yaml-LST]*{demonstrations/href3.yaml}[MLB-TCB]{\texttt{href3.yaml}}{lst:href3} + + With reference to the \texttt{body} field in \cref{lst:href3}, we note that \lstinline![^}]*?! can + be interpreted as: the fewest number of zero or more characters that are not right braces. This + is an example of character class. + \index{regular expressions!character class demonstration} \end{example} |