From 1d47aeb4b6825139fc0f32c3549fbdf3fef6bb5c Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 28 Apr 2018 21:57:31 +0000 Subject: latexindent (28apr18) git-svn-id: svn://tug.org/texlive/trunk@47471 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/support/latexindent/README | 2 +- .../doc/support/latexindent/appendices.tex | 12 +- .../doc/support/latexindent/cmhlistings.tex | 21 ++ .../doc/support/latexindent/figure-schematic.tex | 33 +++ .../doc/support/latexindent/latexindent.pdf | Bin 690275 -> 690820 bytes .../doc/support/latexindent/latexindent.tex | 38 ++- .../sec-conclusions-know-limitations.tex | 4 +- .../support/latexindent/sec-default-user-local.tex | 83 ++++-- .../doc/support/latexindent/sec-how-to-use.tex | 10 +- .../latexindent/sec-indent-config-and-settings.tex | 37 +-- .../doc/support/latexindent/sec-introduction.tex | 2 + .../doc/support/latexindent/sec-the-m-switch.tex | 306 ++++++++------------- .../subsec-commands-and-their-options.tex | 95 ++++++- .../subsec-noAdditionalIndent-indentRules.tex | 2 +- .../subsec-partnering-poly-switches.tex | 2 +- .../subsubsec-environments-and-their-arguments.tex | 4 +- .../doc/support/latexindent/subsubsec-headings.tex | 2 +- .../doc/support/latexindent/subsubsec-ifelsefi.tex | 13 + .../subsubsec-no-add-remaining-code-blocks.tex | 8 +- .../doc/support/latexindent/subsubsec-special.tex | 2 +- .../texmf-dist/doc/support/latexindent/title.tex | 2 +- 21 files changed, 376 insertions(+), 302 deletions(-) create mode 100644 Master/texmf-dist/doc/support/latexindent/cmhlistings.tex create mode 100644 Master/texmf-dist/doc/support/latexindent/figure-schematic.tex (limited to 'Master/texmf-dist/doc/support/latexindent') diff --git a/Master/texmf-dist/doc/support/latexindent/README b/Master/texmf-dist/doc/support/latexindent/README index c06388529f5..dfa09652e65 100644 --- a/Master/texmf-dist/doc/support/latexindent/README +++ b/Master/texmf-dist/doc/support/latexindent/README @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - latexindent.pl, version 3.4.1, 2018-01-18 + latexindent.pl, version 3.4.2, 2018-04-27 PERL script to indent code within environments, and align delimited environments in .tex files. diff --git a/Master/texmf-dist/doc/support/latexindent/appendices.tex b/Master/texmf-dist/doc/support/latexindent/appendices.tex index 7aac0c4856e..ed93148521b 100644 --- a/Master/texmf-dist/doc/support/latexindent/appendices.tex +++ b/Master/texmf-dist/doc/support/latexindent/appendices.tex @@ -1,6 +1,6 @@ % arara: pdflatex: {shell: yes, files: [latexindent]} \appendix - \section{Required \texttt{Perl} modules}\label{sec:requiredmodules} + \section{Required Perl modules}\label{sec:requiredmodules} If you intend to use \texttt{latexindent.pl} and \emph{not} one of the supplied standalone executable files, then you will need a few standard Perl modules -- if you can run the minimum code in \cref{lst:helloworld} (\texttt{perl helloworld.pl}) then you will be able to run \texttt{latexindent.pl}, otherwise you may need to install the missing modules -- see \cref{sec:module-installer,sec:manual-module-instal}. @@ -31,7 +31,7 @@ exit; \end{cmhlistings} \subsection{Module installer script}\label{sec:module-installer} - \announce*{2018-01-13}{perl module helper script} \texttt{latexindent.pl} ships with a helper script that will install any missing \texttt{perl} modules + \announce{2018-01-13}{perl module helper script} \texttt{latexindent.pl} ships with a helper script that will install any missing \texttt{perl} modules on your system; if you run \begin{commandshell} perl latexindent-module-installer.pl @@ -76,7 +76,7 @@ cpanm Log::Dispatch latexindent.exe -t myfile.tex \end{dosprompt} - \section{Updating the \texttt{path} variable}\label{sec:updating-path} + \section{Updating the path variable}\label{sec:updating-path} \texttt{latexindent.pl} has a few scripts (available at \cite{latexindent-home}) that can update the \texttt{path} variables. Thank you to \cite{jasjuang} for this feature. If you're on a Linux or Mac machine, then you'll want \texttt{CMakeLists.txt} from \cite{latexindent-home}. @@ -130,17 +130,17 @@ echo %path% \end{enumerate} To \emph{remove} the directory from your \lstinline!%path%!, run \texttt{remove-from-path.bat} as administrator. - \section{\texttt{logFilePreferences}}\label{app:logfile-demo} + \section{logFilePreferences}\label{app:logfile-demo} \Vref{lst:logFilePreferences} describes the options for customising the information given to the log file, and we provide a few demonstrations here. Let's say that we start with the code given in \cref{lst:simple}, and the settings specified in \cref{lst:logfile-prefs1-yaml}. \begin{minipage}{.35\linewidth} - \cmhlistingsfromfile*{demonstrations/simple.tex}{\texttt{simple.tex}}{lst:simple} + \cmhlistingsfromfile{demonstrations/simple.tex}{\texttt{simple.tex}}{lst:simple} \end{minipage} \hfill \begin{minipage}{.6\linewidth} - \cmhlistingsfromfile*{demonstrations/logfile-prefs1.yaml}[yaml-TCB]{\texttt{logfile-prefs1.yaml}}{lst:logfile-prefs1-yaml} + \cmhlistingsfromfile{demonstrations/logfile-prefs1.yaml}[yaml-TCB]{\texttt{logfile-prefs1.yaml}}{lst:logfile-prefs1-yaml} \end{minipage} If we run the following command (noting that \texttt{-t} is active) diff --git a/Master/texmf-dist/doc/support/latexindent/cmhlistings.tex b/Master/texmf-dist/doc/support/latexindent/cmhlistings.tex new file mode 100644 index 00000000000..b056bd23f79 --- /dev/null +++ b/Master/texmf-dist/doc/support/latexindent/cmhlistings.tex @@ -0,0 +1,21 @@ +\newcommand{\cmhlistingsfromfile}[3]{ +.. literalinclude:: #1^^J +^^I:caption: #2^^J +^^I:name: #3^^J +} +\newcommand{\cmhlistingsfromfilefour}[5]{ +.. literalinclude:: #3^^J +^^I:caption: #4^^J +^^I:name: #5^^J +^^I:lines: #1-#2^^J +^^I:linenos:^^J +^^I:lineno-start: #1^^J +} +\newcommand{\cmhlabel}[1]{ +.. _#1:^^J +} +\newcommand{\warning}[1]{ +.. warning::^^J +#1^^J +.. endwarning::^^J +}{} diff --git a/Master/texmf-dist/doc/support/latexindent/figure-schematic.tex b/Master/texmf-dist/doc/support/latexindent/figure-schematic.tex new file mode 100644 index 00000000000..911f85f6ad7 --- /dev/null +++ b/Master/texmf-dist/doc/support/latexindent/figure-schematic.tex @@ -0,0 +1,33 @@ +\documentclass{standalone} +\usepackage{tikz} +\usetikzlibrary{positioning} +\begin{document} +\begin{tikzpicture}[ + needed/.style={very thick, draw=blue,fill=blue!20, + text centered, minimum height=2.5em,rounded corners=1ex}, + optional/.style={draw=black, very thick,scale=0.8, + text centered, minimum height=2.5em,rounded corners=1ex}, + optionalfill/.style={fill=black!10}, + connections/.style={draw=black!30,dotted,line width=3pt,text=red}, + ] + % Draw diagram elements + \node (latexindent) [needed,circle] {\texttt{latexindent.pl}}; + \node (default) [needed,above right=.5cm of latexindent] {\texttt{defaultSettings.yaml}}; + \node (indentconfig) [optional,right=of latexindent] {\texttt{indentconfig.yaml}}; + \node (any) [optional,optionalfill,above right=of indentconfig] {\texttt{any.yaml}}; + \node (name) [optional,optionalfill,right=of indentconfig] {\texttt{name.yaml}}; + \node (you) [optional,optionalfill,below right=of indentconfig] {\texttt{you.yaml}}; + \node (want) [optional,optionalfill,below=of indentconfig] {\texttt{want.yaml}}; + \node (local) [optional,below=of latexindent] {\texttt{localSettings.yaml}}; + \node (yamlswitch) [optional,left=of latexindent] {\texttt{-y switch}}; + % Draw arrows between elements + \draw[connections,solid] (latexindent) to[in=-90]node[pos=0.5,anchor=north]{1} (default.south) ; + \draw[connections,optional] (latexindent) -- node[pos=0.5,anchor=north]{2} (indentconfig) ; + \draw[connections,optional] (indentconfig) to[in=-90] (any.south) ; + \draw[connections,optional] (indentconfig) -- (name) ; + \draw[connections,optional] (indentconfig) to[out=-45,in=90] (you) ; + \draw[connections,optional] (indentconfig) -- (want) ; + \draw[connections,optional] (latexindent) -- node[pos=0.5,anchor=west]{3} (local) ; + \draw[connections,optional] (latexindent) -- node[pos=0.5,anchor=north]{4} (yamlswitch) ; +\end{tikzpicture} +\end{document} diff --git a/Master/texmf-dist/doc/support/latexindent/latexindent.pdf b/Master/texmf-dist/doc/support/latexindent/latexindent.pdf index a511f2761bc..9cc5c3332f9 100644 Binary files a/Master/texmf-dist/doc/support/latexindent/latexindent.pdf and b/Master/texmf-dist/doc/support/latexindent/latexindent.pdf differ diff --git a/Master/texmf-dist/doc/support/latexindent/latexindent.tex b/Master/texmf-dist/doc/support/latexindent/latexindent.tex index e3ca8eeec86..3462790e824 100644 --- a/Master/texmf-dist/doc/support/latexindent/latexindent.tex +++ b/Master/texmf-dist/doc/support/latexindent/latexindent.tex @@ -39,6 +39,7 @@ \usepackage{longtable} \usepackage{array} \usepackage{totalcount} +\usepackage{standalone} % setup gitinfo2, as in the manual, details just above begin{document} \usepackage[mark,grumpy]{gitinfo2} % tikz, tcolorbox libraries @@ -379,67 +380,67 @@ \lstdefinestyle{commandCodeBlocks}{ style=yaml-LST, - firstnumber=311,linerange={311-321}, + firstnumber=311,linerange={311-325}, numbers=left, } \lstdefinestyle{modifylinebreaks}{ style=yaml-LST, - firstnumber=391,linerange={391-393}, + firstnumber=395,linerange={395-397}, numbers=left, } \lstdefinestyle{textWrapOptions}{ style=yaml-LST, - firstnumber=394,linerange={394-395}, + firstnumber=398,linerange={398-399}, numbers=left, } \lstdefinestyle{textWrapOptionsAll}{ style=yaml-LST, - firstnumber=394,linerange={394-396}, + firstnumber=398,linerange={398-400}, numbers=left, } \lstdefinestyle{removeParagraphLineBreaks}{ style=yaml-LST, - firstnumber=419,linerange={419-431}, + firstnumber=423,linerange={423-435}, numbers=left, } \lstdefinestyle{paragraphsStopAt}{ style=yaml-LST, - firstnumber=432,linerange={432-440}, + firstnumber=436,linerange={436-444}, numbers=left, } \lstdefinestyle{oneSentencePerLine}{ style=yaml-LST, - firstnumber=397,linerange={397-418}, + firstnumber=401,linerange={401-422}, numbers=left, } \lstdefinestyle{sentencesFollow}{ style=yaml-LST, - firstnumber=400,linerange={400-408}, + firstnumber=404,linerange={404-412}, numbers=left, } \lstdefinestyle{sentencesBeginWith}{ style=yaml-LST, - firstnumber=409,linerange={409-412}, + firstnumber=413,linerange={413-416}, numbers=left, } \lstdefinestyle{sentencesEndWith}{ style=yaml-LST, - firstnumber=413,linerange={413-418}, + firstnumber=417,linerange={417-422}, numbers=left, } \lstdefinestyle{modifylinebreaksEnv}{ style=yaml-LST, - firstnumber=441,linerange={441-450}, + firstnumber=445,linerange={445-454}, numbers=left, } @@ -607,6 +608,8 @@ \newcommand{\EndFinishesWithLineBreak}{\color{red}\clubsuit} \newcommand{\ElseStartsOnOwnLine}{\color{red}\bigstar} \newcommand{\ElseFinishesWithLineBreak}{\color{red}\square} +\newcommand{\OrStartsOnOwnLine}{\color{red}\blacktriangle} +\newcommand{\OrFinishesWithLineBreak}{\color{red}\blacktriangledown} \newcommand{\EqualsStartsOnOwnLine}{\color{red}\bullet} % table rules @@ -628,6 +631,10 @@ % git checkout develop % ls .git % and you should see gitHeadInfo.gin +% +% Make sure that the 'V' is included in the below! +% +% RELTAG=$(git describe --tags --long --always --dirty='-*' --match 'V[0-9]*.*' 2>/dev/null) % http://tex.stackexchange.com/questions/233843/textasteriskcentered-invisible-with-garamondmathdesign % remove the definition of \textasteriskcentered for TS1 encoding @@ -752,3 +759,12 @@ Version 3.4 - STDIN allowed: https://github.com/cmhughes/latexindent.pl/issues/88 - textwrap bug fix: https://github.com/cmhughes/latexindent.pl/issues/90 - polyswitch bug fix: https://github.com/cmhughes/latexindent.pl/issues/94 + +Version 3.4.1 +- the reading of defaultSettings.yaml needed addressing +- https://github.com/cmhughes/latexindent.pl/releases/tag/V3.4.1 + +Version 3.4.2 +- enhancements to specialBeginEnd: https://github.com/cmhughes/latexindent.pl/issues/100 +- enhancements to commandCodeBlocks: https://github.com/cmhughes/latexindent.pl/issues/105 +- better support for forrest syntax: https://github.com/cmhughes/latexindent.pl/issues/107 diff --git a/Master/texmf-dist/doc/support/latexindent/sec-conclusions-know-limitations.tex b/Master/texmf-dist/doc/support/latexindent/sec-conclusions-know-limitations.tex index 897e519eddf..db7cfc7059f 100644 --- a/Master/texmf-dist/doc/support/latexindent/sec-conclusions-know-limitations.tex +++ b/Master/texmf-dist/doc/support/latexindent/sec-conclusions-know-limitations.tex @@ -6,11 +6,11 @@ The main limitation is to do with the alignment routine discussed on \cpageref{yaml:lookforaligndelims}; for example, consider the file given in \cref{lst:matrix2}. - \cmhlistingsfromfile*{demonstrations/matrix2.tex}{\texttt{matrix2.tex}}{lst:matrix2} + \cmhlistingsfromfile{demonstrations/matrix2.tex}{\texttt{matrix2.tex}}{lst:matrix2} The default output is given in \cref{lst:matrix2-default}, and it is clear that the alignment routine has not worked as hoped, but it is \emph{expected}. - \cmhlistingsfromfile*{demonstrations/matrix2-default.tex}{\texttt{matrix2.tex} default output}{lst:matrix2-default} + \cmhlistingsfromfile{demonstrations/matrix2-default.tex}{\texttt{matrix2.tex} default output}{lst:matrix2-default} The reason for the problem is that when \texttt{latexindent.pl} stores its code blocks (see \vref{tab:code-blocks}) it uses replacement tokens. The alignment routine is using the \emph{length of the replacement token} in its measuring -- I hope diff --git a/Master/texmf-dist/doc/support/latexindent/sec-default-user-local.tex b/Master/texmf-dist/doc/support/latexindent/sec-default-user-local.tex index d5afdbe0cfb..0f6045189ac 100644 --- a/Master/texmf-dist/doc/support/latexindent/sec-default-user-local.tex +++ b/Master/texmf-dist/doc/support/latexindent/sec-default-user-local.tex @@ -86,10 +86,10 @@ copy myfile.bak4 to myfile.bak3 been loaded, you can see the amalgamated settings in the log file by switching \texttt{showAmalgamatedSettings} to \texttt{1}, if you wish. - \cmhlistingsfromfile*[style=logFilePreferences,]*{../defaultSettings.yaml}[width=.9\linewidth,before=\centering,yaml-TCB]{\texttt{logFilePreferences}}{lst:logFilePreferences} + \cmhlistingsfromfile[style=logFilePreferences,]*{../defaultSettings.yaml}[width=.9\linewidth,before=\centering,yaml-TCB]{\texttt{logFilePreferences}}{lst:logFilePreferences} When% - \announce*{2018-01-13}{showDecorationStartCodeBlockTrace feature for log file} either of the \texttt{trace} modes (see \cpageref{page:traceswitch}) + \announce{2018-01-13}{showDecorationStartCodeBlockTrace feature for log file} either of the \texttt{trace} modes (see \cpageref{page:traceswitch}) are active, you will receive detailed information in \texttt{indent.log}. You can specify character strings to appear before and after the notification of a found code block using, respectively, \texttt{showDecorationStartCodeBlockTrace} and \texttt{showDecorationFinishCodeBlockTrace}. A demonstration is given in \vref{app:logfile-demo}. @@ -99,7 +99,7 @@ copy myfile.bak4 to myfile.bak3 of \texttt{latexindent.pl} to the log file if \texttt{showGitHubInfoFooter} is set to \texttt{1}. \texttt{latexindent.pl}% - \announce*{2018-01-13}{log file pattern layout for log file} uses the \texttt{log4perl} module \cite{log4perl} + \announce{2018-01-13}{log file pattern layout for log file} uses the \texttt{log4perl} module \cite{log4perl} to handle the creation of the logfile. You can specify the layout of the information given in the logfile using any of the \texttt{Log Layouts} detailed at \cite{log4perl}. @@ -254,7 +254,7 @@ lookForAlignDelims: If, for example, you wish to remove the alignment of the \lstinline!\\! within a 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=yaml-LST]*{demonstrations/tabular.yaml}[yaml-TCB]{\texttt{tabular.yaml}}{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 and \texttt{longtable} is basic. When using the advanced form, each field should receive at least 1 sub-field, and \emph{can} @@ -265,17 +265,17 @@ lookForAlignDelims: will not be called for this code block (default: 1); \item \texttt{alignDoubleBackSlash}: binary switch (0 or 1) to determine if \lstinline!\\! should be aligned (default: 1); \item \texttt{spacesBeforeDoubleBackSlash}: optionally,% - \announce*{2018-01-13}*{update to spacesBeforeDoubleBackSlash in ampersand alignment} specifies the number (integer $\geq$ 0) of spaces to be inserted + \announce{2018-01-13}*{update to spacesBeforeDoubleBackSlash in ampersand alignment} specifies the number (integer $\geq$ 0) of spaces to be inserted before \lstinline!\\! (default: 1). \footnote{Previously this only activated if \texttt{alignDoubleBackSlash} was set to \texttt{0}.} \item \announce{2017-06-19}{multiColumnGrouping} \texttt{multiColumnGrouping}: binary switch (0 or 1) that details if \texttt{latexindent.pl} should group columns above and below a \lstinline!\multicolumn! command (default: 0); \item \announce{2017-06-19}{alignRowsWithoutMaxDelims} \texttt{alignRowsWithoutMaxDelims}: binary switch (0 or 1) that details if rows that do not contain the maximum number of delimeters should be formatted so as to have the ampersands aligned (default: 1); - \item \announce*{2018-01-13}{spacesBeforeAmpersand in ampersand alignment}\texttt{spacesBeforeAmpersand}: optionally specifies the number (integer $\geq$ 0) of + \item \announce{2018-01-13}{spacesBeforeAmpersand in ampersand alignment}\texttt{spacesBeforeAmpersand}: optionally specifies the number (integer $\geq$ 0) of spaces to be placed \emph{before} ampersands (default: 1); - \item \announce*{2018-01-13}{spacesAfterAmpersand in ampersand alignment}\texttt{spacesAfterAmpersand}: optionally specifies the number (integer $\geq$ 0) of + \item \announce{2018-01-13}{spacesAfterAmpersand in ampersand alignment}\texttt{spacesAfterAmpersand}: optionally specifies the number (integer $\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} + \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). \end{itemize} @@ -292,23 +292,23 @@ lookForAlignDelims: \end{minipage}% \begin{minipage}{.45\textwidth} - \cmhlistingsfromfile*[style=yaml-LST]*{demonstrations/tabular4.yaml}[yaml-TCB]{\texttt{tabular4.yaml}}{lst:tabular4YAML} + \cmhlistingsfromfile[style=yaml-LST]*{demonstrations/tabular4.yaml}[yaml-TCB]{\texttt{tabular4.yaml}}{lst:tabular4YAML} \end{minipage}% \hfill \begin{minipage}{.48\textwidth} - \cmhlistingsfromfile*[style=yaml-LST]*{demonstrations/tabular5.yaml}[yaml-TCB]{\texttt{tabular5.yaml}}{lst:tabular5YAML} + \cmhlistingsfromfile[style=yaml-LST]*{demonstrations/tabular5.yaml}[yaml-TCB]{\texttt{tabular5.yaml}}{lst:tabular5YAML} \end{minipage}% \begin{minipage}{.45\textwidth} - \cmhlistingsfromfile*[style=yaml-LST]*{demonstrations/tabular6.yaml}[yaml-TCB]{\texttt{tabular6.yaml}}{lst:tabular6YAML} + \cmhlistingsfromfile[style=yaml-LST]*{demonstrations/tabular6.yaml}[yaml-TCB]{\texttt{tabular6.yaml}}{lst:tabular6YAML} \end{minipage}% \hfill \begin{minipage}{.48\textwidth} - \cmhlistingsfromfile*[style=yaml-LST]*{demonstrations/tabular7.yaml}[yaml-TCB]{\texttt{tabular7.yaml}}{lst:tabular7YAML} + \cmhlistingsfromfile[style=yaml-LST]*{demonstrations/tabular7.yaml}[yaml-TCB]{\texttt{tabular7.yaml}}{lst:tabular7YAML} \end{minipage}% \begin{minipage}{.48\textwidth} - \cmhlistingsfromfile*[style=yaml-LST]*{demonstrations/tabular8.yaml}[yaml-TCB]{\texttt{tabular8.yaml}}{lst:tabular8YAML} + \cmhlistingsfromfile[style=yaml-LST]*{demonstrations/tabular8.yaml}[yaml-TCB]{\texttt{tabular8.yaml}}{lst:tabular8YAML} \end{minipage}% On running the commands @@ -325,14 +325,14 @@ latexindent.pl tabular2.tex -l tabular2.yaml,tabular8.yaml we obtain the respective outputs given in \crefrange{lst:tabular2-default}{lst:tabular2-mod8}. \begin{widepage} - \cmhlistingsfromfile*{demonstrations/tabular2-default.tex}{\texttt{tabular2.tex} default output}{lst:tabular2-default} - \cmhlistingsfromfile*{demonstrations/tabular2-mod2.tex}{\texttt{tabular2.tex} using \cref{lst:tabular2YAML}}{lst:tabular2-mod2} - \cmhlistingsfromfile*{demonstrations/tabular2-mod3.tex}{\texttt{tabular2.tex} using \cref{lst:tabular3YAML}}{lst:tabular2-mod3} - \cmhlistingsfromfile*{demonstrations/tabular2-mod4.tex}{\texttt{tabular2.tex} using \cref{lst:tabular2YAML,lst:tabular4YAML}}{lst:tabular2-mod4} - \cmhlistingsfromfile*{demonstrations/tabular2-mod5.tex}{\texttt{tabular2.tex} using \cref{lst:tabular2YAML,lst:tabular5YAML}}{lst:tabular2-mod5} - \cmhlistingsfromfile*{demonstrations/tabular2-mod6.tex}{\texttt{tabular2.tex} using \cref{lst:tabular2YAML,lst:tabular6YAML}}{lst:tabular2-mod6} - \cmhlistingsfromfile*{demonstrations/tabular2-mod7.tex}{\texttt{tabular2.tex} using \cref{lst:tabular2YAML,lst:tabular7YAML}}{lst:tabular2-mod7} - \cmhlistingsfromfile*{demonstrations/tabular2-mod8.tex}{\texttt{tabular2.tex} using \cref{lst:tabular2YAML,lst:tabular8YAML}}{lst:tabular2-mod8} + \cmhlistingsfromfile{demonstrations/tabular2-default.tex}{\texttt{tabular2.tex} default output}{lst:tabular2-default} + \cmhlistingsfromfile{demonstrations/tabular2-mod2.tex}{\texttt{tabular2.tex} using \cref{lst:tabular2YAML}}{lst:tabular2-mod2} + \cmhlistingsfromfile{demonstrations/tabular2-mod3.tex}{\texttt{tabular2.tex} using \cref{lst:tabular3YAML}}{lst:tabular2-mod3} + \cmhlistingsfromfile{demonstrations/tabular2-mod4.tex}{\texttt{tabular2.tex} using \cref{lst:tabular2YAML,lst:tabular4YAML}}{lst:tabular2-mod4} + \cmhlistingsfromfile{demonstrations/tabular2-mod5.tex}{\texttt{tabular2.tex} using \cref{lst:tabular2YAML,lst:tabular5YAML}}{lst:tabular2-mod5} + \cmhlistingsfromfile{demonstrations/tabular2-mod6.tex}{\texttt{tabular2.tex} using \cref{lst:tabular2YAML,lst:tabular6YAML}}{lst:tabular2-mod6} + \cmhlistingsfromfile{demonstrations/tabular2-mod7.tex}{\texttt{tabular2.tex} using \cref{lst:tabular2YAML,lst:tabular7YAML}}{lst:tabular2-mod7} + \cmhlistingsfromfile{demonstrations/tabular2-mod8.tex}{\texttt{tabular2.tex} using \cref{lst:tabular2YAML,lst:tabular8YAML}}{lst:tabular2-mod8} \end{widepage} Notice in particular: @@ -492,6 +492,43 @@ latexindent.pl specialLR.tex -l=specialsLeftRight.yaml,specialBeforeCommand.yaml because \cref{lst:specialBeforeCommand-yaml} specifies that the \texttt{specialBeginEnd} should be sought \emph{before} commands. \end{itemize} + You can,optionally, specify% + \announce*{2018-04-27}{update to specialBeginEnd} the \texttt{middle} field for anything that you + specify in \texttt{specialBeginEnd}. For example, let's consider the \texttt{.tex} file in \cref{lst:special2}. + + \cmhlistingsfromfile*{demonstrations/special2.tex}{\texttt{special2.tex}}{lst:special2} + + Upon saving the YAML settings in \cref{lst:middle-yaml,lst:middle1-yaml} and running the commands + \begin{commandshell} +latexindent.pl special2.tex -l=middle +latexindent.pl special2.tex -l=middle1 + \end{commandshell} + then we obtain the output given in \cref{lst:special2-mod1,lst:special2-mod2}. + + \begin{minipage}{.4\linewidth} + \cmhlistingsfromfile*{demonstrations/middle.yaml}[yaml-TCB]{\texttt{middle.yaml}}{lst:middle-yaml} + \end{minipage} + \hfill + \begin{minipage}{.5\linewidth} + \cmhlistingsfromfile*{demonstrations/special2-mod1.tex}{\texttt{special2.tex} using \cref{lst:middle-yaml}}{lst:special2-mod1} + \end{minipage} + + \begin{minipage}{.4\linewidth} + \cmhlistingsfromfile*{demonstrations/middle1.yaml}[yaml-TCB]{\texttt{middle1.yaml}}{lst:middle1-yaml} + \end{minipage} + \hfill + \begin{minipage}{.5\linewidth} + \cmhlistingsfromfile*{demonstrations/special2-mod2.tex}{\texttt{special2.tex} using \cref{lst:middle1-yaml}}{lst:special2-mod2} + \end{minipage} + + We note that: + \begin{itemize} + \item in \cref{lst:special2-mod1} the bodies of each of the \texttt{Elsif} statements have been indented appropriately; + \item the \texttt{Else} statement has \emph{not} been indented appropriately in \cref{lst:special2-mod1} -- read on! + \item we have specified multiple settings for the \texttt{middle} field using the syntax demonstrated in + \cref{lst:middle1-yaml} so that the body of the \texttt{Else} statement has been indented appropriately in \cref{lst:special2-mod2}. + \end{itemize} + \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} @@ -585,7 +622,7 @@ latexindent.pl mult-nested.tex -l=max-indentation1 In general, when using the \texttt{maximumIndentation} feature, any leading tabs will be replaced by equivalent spaces except, of course, those found in \texttt{verbatimEnvironments} (see \vref{lst:verbatimEnvironments}) or \texttt{noIndentBlock} (see \vref{lst:noIndentBlock}). -\subsection{The code blocks known \texttt{latexindent.pl}}\label{subsubsec:code-blocks} +\subsection{The code blocks known latexindent.pl}\label{subsubsec:code-blocks} As of Version 3.0, \texttt{latexindent.pl} processes documents using code blocks; each of these are shown in \cref{tab:code-blocks}. @@ -620,7 +657,7 @@ mand arg text \\\cmidrule{2-3} commands & \lstinline!+a-zA-Z@\*0-9_\:! & \lstinline!\mycommand!$\langle$\itshape{arguments}$\rangle$ \\\cmidrule{2-3} keyEqualsValuesBracesBrackets & \lstinline!a-zA-Z@\*0-9_\/.\h\{\}:\#-! & \lstinline!my key/.style=!$\langle$\itshape{arguments}$\rangle$ \\\cmidrule{2-3} - namedGroupingBracesBrackets & \lstinline!a-zA-Z@\*> and works outwards}, discussed in more detail on \cpageref{page:phases}. For demonstration, we can compare + \emph{the inner most and works outwards}, discussed in more detail on \cpageref{page:phases}. + + For demonstration, we can compare this output with that given in \cref{lst:ifnextchar-off} in which - the settings from \cref{lst:no-ifnextchar} have dictated that \lstinline!\@ifnextchar[! command should not be searched for specially; + the settings from \cref{lst:no-ifnextchar} have dictated that no special command names, including the \lstinline!\@ifnextchar[! command, should not be searched for specially; as such, the \texttt{parbox} command has been \emph{unable} to indent its body successfully, because the \lstinline!\@ifnextchar[! command has not been found. @@ -170,5 +230,12 @@ latexindent.pl tikz-node1.tex -l no-to.yaml \end{minipage} \hfill \begin{minipage}{.45\textwidth} - \cmhlistingsfromfile[style=yaml-LST]*{demonstrations/no-ifnextchar.yaml}[yaml-TCB]{\texttt{no-ifnextchar.yaml}}{lst:no-ifnextchar} + \cmhlistingsfromfile*[style=yaml-LST]*{demonstrations/no-ifnextchar.yaml}[yaml-TCB]{\texttt{no-ifnextchar.yaml}}{lst:no-ifnextchar} \end{minipage} + + The \texttt{amalgamate} field can be used for \texttt{commandNameSpecial}, just as for \texttt{stringsAllowedBetweenArguments}. The + same condition holds as stated previously, which we state again here: + \begin{warning} + It is important to note that the \texttt{amalgamate} field, if used, in either \texttt{commandNameSpecial} or \texttt{stringsAllowedBetweenArguments} must be in the first field, + and specified using the syntax given in \cref{lst:amalgamate-demo1,lst:amalgamate-demo2,lst:amalgamate-demo3}. + \end{warning} diff --git a/Master/texmf-dist/doc/support/latexindent/subsec-noAdditionalIndent-indentRules.tex b/Master/texmf-dist/doc/support/latexindent/subsec-noAdditionalIndent-indentRules.tex index e0a20542877..b715abfae17 100644 --- a/Master/texmf-dist/doc/support/latexindent/subsec-noAdditionalIndent-indentRules.tex +++ b/Master/texmf-dist/doc/support/latexindent/subsec-noAdditionalIndent-indentRules.tex @@ -1,6 +1,6 @@ % arara: pdflatex: {shell: yes, files: [latexindent]} % arara: pdflatex: {shell: yes, files: [latexindent]} -\subsection{\texttt{noAdditionalIndent} and \texttt{indentRules}}\label{sec:noadd-indent-rules} +\subsection{noAdditionalIndent and indentRules}\label{sec:noadd-indent-rules} \texttt{latexindent.pl} operates on files by looking for code blocks, as detailed in \vref{subsubsec:code-blocks}; for each type of code block in \vref{tab:code-blocks} (which we will call a \emph{$\langle$thing$\rangle$} in what follows) it searches YAML fields for information in the following order: diff --git a/Master/texmf-dist/doc/support/latexindent/subsec-partnering-poly-switches.tex b/Master/texmf-dist/doc/support/latexindent/subsec-partnering-poly-switches.tex index 9a788acbd27..2741dbcac12 100644 --- a/Master/texmf-dist/doc/support/latexindent/subsec-partnering-poly-switches.tex +++ b/Master/texmf-dist/doc/support/latexindent/subsec-partnering-poly-switches.tex @@ -1,5 +1,5 @@ % arara: pdflatex: {shell: yes, files: [latexindent]} -\subsection{Partnering \texttt{BodyStartsOnOwnLine} with argument-based poly-switches} +\subsection{Partnering BodyStartsOnOwnLine with argument-based poly-switches} Some poly-switches need to be partnered together; in particular, when line breaks involving the \emph{first} argument of a code block need to be accounted for using both \texttt{BodyStartsOnOwnLine} (or its equivalent, see \vref{tab:poly-switch-mapping}) and \texttt{LCuBStartsOnOwnLine} for mandatory arguments, and \texttt{LSqBStartsOnOwnLine} for optional arguments. 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 65e63c2b67f..09b08ed1fdf 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 @@ -26,7 +26,7 @@ latexindent.pl myenv.tex -l myenv-noAdd2.yaml 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} + \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 \begin{commandshell} @@ -103,7 +103,7 @@ latexindent.pl myenv.tex -l myenv-rules2.yaml 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}. - \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} + \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} If you specify a field in \texttt{indentRules} using anything other than horizontal space, it will be ignored. diff --git a/Master/texmf-dist/doc/support/latexindent/subsubsec-headings.tex b/Master/texmf-dist/doc/support/latexindent/subsubsec-headings.tex index cc4546c6de5..65a01eaaa91 100644 --- a/Master/texmf-dist/doc/support/latexindent/subsubsec-headings.tex +++ b/Master/texmf-dist/doc/support/latexindent/subsubsec-headings.tex @@ -1,5 +1,5 @@ % arara: pdflatex: {shell: yes, files: [latexindent]} -\subsubsection{\texttt{afterHeading} code blocks}\label{subsubsec-headings-no-add-indent-rules} +\subsubsection{afterHeading code blocks}\label{subsubsec-headings-no-add-indent-rules} Let's use the example \cref{lst:headings2} for demonstration throughout this \namecref{subsubsec-headings-no-add-indent-rules}. As discussed on \cpageref{lst:headings1}, by default \texttt{latexindent.pl} will not add indentation after headings. diff --git a/Master/texmf-dist/doc/support/latexindent/subsubsec-ifelsefi.tex b/Master/texmf-dist/doc/support/latexindent/subsubsec-ifelsefi.tex index 0ebb68691f1..f105498ca24 100644 --- a/Master/texmf-dist/doc/support/latexindent/subsubsec-ifelsefi.tex +++ b/Master/texmf-dist/doc/support/latexindent/subsubsec-ifelsefi.tex @@ -68,3 +68,16 @@ latexindent.pl ifelsefi1.tex -l ifelsefi-indent-rules-global.yaml \begin{minipage}{.45\textwidth} \cmhlistingsfromfile[showspaces=true]{demonstrations/ifelsefi1-indent-rules-global.tex}{\texttt{ifelsefi1.tex} using \cref{lst:ifelsefi-indent-rules-global}}{lst:ifelsefi1-output-indent-rules-global} \end{minipage} + + We can further explore the treatment of \texttt{ifElseFi} code blocks% + \announce*{2018-04-27}*{updates to ifElseFi code blocks} in \cref{lst:ifelsefi2}, + and the associated default output given in \cref{lst:ifelsefi2-default}; note, in particular, that the bodies of each of the `or statements' + have been indented. + + \begin{minipage}{.45\textwidth} + \cmhlistingsfromfile*{demonstrations/ifelsefi2.tex}{\texttt{ifelsefi2.tex}}{lst:ifelsefi2} + \end{minipage}% + \hfill + \begin{minipage}{.54\textwidth} + \cmhlistingsfromfile*{demonstrations/ifelsefi2-default.tex}{\texttt{ifelsefi2.tex} default output}{lst:ifelsefi2-default} + \end{minipage} diff --git a/Master/texmf-dist/doc/support/latexindent/subsubsec-no-add-remaining-code-blocks.tex b/Master/texmf-dist/doc/support/latexindent/subsubsec-no-add-remaining-code-blocks.tex index c8caf89b94e..c69685d36d7 100644 --- a/Master/texmf-dist/doc/support/latexindent/subsubsec-no-add-remaining-code-blocks.tex +++ b/Master/texmf-dist/doc/support/latexindent/subsubsec-no-add-remaining-code-blocks.tex @@ -5,7 +5,7 @@ covered comprehensively in \vref{subsubsec:commands-arguments}, but a small discussion defining these remaining code blocks is necessary. - \paragraph{\texttt{keyEqualsValuesBracesBrackets}} + \paragraph{keyEqualsValuesBracesBrackets} \texttt{latexindent.pl} defines this type of code block by the following criteria: \begin{itemize} \item it must immediately follow either \lstinline!{! OR \lstinline![! OR \lstinline!,! with comments @@ -33,7 +33,7 @@ key that include its arguments. This is the part controlled by the \emph{body} field for \texttt{noAdditionalIndent} and friends from \cpageref{sec:noadd-indent-rules}. \end{itemize} - \paragraph{\texttt{namedGroupingBracesBrackets}} + \paragraph{namedGroupingBracesBrackets} This type of code block is mostly motivated by tikz-based code; we define this code block as follows: \begin{itemize} \item it must immediately follow either \emph{horizontal space} OR \emph{one or more line breaks} OR \lstinline!{! OR \lstinline![! @@ -62,7 +62,7 @@ and friends from \cpageref{sec:noadd-indent-rules}. \end{itemize} - \paragraph{\texttt{UnNamedGroupingBracesBrackets}} occur in a variety of situations; specifically, we define + \paragraph{UnNamedGroupingBracesBrackets} occur in a variety of situations; specifically, we define this type of code block as satisfying the following criteria: \begin{itemize} \item it must immediately follow either \lstinline!{! OR \lstinline![! OR \lstinline!,! OR \lstinline!&! OR \lstinline!)! OR \lstinline!(! @@ -92,7 +92,7 @@ Users wishing to customise the mandatory and/or optional arguments on a \emph{per-name} basis for the \texttt{UnNamedGroupingBracesBrackets} should use \texttt{always-un-named}. - \paragraph{\texttt{filecontents}} code blocks behave just as \texttt{environments}, except that neither arguments nor items are sought. + \paragraph{filecontents} code blocks behave just as \texttt{environments}, except that neither arguments nor items are sought. \subsubsection{Summary} Having considered all of the different types of code blocks, the functions of the fields given in diff --git a/Master/texmf-dist/doc/support/latexindent/subsubsec-special.tex b/Master/texmf-dist/doc/support/latexindent/subsubsec-special.tex index d6d0c35d9f1..0ec7d78c38a 100644 --- a/Master/texmf-dist/doc/support/latexindent/subsubsec-special.tex +++ b/Master/texmf-dist/doc/support/latexindent/subsubsec-special.tex @@ -1,5 +1,5 @@ % arara: pdflatex: {shell: yes, files: [latexindent]} -\subsubsection{\texttt{specialBeginEnd} code blocks} +\subsubsection{specialBeginEnd code blocks} Let's use the example from \vref{lst:specialbefore} which has default output shown in \vref{lst:specialafter}. diff --git a/Master/texmf-dist/doc/support/latexindent/title.tex b/Master/texmf-dist/doc/support/latexindent/title.tex index d78cc7f54dc..fec997546f6 100644 --- a/Master/texmf-dist/doc/support/latexindent/title.tex +++ b/Master/texmf-dist/doc/support/latexindent/title.tex @@ -8,7 +8,7 @@ sharp corners, enhanced, overlay={\node[anchor=north east,outer sep=2pt] at ([xshift=3cm,yshift=4mm]frame.north east) {\includegraphics[width=3cm]{logo}}; }] - \centering\ttfamily\bfseries latexindent.pl\\[1cm] Version 3.4.1 + \centering\ttfamily\bfseries latexindent.pl\\[1cm] Version 3.4.2 \end{tcolorbox} } \author{Chris Hughes \thanks{and contributors! -- cgit v1.2.3