summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/latexindent/latexindent.pl2
-rwxr-xr-xMaster/bin/win32/latexindent.exebin11453858 -> 11455448 bytes
-rw-r--r--Master/texmf-dist/doc/support/latexindent/README2
-rw-r--r--Master/texmf-dist/doc/support/latexindent/appendices.tex12
-rw-r--r--Master/texmf-dist/doc/support/latexindent/cmhlistings.tex21
-rw-r--r--Master/texmf-dist/doc/support/latexindent/figure-schematic.tex33
-rw-r--r--Master/texmf-dist/doc/support/latexindent/latexindent.pdfbin690275 -> 690820 bytes
-rw-r--r--Master/texmf-dist/doc/support/latexindent/latexindent.tex38
-rw-r--r--Master/texmf-dist/doc/support/latexindent/sec-conclusions-know-limitations.tex4
-rw-r--r--Master/texmf-dist/doc/support/latexindent/sec-default-user-local.tex83
-rw-r--r--Master/texmf-dist/doc/support/latexindent/sec-how-to-use.tex10
-rw-r--r--Master/texmf-dist/doc/support/latexindent/sec-indent-config-and-settings.tex37
-rw-r--r--Master/texmf-dist/doc/support/latexindent/sec-introduction.tex2
-rw-r--r--Master/texmf-dist/doc/support/latexindent/sec-the-m-switch.tex306
-rw-r--r--Master/texmf-dist/doc/support/latexindent/subsec-commands-and-their-options.tex95
-rw-r--r--Master/texmf-dist/doc/support/latexindent/subsec-noAdditionalIndent-indentRules.tex2
-rw-r--r--Master/texmf-dist/doc/support/latexindent/subsec-partnering-poly-switches.tex2
-rw-r--r--Master/texmf-dist/doc/support/latexindent/subsubsec-environments-and-their-arguments.tex4
-rw-r--r--Master/texmf-dist/doc/support/latexindent/subsubsec-headings.tex2
-rw-r--r--Master/texmf-dist/doc/support/latexindent/subsubsec-ifelsefi.tex13
-rw-r--r--Master/texmf-dist/doc/support/latexindent/subsubsec-no-add-remaining-code-blocks.tex8
-rw-r--r--Master/texmf-dist/doc/support/latexindent/subsubsec-special.tex2
-rw-r--r--Master/texmf-dist/doc/support/latexindent/title.tex2
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/Arguments.pm17
-rwxr-xr-xMaster/texmf-dist/scripts/latexindent/LatexIndent/Command.pm23
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/Else.pm99
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/FileContents.pm2
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm27
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/HiddenChildren.pm82
-rwxr-xr-xMaster/texmf-dist/scripts/latexindent/LatexIndent/IfElseFi.pm44
-rwxr-xr-xMaster/texmf-dist/scripts/latexindent/LatexIndent/NamedGroupingBracesBrackets.pm2
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/Special.pm67
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm4
-rwxr-xr-xMaster/texmf-dist/scripts/latexindent/defaultSettings.yaml24
-rwxr-xr-xMaster/texmf-dist/scripts/latexindent/latexindent.pl2
35 files changed, 649 insertions, 424 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/latexindent/latexindent.pl b/Build/source/texk/texlive/linked_scripts/latexindent/latexindent.pl
index 97f8269ab88..b49b2a009cc 100755
--- a/Build/source/texk/texlive/linked_scripts/latexindent/latexindent.pl
+++ b/Build/source/texk/texlive/linked_scripts/latexindent/latexindent.pl
@@ -1,5 +1,5 @@
#!/usr/bin/env perl
-# latexindent.pl, version 3.4.1, 2018-01-18
+# latexindent.pl, version 3.4.2, 2018-04-27
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/Master/bin/win32/latexindent.exe b/Master/bin/win32/latexindent.exe
index 8192d2bf5d0..6df981cb13d 100755
--- a/Master/bin/win32/latexindent.exe
+++ b/Master/bin/win32/latexindent.exe
Binary files differ
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
--- a/Master/texmf-dist/doc/support/latexindent/latexindent.pdf
+++ b/Master/texmf-dist/doc/support/latexindent/latexindent.pdf
Binary files 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@\*><! & \lstinline!in!$\langle$\itshape{arguments}$\rangle$ \\\cmidrule{2-3}
+ namedGroupingBracesBrackets & \lstinline!0-9\.a-zA-Z@\*><! & \lstinline!in!$\langle$\itshape{arguments}$\rangle$ \\\cmidrule{2-3}
UnNamedGroupingBracesBrackets & \centering\emph{No name!} & \lstinline!{! or \lstinline![! or \lstinline!,! or \lstinline!&! or \lstinline!)! or \lstinline!(! or \lstinline!$! followed by $\langle$\itshape{arguments}$\rangle$ \\\cmidrule{2-3}
ifElseFi & \lstinline!@a-zA-Z! but must begin with either \newline \lstinline!\if! of \lstinline!\@if! &
\begin{lstlisting}[,nolol=true,]
diff --git a/Master/texmf-dist/doc/support/latexindent/sec-how-to-use.tex b/Master/texmf-dist/doc/support/latexindent/sec-how-to-use.tex
index abb3b737f5f..77e85e16af8 100644
--- a/Master/texmf-dist/doc/support/latexindent/sec-how-to-use.tex
+++ b/Master/texmf-dist/doc/support/latexindent/sec-how-to-use.tex
@@ -20,7 +20,7 @@
users, so that you can use the script with or without a Perl distribution.
If you plan to use \texttt{latexindent.pl} (i.e, the original Perl script) then you will
need a few standard Perl modules -- see \vref{sec:requiredmodules} for details;
- \announce*{2018-01-13}{perl module installer helper script} in particular, note
+ \announce{2018-01-13}{perl module installer helper script} in particular, note
that a module installer helper script is shipped with \texttt{latexindent.pl}.
\subsection{From the command line}\label{sec:commandline}
@@ -290,7 +290,7 @@ latexindent.pl -sl myfile.tex
latexindent.pl -screenlog myfile.tex
\end{commandshell}
Using this%
- \announce*{2018-01-13}{screenlog switch created} option tells \texttt{latexindent.pl} to output the log file to the screen, as well
+ \announce{2018-01-13}{screenlog switch created} option tells \texttt{latexindent.pl} to output the log file to the screen, as well
as to your chosen log file.
\flagbox{-m, --modifylinebreaks}
@@ -315,12 +315,12 @@ latexindent.pl myfile
cat myfile.tex | latexindent.pl
\end{commandshell}
\texttt{latexindent.pl} will%
- \announce*{2018-01-13}{STDIN allowed} allow input from STDIN, which means that you can pipe output from
+ \announce{2018-01-13}{STDIN allowed} allow input from STDIN, which means that you can pipe output from
other commands directly into the script. For example assuming that you have content in \texttt{myfile.tex}, then the above
command will output the results of operating upon \texttt{myfile.tex}
Similarly, if you%
- \announce*{2018-01-13}*{no options/filename updated} simply type \texttt{latexindent.pl}
+ \announce{2018-01-13}*{no options/filename updated} simply type \texttt{latexindent.pl}
at the command line, then it will expect (STDIN) input from the command line.
\begin{commandshell}
latexindent.pl
@@ -333,7 +333,7 @@ latexindent.pl
\end{itemize}
to signify that your input has finished.
-\subsection{From \texttt{arara}}\label{sec:arara}
+\subsection{From arara}\label{sec:arara}
Using \texttt{latexindent.pl} from the command line is fine for some folks, but
others may find it easier to use from \texttt{arara}; you can find the arara rule at \cite{paulo}.
diff --git a/Master/texmf-dist/doc/support/latexindent/sec-indent-config-and-settings.tex b/Master/texmf-dist/doc/support/latexindent/sec-indent-config-and-settings.tex
index d3f68e4f27c..db5f61621ee 100644
--- a/Master/texmf-dist/doc/support/latexindent/sec-indent-config-and-settings.tex
+++ b/Master/texmf-dist/doc/support/latexindent/sec-indent-config-and-settings.tex
@@ -1,11 +1,11 @@
% arara: pdflatex: {shell: yes, files: [latexindent]}
-\section{\texttt{indentconfig.yaml}, local settings and the \texttt{-y} switch }\label{sec:indentconfig}
+\section{indentconfig.yaml, local settings and the -y switch }\label{sec:indentconfig}
The behaviour of \texttt{latexindent.pl} is controlled from the settings specified
in any of the YAML files that you tell it to load. By default, \texttt{latexindent.pl}
will only load \texttt{defaultSettings.yaml}, but there are a few ways that you can
tell it to load your own settings files.
-\subsection{\texttt{indentconfig.yaml} and \texttt{{.indentconfig.yaml}}}
+\subsection{indentconfig.yaml and .indentconfig.yaml}
\texttt{latexindent.pl} will always check your home directory for \texttt{indentconfig.yaml}
and \texttt{.indentconfig.yaml} (unless
it is called with the \texttt{-d} switch),
@@ -80,7 +80,7 @@ lookForAlignDelims:
will tell you so in \texttt{indent.log}.
\end{warning}
-\subsection{\texttt{localSettings.yaml}}\label{sec:localsettings}
+\subsection{localSettings.yaml}\label{sec:localsettings}
The \texttt{-l} switch tells \texttt{latexindent.pl} to look for \texttt{localSettings.yaml} in the
\emph{same directory} as \texttt{myfile.tex}. For example, if you use the following command
\begin{commandshell}
@@ -114,7 +114,7 @@ verbatimEnvironments:
for details; if it can not be read then you receive a warning, otherwise you'll get confirmation that
\texttt{latexindent.pl} has read your settings file.
-\subsection{The \texttt{-y|yaml} switch}\label{sec:yamlswitch}
+\subsection{The -y|yaml switch}\label{sec:yamlswitch}
You%
\announce{2017-08-21}{demonstration of the -y switch} may use the \texttt{-y} switch to load
your settings; for example, if you wished to specify the settings from \cref{lst:localSettings}
@@ -152,34 +152,7 @@ latexindent.pl -l=mysettings.yaml -y="verbatimEnvironments:cmhenvironment:0;myen
\begin{figure}[!htb]
\centering
- \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}
+ \input{figure-schematic}
\caption{Schematic of the load order described in \cref{sec:loadorder}; solid lines represent
mandatory files, dotted lines represent optional files. \texttt{indentconfig.yaml} can
contain as many files as you like. The files will be loaded in order; if you specify
diff --git a/Master/texmf-dist/doc/support/latexindent/sec-introduction.tex b/Master/texmf-dist/doc/support/latexindent/sec-introduction.tex
index 0e2ba9aac06..453851d7383 100644
--- a/Master/texmf-dist/doc/support/latexindent/sec-introduction.tex
+++ b/Master/texmf-dist/doc/support/latexindent/sec-introduction.tex
@@ -85,6 +85,7 @@
for more details.
\end{minipage}%
+ % \begin{latexonly}
You will occasionally see dates shown in the margin (for example, next to this paragraph!)
\announce{2017-06-25}{announce} which detail the date of the version in which the feature was implemented;
the `N' stands for `new as of the date shown' and `U' stands for `updated as of the date shown'.
@@ -94,6 +95,7 @@
not read this document before (and even if you have!), then you can ignore every occurrence of the \stardemo;
they are simply there to highlight new and updated features.
The new and updated features in this documentation (\gitRel) are on the following pages: \listOfNewFeatures
+ % \end{latexonly}
\subsection{Quick start}\label{sec:quickstart}
If you'd like to get started with \texttt{latexindent.pl} then simply type
diff --git a/Master/texmf-dist/doc/support/latexindent/sec-the-m-switch.tex b/Master/texmf-dist/doc/support/latexindent/sec-the-m-switch.tex
index 8e7f1a243f4..2b10438eb09 100644
--- a/Master/texmf-dist/doc/support/latexindent/sec-the-m-switch.tex
+++ b/Master/texmf-dist/doc/support/latexindent/sec-the-m-switch.tex
@@ -3,7 +3,7 @@
\tikz[remember picture,overlay] {
\node at (1,0){\includegraphics{logo}};
}}
-\section{The \texttt{-m} (\texttt{modifylinebreaks}) switch}\label{sec:modifylinebreaks}
+\section{The -m (modifylinebreaks) switch}\label{sec:modifylinebreaks}
All features described in this section will only be relevant if the \texttt{-m} switch
is used.
@@ -41,7 +41,7 @@
blank lines can be condensed if \texttt{condenseMultipleBlankLinesInto} is
greater than \texttt{0}, discussed next.
-\yamltitle{condenseMultipleBlankLinesInto}*{integer $\geq 0$}
+\yamltitle{condenseMultipleBlankLinesInto}*{positive integer}
Assuming that this switch takes an integer value greater than \texttt{0}, \texttt{latexindent.pl} will condense multiple blank lines into
the number of blank lines illustrated by this switch. As an example, \cref{lst:mlb-bl} shows a sample file
with blank lines; upon running
@@ -141,22 +141,22 @@ latexindent.pl -m textwrap4.tex -o textwrap4-mod2.tex -l textwrap2.yaml
\cmhlistingsfromfile{demonstrations/textwrap2.yaml}[MLB-TCB]{\texttt{textwrap2.yaml}}{lst:textwrap2-yaml}
\end{minipage}
- \paragraph{Summary of text wrapping}
- It is important to note the following:
- \begin{itemize}
- \item Verbatim environments (\vref{lst:verbatimEnvironments}) and verbatim commands (\vref{lst:verbatimCommands}) will \emph{not} be affected by the text wrapping routine (see \vref{lst:textwrap2-mod1});
- \item comments will \emph{not} be affected by the text wrapping routine (see \vref{lst:textwrap3-mod1});
- \item indentation is performed \emph{after} the text wrapping routine; as such, indented code
- will likely exceed any maximum value set in the \texttt{columns} field.
- \end{itemize}
+ \textbf{Summary of text wrapping}
+ It is important to note the following:
+ \begin{itemize}
+ \item Verbatim environments (\vref{lst:verbatimEnvironments}) and verbatim commands (\vref{lst:verbatimCommands}) will \emph{not} be affected by the text wrapping routine (see \vref{lst:textwrap2-mod1});
+ \item comments will \emph{not} be affected by the text wrapping routine (see \vref{lst:textwrap3-mod1});
+ \item indentation is performed \emph{after} the text wrapping routine; as such, indented code
+ will likely exceed any maximum value set in the \texttt{columns} field.
+ \end{itemize}
-\subsection{\texttt{oneSentencePerLine}: modifying line breaks for sentences}\label{sec:onesentenceperline}
+\subsection{oneSentencePerLine: modifying line breaks for sentences}\label{sec:onesentenceperline}
You can instruct \texttt{latexindent.pl} to format%
- \announce*{2018-01-13}{one sentence per line} your file so that it puts one sentence
+ \announce{2018-01-13}{one sentence per line} your file so that it puts one sentence
per line. Thank you to \cite{mlep} for helping to shape and test this feature. The behaviour of this part of the script is controlled by the switches detailed in \cref{lst:oneSentencePerLine},
all of which we discuss next.
- \cmhlistingsfromfile*[style=oneSentencePerLine]*{../defaultSettings.yaml}[MLB-TCB,width=.85\linewidth,before=\centering]{\texttt{oneSentencePerLine}}{lst:oneSentencePerLine}
+ \cmhlistingsfromfile[style=oneSentencePerLine]*{../defaultSettings.yaml}[MLB-TCB,width=.85\linewidth,before=\centering]{\texttt{oneSentencePerLine}}{lst:oneSentencePerLine}
\yamltitle{manipulateSentences}{0|1}
This is a binary switch that details if \texttt{latexindent.pl} should perform the sentence manipulation routine; it
@@ -169,7 +169,7 @@ latexindent.pl -m textwrap4.tex -o textwrap4-mod2.tex -l textwrap2.yaml
For example, consider \texttt{multiple-sentences.tex} shown in \cref{lst:multiple-sentences}.
- \cmhlistingsfromfile*{demonstrations/multiple-sentences.tex}{\texttt{multiple-sentences.tex}}{lst:multiple-sentences}
+ \cmhlistingsfromfile{demonstrations/multiple-sentences.tex}{\texttt{multiple-sentences.tex}}{lst:multiple-sentences}
If we use the YAML files in \cref{lst:manipulate-sentences-yaml,lst:keep-sen-line-breaks-yaml}, and run the commands
\begin{widepage}
@@ -181,19 +181,19 @@ latexindent.pl multiple-sentences -m -l=keep-sen-line-breaks.yaml
then we obtain the respective output given in \cref{lst:multiple-sentences-mod1,lst:multiple-sentences-mod2}.
\begin{minipage}{.5\linewidth}
- \cmhlistingsfromfile*{demonstrations/multiple-sentences-mod1.tex}{\texttt{multiple-sentences.tex} using \cref{lst:manipulate-sentences-yaml}}{lst:multiple-sentences-mod1}
+ \cmhlistingsfromfile{demonstrations/multiple-sentences-mod1.tex}{\texttt{multiple-sentences.tex} using \cref{lst:manipulate-sentences-yaml}}{lst:multiple-sentences-mod1}
\end{minipage}
\hfill
\begin{minipage}{.5\linewidth}
- \cmhlistingsfromfile*[style=yaml-LST]*{demonstrations/manipulate-sentences.yaml}[MLB-TCB]{\texttt{manipulate-sentences.yaml}}{lst:manipulate-sentences-yaml}
+ \cmhlistingsfromfile[style=yaml-LST]*{demonstrations/manipulate-sentences.yaml}[MLB-TCB]{\texttt{manipulate-sentences.yaml}}{lst:manipulate-sentences-yaml}
\end{minipage}
\begin{minipage}{.5\linewidth}
- \cmhlistingsfromfile*{demonstrations/multiple-sentences-mod2.tex}{\texttt{multiple-sentences.tex} using \cref{lst:keep-sen-line-breaks-yaml}}{lst:multiple-sentences-mod2}
+ \cmhlistingsfromfile{demonstrations/multiple-sentences-mod2.tex}{\texttt{multiple-sentences.tex} using \cref{lst:keep-sen-line-breaks-yaml}}{lst:multiple-sentences-mod2}
\end{minipage}
\hfill
\begin{minipage}{.5\linewidth}
- \cmhlistingsfromfile*[style=yaml-LST]*{demonstrations/keep-sen-line-breaks.yaml}[MLB-TCB]{\texttt{keep-sen-line-breaks.yaml}}{lst:keep-sen-line-breaks-yaml}
+ \cmhlistingsfromfile[style=yaml-LST]*{demonstrations/keep-sen-line-breaks.yaml}[MLB-TCB]{\texttt{keep-sen-line-breaks.yaml}}{lst:keep-sen-line-breaks-yaml}
\end{minipage}
Notice, in particular, that the `internal' sentence line breaks in \cref{lst:multiple-sentences} have
@@ -214,19 +214,19 @@ latexindent.pl multiple-sentences -m -l=keep-sen-line-breaks.yaml
\begin{adjustwidth}{-3.5cm}{-2.5cm}
\begin{minipage}{.36\linewidth}
- \cmhlistingsfromfile*[style=sentencesFollow]*{../defaultSettings.yaml}[MLB-TCB,width=.9\linewidth,before=\centering]{\texttt{sentencesFollow}}{lst:sentencesFollow}
+ \cmhlistingsfromfile[style=sentencesFollow]*{../defaultSettings.yaml}[MLB-TCB,width=.9\linewidth,before=\centering]{\texttt{sentencesFollow}}{lst:sentencesFollow}
\end{minipage}
\hfill
\begin{minipage}{.31\linewidth}
- \cmhlistingsfromfile*[style=sentencesBeginWith]*{../defaultSettings.yaml}[MLB-TCB,width=.9\linewidth,before=\centering]{\texttt{sentencesBeginWith}}{lst:sentencesBeginWith}
+ \cmhlistingsfromfile[style=sentencesBeginWith]*{../defaultSettings.yaml}[MLB-TCB,width=.9\linewidth,before=\centering]{\texttt{sentencesBeginWith}}{lst:sentencesBeginWith}
\end{minipage}
\hfill
\begin{minipage}{.31\linewidth}
- \cmhlistingsfromfile*[style=sentencesEndWith]*{../defaultSettings.yaml}[MLB-TCB,width=.9\linewidth,before=\centering]{\texttt{sentencesEndWith}}{lst:sentencesEndWith}
+ \cmhlistingsfromfile[style=sentencesEndWith]*{../defaultSettings.yaml}[MLB-TCB,width=.9\linewidth,before=\centering]{\texttt{sentencesEndWith}}{lst:sentencesEndWith}
\end{minipage}
\end{adjustwidth}
-\subsubsection{\texttt{sentencesFollow}}
+\subsubsection{sentencesFollow}
Let's explore a few of the switches in \texttt{sentencesFollow}; let's start with \vref{lst:multiple-sentences}, and use the YAML
settings given in \cref{lst:sentences-follow1-yaml}. Using the command
\begin{commandshell}
@@ -235,11 +235,11 @@ latexindent.pl multiple-sentences -m -l=sentences-follow1.yaml
we obtain the output given in \cref{lst:multiple-sentences-mod3}.
\begin{minipage}{.5\linewidth}
- \cmhlistingsfromfile*{demonstrations/multiple-sentences-mod3.tex}{\texttt{multiple-sentences.tex} using \cref{lst:sentences-follow1-yaml}}{lst:multiple-sentences-mod3}
+ \cmhlistingsfromfile{demonstrations/multiple-sentences-mod3.tex}{\texttt{multiple-sentences.tex} using \cref{lst:sentences-follow1-yaml}}{lst:multiple-sentences-mod3}
\end{minipage}
\hfill
\begin{minipage}{.5\linewidth}
- \cmhlistingsfromfile*[style=yaml-LST]*{demonstrations/sentences-follow1.yaml}[MLB-TCB]{\texttt{sentences-follow1.yaml}}{lst:sentences-follow1-yaml}
+ \cmhlistingsfromfile[style=yaml-LST]*{demonstrations/sentences-follow1.yaml}[MLB-TCB]{\texttt{sentences-follow1.yaml}}{lst:sentences-follow1-yaml}
\end{minipage}
Notice that, because \texttt{blankLine} is set to \texttt{0}, \texttt{latexindent.pl} will not seek sentences following a blank line,
@@ -247,7 +247,7 @@ latexindent.pl multiple-sentences -m -l=sentences-follow1.yaml
We can explore the \texttt{other} field in \cref{lst:sentencesFollow} with the \texttt{.tex} file detailed in \cref{lst:multiple-sentences1}.
- \cmhlistingsfromfile*{demonstrations/multiple-sentences1.tex}{\texttt{multiple-sentences1.tex}}{lst:multiple-sentences1}
+ \cmhlistingsfromfile{demonstrations/multiple-sentences1.tex}{\texttt{multiple-sentences1.tex}}{lst:multiple-sentences1}
Upon running the following commands
\begin{widepage}
@@ -257,26 +257,26 @@ latexindent.pl multiple-sentences1 -m -l=manipulate-sentences.yaml,sentences-fol
\end{commandshell}
\end{widepage}
then we obtain the respective output given in \cref{lst:multiple-sentences1-mod1,lst:multiple-sentences1-mod2}.
- \cmhlistingsfromfile*{demonstrations/multiple-sentences1-mod1.tex}{\texttt{multiple-sentences1.tex} using \vref{lst:manipulate-sentences-yaml}}{lst:multiple-sentences1-mod1}
+ \cmhlistingsfromfile{demonstrations/multiple-sentences1-mod1.tex}{\texttt{multiple-sentences1.tex} using \vref{lst:manipulate-sentences-yaml}}{lst:multiple-sentences1-mod1}
\begin{minipage}{.55\linewidth}
- \cmhlistingsfromfile*{demonstrations/multiple-sentences1-mod2.tex}{\texttt{multiple-sentences1.tex} using \cref{lst:sentences-follow2-yaml}}{lst:multiple-sentences1-mod2}
+ \cmhlistingsfromfile{demonstrations/multiple-sentences1-mod2.tex}{\texttt{multiple-sentences1.tex} using \cref{lst:sentences-follow2-yaml}}{lst:multiple-sentences1-mod2}
\end{minipage}
\hfill
\begin{minipage}{.45\linewidth}
- \cmhlistingsfromfile*[style=yaml-LST]*{demonstrations/sentences-follow2.yaml}[MLB-TCB]{\texttt{sentences-follow2.yaml}}{lst:sentences-follow2-yaml}
+ \cmhlistingsfromfile[style=yaml-LST]*{demonstrations/sentences-follow2.yaml}[MLB-TCB]{\texttt{sentences-follow2.yaml}}{lst:sentences-follow2-yaml}
\end{minipage}
Notice that in \cref{lst:multiple-sentences1-mod1} the first sentence after the \texttt{)} has not been accounted for, but that
following the inclusion of \cref{lst:sentences-follow2-yaml}, the output given in \cref{lst:multiple-sentences1-mod2} demonstrates that
the sentence \emph{has} been accounted for correctly.
-\subsubsection{\texttt{sentencesBeginWith}}
+\subsubsection{sentencesBeginWith}
By default, \texttt{latexindent.pl} will only assume that sentences begin with the upper case letters \texttt{A-Z}; you can instruct the
script to define sentences to begin with lower case letters (see \cref{lst:sentencesBeginWith}), and we can use the \texttt{other} field
to define sentences to begin with other characters.
- \cmhlistingsfromfile*{demonstrations/multiple-sentences2.tex}{\texttt{multiple-sentences2.tex}}{lst:multiple-sentences2}
+ \cmhlistingsfromfile{demonstrations/multiple-sentences2.tex}{\texttt{multiple-sentences2.tex}}{lst:multiple-sentences2}
Upon running the following commands
\begin{widepage}
@@ -286,20 +286,20 @@ latexindent.pl multiple-sentences2 -m -l=manipulate-sentences.yaml,sentences-beg
\end{commandshell}
\end{widepage}
then we obtain the respective output given in \cref{lst:multiple-sentences2-mod1,lst:multiple-sentences2-mod2}.
- \cmhlistingsfromfile*{demonstrations/multiple-sentences2-mod1.tex}{\texttt{multiple-sentences2.tex} using \vref{lst:manipulate-sentences-yaml}}{lst:multiple-sentences2-mod1}
+ \cmhlistingsfromfile{demonstrations/multiple-sentences2-mod1.tex}{\texttt{multiple-sentences2.tex} using \vref{lst:manipulate-sentences-yaml}}{lst:multiple-sentences2-mod1}
\begin{minipage}{.55\linewidth}
- \cmhlistingsfromfile*{demonstrations/multiple-sentences2-mod2.tex}{\texttt{multiple-sentences2.tex} using \cref{lst:sentences-begin1-yaml}}{lst:multiple-sentences2-mod2}
+ \cmhlistingsfromfile{demonstrations/multiple-sentences2-mod2.tex}{\texttt{multiple-sentences2.tex} using \cref{lst:sentences-begin1-yaml}}{lst:multiple-sentences2-mod2}
\end{minipage}
\hfill
\begin{minipage}{.45\linewidth}
- \cmhlistingsfromfile*[style=yaml-LST]*{demonstrations/sentences-begin1.yaml}[MLB-TCB]{\texttt{sentences-begin1.yaml}}{lst:sentences-begin1-yaml}
+ \cmhlistingsfromfile[style=yaml-LST]*{demonstrations/sentences-begin1.yaml}[MLB-TCB]{\texttt{sentences-begin1.yaml}}{lst:sentences-begin1-yaml}
\end{minipage}
Notice that in \cref{lst:multiple-sentences2-mod1}, the first sentence has been accounted for but that the subsequent sentences
have not. In \cref{lst:multiple-sentences2-mod2}, all of the sentences have been accounted for, because the \texttt{other} field
in \cref{lst:sentences-begin1-yaml} has defined sentences to begin with either \lstinline!$! or any numeric digit, \texttt{0} to \texttt{9}.
-\subsubsection{\texttt{sentencesEndWith}}
+\subsubsection{sentencesEndWith}
Let's return to \vref{lst:multiple-sentences}; we have already seen the default way in which \texttt{latexindent.pl} will operate on the
sentences in this file in \vref{lst:multiple-sentences-mod1}. We can populate the \texttt{other} field with any character that we wish;
for example, using the YAML specified in \cref{lst:sentences-end1-yaml} and the command
@@ -310,19 +310,19 @@ latexindent.pl multiple-sentences -m -l=sentences-end2.yaml
then we obtain the output in \cref{lst:multiple-sentences-mod4}.
\begin{minipage}{.5\linewidth}
- \cmhlistingsfromfile*{demonstrations/multiple-sentences-mod4.tex}{\texttt{multiple-sentences.tex} using \cref{lst:sentences-end1-yaml}}{lst:multiple-sentences-mod4}
+ \cmhlistingsfromfile{demonstrations/multiple-sentences-mod4.tex}{\texttt{multiple-sentences.tex} using \cref{lst:sentences-end1-yaml}}{lst:multiple-sentences-mod4}
\end{minipage}
\hfill
\begin{minipage}{.5\linewidth}
- \cmhlistingsfromfile*[style=yaml-LST]*{demonstrations/sentences-end1.yaml}[MLB-TCB]{\texttt{sentences-end1.yaml}}{lst:sentences-end1-yaml}
+ \cmhlistingsfromfile[style=yaml-LST]*{demonstrations/sentences-end1.yaml}[MLB-TCB]{\texttt{sentences-end1.yaml}}{lst:sentences-end1-yaml}
\end{minipage}
\begin{minipage}{.5\linewidth}
- \cmhlistingsfromfile*{demonstrations/multiple-sentences-mod5.tex}{\texttt{multiple-sentences.tex} using \cref{lst:sentences-end2-yaml}}{lst:multiple-sentences-mod5}
+ \cmhlistingsfromfile{demonstrations/multiple-sentences-mod5.tex}{\texttt{multiple-sentences.tex} using \cref{lst:sentences-end2-yaml}}{lst:multiple-sentences-mod5}
\end{minipage}
\hfill
\begin{minipage}{.5\linewidth}
- \cmhlistingsfromfile*[style=yaml-LST]*{demonstrations/sentences-end2.yaml}[MLB-TCB]{\texttt{sentences-end2.yaml}}{lst:sentences-end2-yaml}
+ \cmhlistingsfromfile[style=yaml-LST]*{demonstrations/sentences-end2.yaml}[MLB-TCB]{\texttt{sentences-end2.yaml}}{lst:sentences-end2-yaml}
\end{minipage}
There is a subtle difference between the output in \cref{lst:multiple-sentences-mod4,lst:multiple-sentences-mod5}; in particular,
@@ -335,7 +335,7 @@ latexindent.pl multiple-sentences -m -l=sentences-end2.yaml
Let's consider the file shown in \cref{lst:url}.
- \cmhlistingsfromfile*{demonstrations/url.tex}{\texttt{url.tex}}{lst:url}
+ \cmhlistingsfromfile{demonstrations/url.tex}{\texttt{url.tex}}{lst:url}
Upon running the following commands
\begin{commandshell}
@@ -343,7 +343,7 @@ latexindent.pl url -m -l=manipulate-sentences.yaml
\end{commandshell}
we obtain the output given in \cref{lst:url-mod1}.
- \cmhlistingsfromfile*{demonstrations/url-mod1.tex}{\texttt{url.tex} using \vref{lst:manipulate-sentences-yaml}}{lst:url-mod1}
+ \cmhlistingsfromfile{demonstrations/url-mod1.tex}{\texttt{url.tex} using \vref{lst:manipulate-sentences-yaml}}{lst:url-mod1}
Notice that the full stop within the url has been interpreted correctly. This is because, within the \texttt{betterFullStop},
full stops at the end of sentences have the following properties:
@@ -363,17 +363,17 @@ latexindent.pl url -m -l=alt-full-stop1.yaml
\begin{adjustwidth}{-3.5cm}{-1.5cm}
\begin{minipage}{.6\linewidth}
- \cmhlistingsfromfile*{demonstrations/url-mod2.tex}{\texttt{url.tex} using \cref{lst:alt-full-stop1-yaml}}{lst:url-mod2}
+ \cmhlistingsfromfile{demonstrations/url-mod2.tex}{\texttt{url.tex} using \cref{lst:alt-full-stop1-yaml}}{lst:url-mod2}
\end{minipage}
\hfill
\begin{minipage}{.4\linewidth}
- \cmhlistingsfromfile*[style=yaml-LST]*{demonstrations/alt-full-stop1.yaml}[MLB-TCB]{\texttt{alt-full-stop1.yaml}}{lst:alt-full-stop1-yaml}
+ \cmhlistingsfromfile[style=yaml-LST]*{demonstrations/alt-full-stop1.yaml}[MLB-TCB]{\texttt{alt-full-stop1.yaml}}{lst:alt-full-stop1-yaml}
\end{minipage}
\end{adjustwidth}
Notice that the full stop within the URL has not been accomodated correctly because of the non-default settings in \cref{lst:alt-full-stop1-yaml}.
-\subsubsection{Features of the \texttt{oneSentencePerLine} routine}
+\subsubsection{Features of the oneSentencePerLine routine}
The sentence manipulation routine takes place \emph{after} verbatim environments, preamble and trailing comments have
been accounted for; this means that any characters within these types of code blocks will not be part
of the sentence manipulation routine.
@@ -383,8 +383,8 @@ latexindent.pl url -m -l=alt-full-stop1.yaml
latexindent.pl multiple-sentences3 -m -l=manipulate-sentences.yaml
\end{commandshell}
then we obtain the output in \cref{lst:multiple-sentences3-mod1}.
- \cmhlistingsfromfile*{demonstrations/multiple-sentences3.tex}{\texttt{multiple-sentences3.tex}}{lst:multiple-sentences3}
- \cmhlistingsfromfile*{demonstrations/multiple-sentences3-mod1.tex}{\texttt{multiple-sentences3.tex} using \vref{lst:manipulate-sentences-yaml}}{lst:multiple-sentences3-mod1}
+ \cmhlistingsfromfile{demonstrations/multiple-sentences3.tex}{\texttt{multiple-sentences3.tex}}{lst:multiple-sentences3}
+ \cmhlistingsfromfile{demonstrations/multiple-sentences3-mod1.tex}{\texttt{multiple-sentences3.tex} using \vref{lst:manipulate-sentences-yaml}}{lst:multiple-sentences3-mod1}
Furthermore, if sentences run across environments then, by default, the line breaks internal to the sentence will be removed.
For example, if we use the \texttt{.tex} file in \cref{lst:multiple-sentences4} and run the commands
@@ -393,11 +393,11 @@ latexindent.pl multiple-sentences4 -m -l=manipulate-sentences.yaml
latexindent.pl multiple-sentences4 -m -l=keep-sen-line-breaks.yaml
\end{commandshell}
then we obtain the output in \cref{lst:multiple-sentences4-mod1,lst:multiple-sentences4-mod2}.
- \cmhlistingsfromfile*{demonstrations/multiple-sentences4.tex}{\texttt{multiple-sentences4.tex}}{lst:multiple-sentences4}
+ \cmhlistingsfromfile{demonstrations/multiple-sentences4.tex}{\texttt{multiple-sentences4.tex}}{lst:multiple-sentences4}
\begin{widepage}
- \cmhlistingsfromfile*{demonstrations/multiple-sentences4-mod1.tex}{\texttt{multiple-sentences4.tex} using \vref{lst:manipulate-sentences-yaml}}{lst:multiple-sentences4-mod1}
+ \cmhlistingsfromfile{demonstrations/multiple-sentences4-mod1.tex}{\texttt{multiple-sentences4.tex} using \vref{lst:manipulate-sentences-yaml}}{lst:multiple-sentences4-mod1}
\end{widepage}
- \cmhlistingsfromfile*{demonstrations/multiple-sentences4-mod2.tex}{\texttt{multiple-sentences4.tex} using \vref{lst:keep-sen-line-breaks-yaml}}{lst:multiple-sentences4-mod2}
+ \cmhlistingsfromfile{demonstrations/multiple-sentences4-mod2.tex}{\texttt{multiple-sentences4.tex} using \vref{lst:keep-sen-line-breaks-yaml}}{lst:multiple-sentences4-mod2}
Once you've read \cref{sec:poly-switches}, you will know that you can accomodate the removal of internal sentence line breaks
by using the YAML in \cref{lst:item-rules2-yaml} and the command
\begin{commandshell}
@@ -406,14 +406,14 @@ latexindent.pl multiple-sentences4 -m -l=item-rules2.yaml
the output of which is shown in \cref{lst:multiple-sentences4-mod3}.
\begin{minipage}{.5\linewidth}
- \cmhlistingsfromfile*{demonstrations/multiple-sentences4-mod3.tex}{\texttt{multiple-sentences4.tex} using \cref{lst:item-rules2-yaml}}{lst:multiple-sentences4-mod3}
+ \cmhlistingsfromfile{demonstrations/multiple-sentences4-mod3.tex}{\texttt{multiple-sentences4.tex} using \cref{lst:item-rules2-yaml}}{lst:multiple-sentences4-mod3}
\end{minipage}
\hfill
\begin{minipage}{.5\linewidth}
- \cmhlistingsfromfile*[style=yaml-LST]*{demonstrations/item-rules2.yaml}[MLB-TCB]{\texttt{item-rules2.yaml}}{lst:item-rules2-yaml}
+ \cmhlistingsfromfile[style=yaml-LST]*{demonstrations/item-rules2.yaml}[MLB-TCB]{\texttt{item-rules2.yaml}}{lst:item-rules2-yaml}
\end{minipage}
-\subsection{\texttt{removeParagraphLineBreaks}: modifying line breaks for paragraphs}
+\subsection{removeParagraphLineBreaks: modifying line breaks for paragraphs}
When the \texttt{-m} switch is active \texttt{latexindent.pl} has the ability to remove line breaks
\announce{2017-05-27}{removeParagraphLineBreaks}
from within paragraphs; the behaviour is controlled by the \texttt{removeParagraphLineBreaks} field, detailed in
@@ -629,7 +629,7 @@ latexindent.pl -m sl-stop.tex -o sl-stop4-comment.tex -l=remove-para4.yaml,stop-
before words(*@$\BeginStartsOnOwnLine$@*) \begin{myenv}(*@$\BodyStartsOnOwnLine$@*)body of myenv(*@$\EndStartsOnOwnLine$@*)\end{myenv}(*@$\EndFinishesWithLineBreak$@*) after words
\end{cmhlistings}
-\subsubsection[Adding line breaks: \texttt{BeginStartsOnOwnLine} and \texttt{BodyStartsOnOwnLine}]{Adding line breaks using \texttt{BeginStartsOnOwnLine} and \texttt{BodyStartsOnOwnLine}}
+\subsubsection{Adding line breaks: BeginStartsOnOwnLine and BodyStartsOnOwnLine}
Let's explore \texttt{BeginStartsOnOwnLine} and \texttt{BodyStartsOnOwnLine} in \cref{lst:env-mlb1,lst:env-mlb2}, and in particular,
let's allow each of them in turn to take a value of $1$.
@@ -720,7 +720,7 @@ latexindent.pl -m env-mlb.tex -l env-mlb2.yaml
Note that line breaks have been added as in \cref{lst:env-mlb-mod1,lst:env-mlb-mod2}, but this time a \emph{blank line}
has been added after adding the line break.
-\subsubsection[Adding line breaks: \texttt{EndStartsOnOwnLine} and \texttt{EndFinishesWithLineBreak}]{Adding line breaks using \texttt{EndStartsOnOwnLine} and \texttt{EndFinishesWithLineBreak}}
+\subsubsection{Adding line breaks using EndStartsOnOwnLine and EndFinishesWithLineBreak}
Let's explore \texttt{EndStartsOnOwnLine} and \texttt{EndFinishesWithLineBreak} in \cref{lst:env-mlb7,lst:env-mlb8},
and in particular, let's allow each of them in turn to take a value of $1$.
@@ -1026,151 +1026,63 @@ latexindent.pl -m env-mlb7.tex -l env-mlb13.yaml,env-mlb14.yaml,UnpreserveBlankL
by design, line breaks involving \texttt{verbatim}, \texttt{filecontents} and `comment-marked' code blocks (\vref{lst:alignmentmarkup}) can \emph{not} be
modified using \texttt{latexindent.pl}.
- \begin{longtable}{m{.2\textwidth}@{\hspace{.75cm}}m{.35\textwidth}@{}m{.4\textwidth}}
- \caption{Poly-switch mappings for all code-block types}\label{tab:poly-switch-mapping} \\
+ \begin{longtable}{llll}
+ \caption{Poly-switch mappings for all code-block types}\label{tab:poly-switch-mapping} \\
\toprule
- Code block & Sample & Poly-switch mapping \\
+ Code block & Sample & \multicolumn{2}{c}{Poly-switch mapping} \\
\midrule
- environment &
- \begin{lstlisting}[style=tcblatex,escapeinside={(*@}{@*)},nolol=true]
-before words(*@$\BeginStartsOnOwnLine$@*)
-\begin{myenv}(*@$\BodyStartsOnOwnLine$@*)
-body of myenv(*@$\EndStartsOnOwnLine$@*)
-\end{myenv}(*@$\EndFinishesWithLineBreak$@*)
-after words
- \end{lstlisting}
- &
- \begin{tabular}[t]{c@{~}l@{}}
- $\BeginStartsOnOwnLine$ & BeginStartsOnOwnLine \\
- $\BodyStartsOnOwnLine$ & BodyStartsOnOwnLine \\
- $\EndStartsOnOwnLine$ & EndStartsOnOwnLine \\
- $\EndFinishesWithLineBreak$ & EndFinishesWithLineBreak \\
- \end{tabular}
- \\
- \cmidrule{2-3}
- ifelsefi &
- \begin{lstlisting}[style=tcblatex,escapeinside={(*@}{@*)},nolol=true]
-before words(*@$\BeginStartsOnOwnLine$@*)
-\if...(*@$\BodyStartsOnOwnLine$@*)
-body of if statement(*@$\ElseStartsOnOwnLine$@*)
-\else(*@$\ElseFinishesWithLineBreak$@*)
-body of else statement(*@$\EndStartsOnOwnLine$@*)
-\fi(*@$\EndFinishesWithLineBreak$@*)
-after words
- \end{lstlisting}
- &
- \begin{tabular}[t]{c@{~}l@{}}
- $\BeginStartsOnOwnLine$ & IfStartsOnOwnLine \\
- $\BodyStartsOnOwnLine$ & BodyStartsOnOwnLine \\
- $\ElseStartsOnOwnLine$ & ElseStartsOnOwnLine \\
- $\ElseFinishesWithLineBreak$ & ElseFinishesWithLineBreak \\
- $\EndStartsOnOwnLine$ & FiStartsOnOwnLine \\
- $\EndFinishesWithLineBreak$ & FiFinishesWithLineBreak \\
- \end{tabular}
- \\
- \cmidrule{2-3}
- optionalArguments &
- \begin{lstlisting}[style=tcblatex,escapeinside={(*@}{@*)},nolol=true]
-...(*@$\BeginStartsOnOwnLine$@*)
-[(*@$\BodyStartsOnOwnLine$@*)
-body of opt arg(*@$\EndStartsOnOwnLine$@*)
-](*@$\EndFinishesWithLineBreak$@*)
-...
- \end{lstlisting}
- &
- \begin{tabular}[t]{c@{~}l@{}}
- $\BeginStartsOnOwnLine$ & LSqBStartsOnOwnLine\footnote{LSqB stands for Left Square Bracket} \\
- $\BodyStartsOnOwnLine$ & OptArgBodyStartsOnOwnLine \\
- $\EndStartsOnOwnLine$ & RSqBStartsOnOwnLine \\
- $\EndFinishesWithLineBreak$ & RSqBFinishesWithLineBreak \\
- \end{tabular}
- \\
- \cmidrule{2-3}
- mandatoryArguments &
- \begin{lstlisting}[style=tcblatex,escapeinside={(*@}{@*)},nolol=true]
-...(*@$\BeginStartsOnOwnLine$@*)
-{(*@$\BodyStartsOnOwnLine$@*)
-body of mand arg(*@$\EndStartsOnOwnLine$@*)
-}(*@$\EndFinishesWithLineBreak$@*)
-...
- \end{lstlisting}
- &
- \begin{tabular}[t]{c@{~}l@{}}
- $\BeginStartsOnOwnLine$ & LCuBStartsOnOwnLine\footnote{LCuB stands for Left Curly Brace} \\
- $\BodyStartsOnOwnLine$ & MandArgBodyStartsOnOwnLine \\
- $\EndStartsOnOwnLine$ & RCuBStartsOnOwnLine \\
- $\EndFinishesWithLineBreak$ & RCuBFinishesWithLineBreak \\
- \end{tabular}
- \\
- \cmidrule{2-3}
- commands &
- \begin{lstlisting}[style=tcblatex,escapeinside={(*@}{@*)},morekeywords={mycommand},nolol=true,]
-before words(*@$\BeginStartsOnOwnLine$@*)
-\mycommand(*@$\BodyStartsOnOwnLine$@*)
-(*@$\langle$\itshape{arguments}$\rangle$@*)
- \end{lstlisting}
- &
- \begin{tabular}[t]{c@{~}l@{}}
- $\BeginStartsOnOwnLine$ & CommandStartsOnOwnLine \\
- $\BodyStartsOnOwnLine$ & CommandNameFinishesWithLineBreak \\
- \end{tabular}
- \\
- \cmidrule{2-3}
- namedGroupingBraces Brackets &
- \begin{lstlisting}[style=tcblatex,escapeinside={(*@}{@*)},morekeywords={myname},nolol=true,]
-before words(*@$\BeginStartsOnOwnLine$@*)
-myname(*@$\BodyStartsOnOwnLine$@*)
-(*@$\langle$\itshape{braces/brackets}$\rangle$@*)
- \end{lstlisting}
- &
- \begin{tabular}[t]{c@{~}l@{}}
- $\BeginStartsOnOwnLine$ & NameStartsOnOwnLine \\
- $\BodyStartsOnOwnLine$ & NameFinishesWithLineBreak \\
- \end{tabular}
- \\
- \cmidrule{2-3}
- keyEqualsValuesBraces\newline Brackets &
- \begin{lstlisting}[style=tcblatex,escapeinside={(*@}{@*)},morekeywords={key},nolol=true,]
-before words(*@$\BeginStartsOnOwnLine$@*)
-key(*@$\EqualsStartsOnOwnLine$@*)=(*@$\BodyStartsOnOwnLine$@*)
-(*@$\langle$\itshape{braces/brackets}$\rangle$@*)
- \end{lstlisting}
- &
- \begin{tabular}[t]{c@{~}l@{}}
- $\BeginStartsOnOwnLine$ & KeyStartsOnOwnLine \\
- $\EqualsStartsOnOwnLine$ & EqualsStartsOnOwnLine \\
- $\BodyStartsOnOwnLine$ & EqualsFinishesWithLineBreak \\
- \end{tabular}
- \\
- \cmidrule{2-3}
- items &
- \begin{lstlisting}[style=tcblatex,escapeinside={(*@}{@*)},nolol=true]
-before words(*@$\BeginStartsOnOwnLine$@*)
-\item(*@$\BodyStartsOnOwnLine$@*)
-...
- \end{lstlisting}
- &
- \begin{tabular}[t]{c@{~}l@{}}
- $\BeginStartsOnOwnLine$ & ItemStartsOnOwnLine \\
- $\BodyStartsOnOwnLine$ & ItemFinishesWithLineBreak \\
- \end{tabular}
- \\
- \cmidrule{2-3}
- specialBeginEnd &
- \begin{lstlisting}[style=tcblatex,escapeinside={(*@}{@*)},nolol=true]
-before words(*@$\BeginStartsOnOwnLine$@*)
-\[(*@$\BodyStartsOnOwnLine$@*)
-body of special(*@$\EndStartsOnOwnLine$@*)
-\](*@$\EndFinishesWithLineBreak$@*)
-after words
- \end{lstlisting}
- &
- \begin{tabular}[t]{c@{~}l@{}}
- $\BeginStartsOnOwnLine$ & SpecialBeginStartsOnOwnLine \\
- $\BodyStartsOnOwnLine$ & SpecialBodyStartsOnOwnLine \\
- $\EndStartsOnOwnLine$ & SpecialEndStartsOnOwnLine \\
- $\EndFinishesWithLineBreak$ & SpecialEndFinishesWithLineBreak \\
- \end{tabular}
- \\
+ environment & \verb!before words!$\BeginStartsOnOwnLine$ & $\BeginStartsOnOwnLine$ & BeginStartsOnOwnLine \\
+ & \verb!\begin{myenv}!$\BodyStartsOnOwnLine$ & $\BodyStartsOnOwnLine$ & BodyStartsOnOwnLine \\
+ & \verb!body of myenv!$\EndStartsOnOwnLine$ & $\EndStartsOnOwnLine$ & EndStartsOnOwnLine \\
+ & \verb!\end{myenv}!$\EndFinishesWithLineBreak$ & $\EndFinishesWithLineBreak$ & EndFinishesWithLineBreak \\
+ & \verb!after words! & & \\
+ \cmidrule{2-4}
+ ifelsefi & \verb!before words!$\BeginStartsOnOwnLine$ & $\BeginStartsOnOwnLine$ & IfStartsOnOwnLine \\
+ & \verb!\if...!$\BodyStartsOnOwnLine$ & $\BodyStartsOnOwnLine$ & BodyStartsOnOwnLine \\
+ & \verb!body of if/or statement!$\OrStartsOnOwnLine$ & $\OrStartsOnOwnLine$ & OrStartsOnOwnLine %
+ \announce*{2018-04-27}{new ifElseFi code block polyswitches} \\
+ & \verb!\or!$\OrFinishesWithLineBreak$ & $\OrFinishesWithLineBreak$ & OrFinishesWithLineBreak \\
+ & \verb!body of if/or statement!$\ElseStartsOnOwnLine$ & $\ElseStartsOnOwnLine$ & ElseStartsOnOwnLine \\
+ & \verb!\else!$\ElseFinishesWithLineBreak$ & $\ElseFinishesWithLineBreak$ & ElseFinishesWithLineBreak \\
+ & \verb!body of else statement!$\EndStartsOnOwnLine$ & $\EndStartsOnOwnLine$ & FiStartsOnOwnLine \\
+ & \verb!\fi!$\EndFinishesWithLineBreak$ & $\EndFinishesWithLineBreak$ & FiFinishesWithLineBreak \\
+ & \verb!after words! & & \\
+ \cmidrule{2-4}
+ optionalArguments & \verb!...!$\BeginStartsOnOwnLine$ & $\BeginStartsOnOwnLine$ & LSqBStartsOnOwnLine\footnote{LSqB stands for Left Square Bracket} \\
+ & \verb![!$\BodyStartsOnOwnLine$ & $\BodyStartsOnOwnLine$ & OptArgBodyStartsOnOwnLine \\
+ & \verb!body of opt arg!$\EndStartsOnOwnLine$ & $\EndStartsOnOwnLine$ & RSqBStartsOnOwnLine \\
+ & \verb!]!$\EndFinishesWithLineBreak$ & $\EndFinishesWithLineBreak$ & RSqBFinishesWithLineBreak \\
+ & \verb!...! & & \\
+ \cmidrule{2-4}
+ mandatoryArguments & \verb!...!$\BeginStartsOnOwnLine$ & $\BeginStartsOnOwnLine$ & LCuBStartsOnOwnLine\footnote{LCuB stands for Left Curly Brace} \\
+ & \verb!{!$\BodyStartsOnOwnLine$ & $\BodyStartsOnOwnLine$ & MandArgBodyStartsOnOwnLine \\
+ & \verb!body of mand arg!$\EndStartsOnOwnLine$ & $\EndStartsOnOwnLine$ & RCuBStartsOnOwnLine \\
+ & \verb!}!$\EndFinishesWithLineBreak$ & $\EndFinishesWithLineBreak$ & RCuBFinishesWithLineBreak \\
+ & \verb!...! & & \\
+ \cmidrule{2-4}
+ commands & \verb!before words!$\BeginStartsOnOwnLine$ & $\BeginStartsOnOwnLine$ & CommandStartsOnOwnLine \\
+ & \verb!\mycommand!$\BodyStartsOnOwnLine$ & $\BodyStartsOnOwnLine$ & CommandNameFinishesWithLineBreak \\
+ & $\langle$\itshape{arguments}$\rangle$ & & \\
+ \cmidrule{2-4}
+ namedGroupingBraces Brackets & before words$\BeginStartsOnOwnLine$ & $\BeginStartsOnOwnLine$ & NameStartsOnOwnLine \\
+ & myname$\BodyStartsOnOwnLine$ & $\BodyStartsOnOwnLine$ & NameFinishesWithLineBreak \\
+ & $\langle$\itshape{braces/brackets}$\rangle$ & & \\
+ \cmidrule{2-4}
+ keyEqualsValuesBraces\newline Brackets & before words$\BeginStartsOnOwnLine$ & $\BeginStartsOnOwnLine$ & KeyStartsOnOwnLine \\
+ & key$\EqualsStartsOnOwnLine$=$\BodyStartsOnOwnLine$ & $\EqualsStartsOnOwnLine$ & EqualsStartsOnOwnLine \\
+ & $\langle$\itshape{braces/brackets}$\rangle$ & $\BodyStartsOnOwnLine$ & EqualsFinishesWithLineBreak \\
+ \cmidrule{2-4}
+ items & before words$\BeginStartsOnOwnLine$ & $\BeginStartsOnOwnLine$ & ItemStartsOnOwnLine \\
+ & \verb!\item!$\BodyStartsOnOwnLine$ & $\BodyStartsOnOwnLine$ & ItemFinishesWithLineBreak \\
+ & \verb!...! & & \\
+ \cmidrule{2-4}
+ specialBeginEnd & before words$\BeginStartsOnOwnLine$ & $\BeginStartsOnOwnLine$ & SpecialBeginStartsOnOwnLine \\
+ & \verb!\[!$\BodyStartsOnOwnLine$ & $\BodyStartsOnOwnLine$ & SpecialBodyStartsOnOwnLine \\
+ & \verb!body of special/middle!$\ElseStartsOnOwnLine$ & $\ElseStartsOnOwnLine$ & SpecialMiddleStartsOnOwnLine %
+ \announce*{2018-04-27}{new special code block polyswitches} \\
+ & \verb!\middle!$\ElseFinishesWithLineBreak$ & $\ElseFinishesWithLineBreak$ & SpecialMiddleFinishesWithLineBreak \\
+ & body of special/middle $\EndStartsOnOwnLine$ & $\EndStartsOnOwnLine$ & SpecialEndStartsOnOwnLine \\
+ & \verb!\]!$\EndFinishesWithLineBreak$ & $\EndFinishesWithLineBreak$ & SpecialEndFinishesWithLineBreak \\
+ & after words & & \\
\bottomrule
\end{longtable}
diff --git a/Master/texmf-dist/doc/support/latexindent/subsec-commands-and-their-options.tex b/Master/texmf-dist/doc/support/latexindent/subsec-commands-and-their-options.tex
index fb967252fe3..32292cfbfc5 100644
--- a/Master/texmf-dist/doc/support/latexindent/subsec-commands-and-their-options.tex
+++ b/Master/texmf-dist/doc/support/latexindent/subsec-commands-and-their-options.tex
@@ -8,9 +8,9 @@
\yamltitle{commandCodeBlocks}*{fields}
The \texttt{commandCodeBlocks} field%
- \announce{2017-08-21}*{commandCodeBlocks} contains a few switches detailed in \cref{lst:commandCodeBlocks}.
+ \announce*{2018-04-27}*{commandCodeBlocks} contains a few switches detailed in \cref{lst:commandCodeBlocks}.
- \cmhlistingsfromfile[style=commandCodeBlocks]*{../defaultSettings.yaml}[width=.8\linewidth,before=\centering,yaml-TCB]{\texttt{commandCodeBlocks}}{lst:commandCodeBlocks}
+ \cmhlistingsfromfile*[style=commandCodeBlocks]*{../defaultSettings.yaml}[width=.8\linewidth,before=\centering,yaml-TCB]{\texttt{commandCodeBlocks}}{lst:commandCodeBlocks}
\yamltitle{roundParenthesesAllowed}{0|1}
@@ -87,7 +87,7 @@ latexindent.pl pstricks1.tex -l defFunction.yaml
\begin{quote}
to, node, ++
\end{quote}
- are all allowed to appear between arguments, as they are each set to $1$; importantly, you are encouraged to add further names
+ are all allowed to appear between arguments; importantly, you are encouraged to add further names
to this field as necessary. This means that when \texttt{latexindent.pl}
processes \cref{lst:tikz-node1}, it consumes:
\begin{itemize}
@@ -118,30 +118,88 @@ latexindent.pl tikz-node1.tex -l draw.yaml
Notice that each line after the \lstinline!\draw! command (its `body') in \cref{lst:tikz-node1-draw} has been given the
appropriate two-spaces worth of indentation specified in \cref{lst:draw}.
- Let's compare this with the output from using the YAML settings in \cref{lst:no-to}, and running the command
+ Let's compare this with the output from using the YAML settings in \cref{lst:no-strings}, and running the command
\begin{commandshell}
-latexindent.pl tikz-node1.tex -l no-to.yaml
+latexindent.pl tikz-node1.tex -l no-strings.yaml
\end{commandshell}
- given in \cref{lst:tikz-node1-no-to}.
+ given in \cref{lst:tikz-node1-no-strings}.
\begin{minipage}{.45\textwidth}
- \cmhlistingsfromfile{demonstrations/tikz-node1-no-to.tex}{\texttt{tikz-node1.tex} using \cref{lst:no-to}}{lst:tikz-node1-no-to}
+ \cmhlistingsfromfile{demonstrations/tikz-node1-no-strings.tex}{\texttt{tikz-node1.tex} using \cref{lst:no-strings}}{lst:tikz-node1-no-strings}
\end{minipage}
\hfill
- \begin{minipage}{.45\textwidth}
- \cmhlistingsfromfile[style=yaml-LST]*{demonstrations/no-to.yaml}[yaml-TCB]{\texttt{no-to.yaml}}{lst:no-to}
+ \begin{minipage}{.49\textwidth}
+ \cmhlistingsfromfile*[style=yaml-LST]*{demonstrations/no-strings.yaml}[yaml-TCB]{\texttt{no-strings.yaml}}{lst:no-strings}
\end{minipage}
In this case, \texttt{latexindent.pl} sees that:
\begin{itemize}
- \item the \lstinline!\draw! command finishes after the \lstinline!(c)! as (\texttt{stringsAllowedBetweenArguments} has \texttt{to} set to $0$)
+ \item the \lstinline!\draw! command finishes after the \lstinline!(c)!, as \texttt{stringsAllowedBetweenArguments} has been set to $0$
+ so there are no strings allowed between arguments;
\item it finds a \texttt{namedGroupingBracesBrackets} called \texttt{to} (see \vref{tab:code-blocks}) \emph{with} argument \lstinline![in=110,out=-90]!
\item it finds another \texttt{namedGroupingBracesBrackets} but this time called \texttt{node} with argument \lstinline![below,align=left,scale=0.5]!
\end{itemize}
+ Referencing \vref{lst:commandCodeBlocks},%
+ \announce*{2018-04-27}*{amalgamate feature in commandCodeBlocks}, we see that the first field in
+ the \texttt{stringsAllowedBetweenArguments} is \texttt{amalgamate} and is set to \texttt{1} by default. This is for users who wish to
+ specify their settings in multiple YAML files. For example, by using the settings in either \cref{lst:amalgamate-demo} or\cref{lst:amalgamate-demo1}
+ is equivalent to using the settings in \cref{lst:amalgamate-demo2}.
+
+ \begin{adjustwidth}{-3.5cm}{-1.5cm}
+ \begin{minipage}{.32\linewidth}
+ \cmhlistingsfromfile*[style=yaml-LST]*{demonstrations/amalgamate-demo.yaml}[yaml-TCB]{\texttt{amalgamate-demo.yaml}}{lst:amalgamate-demo}
+ \end{minipage}%
+ \hfill
+ \begin{minipage}{.32\linewidth}
+ \cmhlistingsfromfile*[style=yaml-LST]*{demonstrations/amalgamate-demo1.yaml}[yaml-TCB]{\texttt{amalgamate-demo1.yaml}}{lst:amalgamate-demo1}
+ \end{minipage}%
+ \hfill
+ \begin{minipage}{.32\linewidth}
+ \cmhlistingsfromfile*[style=yaml-LST]*{demonstrations/amalgamate-demo2.yaml}[yaml-TCB]{\texttt{amalgamate-demo2.yaml}}{lst:amalgamate-demo2}
+ \end{minipage}
+ \end{adjustwidth}
+ We specify \texttt{amalgamate} to be set to \texttt{0} and in which case any settings loaded prior
+ to those specified, including the default, will be overwritten. For example, using the settings
+ in \cref{lst:amalgamate-demo3} means that only the strings specified in that field will be used.
+
+ \cmhlistingsfromfile*[style=yaml-LST]*{demonstrations/amalgamate-demo3.yaml}[yaml-TCB]{\texttt{amalgamate-demo3.yaml}}{lst:amalgamate-demo3}
+
+ It is important to note that the \texttt{amalgamate} field, if used, must be in the first field,
+ and specified using the syntax given in \cref{lst:amalgamate-demo1,lst:amalgamate-demo2,lst:amalgamate-demo3}.
+
+ We may explore this feature further with the code in \cref{lst:for-each}, whose default output is given in \cref{lst:for-each-default}.
+
+ \begin{minipage}{.45\textwidth}
+ \cmhlistingsfromfile*{demonstrations/for-each.tex}{\texttt{for-each.tex}}{lst:for-each}
+ \end{minipage}
+ \hfill
+ \begin{minipage}{.45\textwidth}
+ \cmhlistingsfromfile*{demonstrations/for-each-default.tex}{\texttt{for-each} default output}{lst:for-each-default}
+ \end{minipage}
+
+ Let's compare this with the output from using the YAML settings in \cref{lst:foreach}, and running the command
+ \begin{commandshell}
+latexindent.pl for-each.tex -l foreach.yaml
+\end{commandshell}
+ given in \cref{lst:for-each-mod1}.
+
+ \begin{minipage}{.45\textwidth}
+ \cmhlistingsfromfile*{demonstrations/for-each-mod1.tex}{\texttt{for-each.tex} using \cref{lst:foreach}}{lst:for-each-mod1}
+ \end{minipage}
+ \hfill
+ \begin{minipage}{.49\textwidth}
+ \cmhlistingsfromfile*[style=yaml-LST]*{demonstrations/foreach.yaml}[yaml-TCB]{\texttt{foreach.yaml}}{lst:foreach}
+ \end{minipage}
+
+ You might like to compare the output given in \cref{lst:for-each-default} and \cref{lst:for-each-mod1}. Note,in particular, in
+ \cref{lst:for-each-default} that the \texttt{foreach} command has not included any of the subsequent strings, and that the braces
+ have been treated as a \texttt{namedGroupingBracesBrackets}. In \cref{lst:for-each-mod1} the \texttt{foreach} command has been allowed to have \lstinline!\x/\y! and \texttt{in} between
+ arguments because of the settings given in \cref{lst:foreach}.
+
\yamltitle{commandNameSpecial}*{fields}
There are some special command names%
- \announce{2017-08-21}{commandNameSpecial} that do not fit within the names recognized by \texttt{latexindent.pl},
+ \announce*{2018-04-27}*{commandNameSpecial} that do not fit within the names recognized by \texttt{latexindent.pl},
the first one of which is \lstinline!\@ifnextchar[!. From the perspective of \texttt{latexindent.pl}, the whole of the
text \lstinline!\@ifnextchar[! is is a command, because it is
immediately followed by sets of mandatory arguments. However, without the \texttt{commandNameSpecial} field, \texttt{latexindent.pl}
@@ -159,9 +217,11 @@ latexindent.pl tikz-node1.tex -l no-to.yaml
Notice that in \cref{lst:ifnextchar-default} the \texttt{parbox} command has been able to indent its body, because \texttt{latexindent.pl}
has successfully found the command \lstinline!\@ifnextchar! first; the pattern-matching of \texttt{latexindent.pl} starts from
- \emph{the inner most <thing> and works outwards}, discussed in more detail on \cpageref{page:phases}. For demonstration, we can compare
+ \emph{the inner most <thing> 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!
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Arguments.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Arguments.pm
index fc6cab0c33a..8c8b5af38f1 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Arguments.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Arguments.pm
@@ -235,19 +235,20 @@ sub get_arguments_regexp{
# commands are allowed strings between arguments, e.g node, decoration, etc, specified in stringsAllowedBetweenArguments
my $stringsBetweenArguments = q();
- if(defined ${input}{stringBetweenArguments} and ${input}{stringBetweenArguments}==1){
+ if(defined ${input}{stringBetweenArguments} and ${input}{stringBetweenArguments}==1
+ and ref(${$masterSettings{commandCodeBlocks}}{stringsAllowedBetweenArguments}) eq "ARRAY"){
# grab the strings allowed between arguments
- my %stringsAllowedBetweenArguments = %{${$masterSettings{commandCodeBlocks}}{stringsAllowedBetweenArguments}};
+ my @stringsAllowedBetweenArguments = @{${$masterSettings{commandCodeBlocks}}{stringsAllowedBetweenArguments}};
- while( my ($allowedStringName,$allowedStringValue)= each %stringsAllowedBetweenArguments){
- # change + and - to escaped characters
- $allowedStringName =~ s/\+/\\+/g;
- $allowedStringName =~ s/\-/\\-/g;
+ $logger->trace("*Looping through array for commandCodeBlocks->stringsAllowedBetweenArguments") if $is_t_switch_active ;
- # form the regexp
- $stringsBetweenArguments .= ($stringsBetweenArguments eq '' ? q() : "|").$allowedStringName if $allowedStringValue;
+ # note that the zero'th element in this array contains the amalgamate switch, which we don't want!
+ foreach (@stringsAllowedBetweenArguments[1 .. $#stringsAllowedBetweenArguments]) {
+ $logger->trace("$_") if $is_t_switch_active ;
+ $stringsBetweenArguments .= ($stringsBetweenArguments eq ""?q():"|").$_;
}
+ $stringsBetweenArguments = qr/$stringsBetweenArguments/;
# report to log file
$logger->trace("*Strings allowed between arguments: $stringsBetweenArguments (see stringsAllowedBetweenArguments)") if $is_t_switch_active;
}
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Command.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Command.pm
index acd118ecf6d..2ba44bd5a62 100755
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Command.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Command.pm
@@ -45,17 +45,20 @@ sub construct_command_regexp{
stringBetweenArguments=>1);
# put together a list of the special command names (this was mostly motivated by the \@ifnextchar[ issue)
- my %commandNameSpecial = %{${$masterSettings{commandCodeBlocks}}{commandNameSpecial}};
-
my $commandNameSpecialRegExp = q();
- while( my ($commandName,$yesNo)= each %commandNameSpecial){
- # change + and - to escaped characters
- $commandName =~ s/\+/\\+/g;
- $commandName =~ s/\-/\\-/g;
- $commandName =~ s/\[/\\[/g;
-
- # form the regexp
- $commandNameSpecialRegExp .= ($commandNameSpecialRegExp eq '' ? q() : "|").$commandName if $yesNo;
+ if(ref(${$masterSettings{commandCodeBlocks}}{commandNameSpecial}) eq "ARRAY"){
+
+ my @commandNameSpecial = @{${$masterSettings{commandCodeBlocks}}{commandNameSpecial}};
+ $logger->trace("*Looping through array for commandCodeBlocks->commandNameSpecial") if $is_t_switch_active ;
+
+ # note that the zero'th element in this array contains the amalgamate switch, which we don't want!
+ foreach (@commandNameSpecial[1 .. $#commandNameSpecial]) {
+ $logger->trace("$_") if $is_t_switch_active ;
+ $commandNameSpecialRegExp .= ($commandNameSpecialRegExp eq ""?q():"|").$_;
+ }
+
+ # turn the above into a regexp
+ $commandNameSpecialRegExp = qr/$commandNameSpecialRegExp/;
}
# details to log file
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Else.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Else.pm
index fe2664cf1dd..0403de6adb2 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Else.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Else.pm
@@ -26,51 +26,62 @@ our @ISA = "LatexIndent::Document"; # class inheritance, Programming Perl, pg 32
our @EXPORT_OK = qw/check_for_else_statement/;
our $elseCounter;
-# store the regular expresssion for matching and replacing the \else statements
-our $elseRegExp = qr/
- (
- \\else
- \h* # possible horizontal space
- (\R*) # possible line breaks after \else statement
- )
- (.*?)$
- /sx;
-
sub check_for_else_statement{
my $self = shift;
- $logger->trace("*Looking for \\else statement (${$self}{name})") if $is_t_switch_active;
- ${$self}{body} =~ s/$elseRegExp(\h*)($trailingCommentRegExp)?
- /
- # create a new IfElseFi object
- my $else = LatexIndent::Else->new(begin=>$1,
- name=>${$self}{name},
- storageNameAppend=>"else",
- body=>$3,
- end=>q(),
- linebreaksAtEnd=>{
- begin=>$2?1:0,
- body=>0,
- end=>0,
- },
- aliases=>{
- # begin statements
- BeginStartsOnOwnLine=>"ElseStartsOnOwnLine",
- # end statements
- BodyStartsOnOwnLine=>"ElseFinishesWithLineBreak",
- },
- modifyLineBreaksYamlName=>"ifElseFi",
- endImmediatelyFollowedByComment=>0,
- horizontalTrailingSpace=>q(),
- );
- # log file output
- $logger->trace("*else found: ${$self}{name}")if $is_t_switch_active;
-
- # the settings and storage of most objects has a lot in common
- $self->get_settings_and_store_new_object($else);
- ${@{${$self}{children}}[-1]}{replacementText};
- /xse;
- return;
+ # we call the else routine from different places; see IfElseFi.pm and Special.pm
+ my %input = @_;
+
+ # store the regular expresssion for matching and replacing the \else statements
+ my $elseRegExp = qr/
+ (
+ $input{elseNameRegExp}
+ \h* # possible horizontal space
+ (\R*) # possible line breaks after \else statement
+ )
+ (
+ (?:
+ (?!$input{elseNameRegExp}).
+ )*? # body, which can't include another \else
+ )
+ $
+ /sx;
+
+ $logger->trace("*Looking for $input{elseNameRegExp} statement (${$self}{name})") if $is_t_switch_active;
+
+ while(${$self}{body} =~ m/$elseRegExp(\h*)($trailingCommentRegExp)?/){
+ ${$self}{body} =~ s/$elseRegExp(\h*)($trailingCommentRegExp)?
+ /
+ # create a new IfElseFi object
+ my $else = LatexIndent::Else->new(begin=>$1,
+ name=>${$self}{name},
+ storageNameAppend=>$input{storageNameAppend},
+ body=>$3,
+ end=>q(),
+ linebreaksAtEnd=>{
+ begin=>$2?1:0,
+ body=>0,
+ end=>0,
+ },
+ aliases=>{
+ # begin statements
+ BeginStartsOnOwnLine=>$input{ElseStartsOnOwnLine},
+ # end statements
+ BodyStartsOnOwnLine=>$input{ElseFinishesWithLineBreak},
+ },
+ modifyLineBreaksYamlName=>${$self}{modifyLineBreaksYamlName},
+ endImmediatelyFollowedByComment=>0,
+ horizontalTrailingSpace=>q(),
+ );
+ # log file output
+ $logger->trace("*$input{logName} found: ${$self}{name}")if $is_t_switch_active;
+
+ # the settings and storage of most objects has a lot in common
+ $self->get_settings_and_store_new_object($else);
+ ${@{${$self}{children}}[-1]}{replacementText};
+ /xse;
+ }
+ return;
}
sub remove_line_breaks_begin{
@@ -92,6 +103,10 @@ sub tasks_particular_to_each_object{
# search for commands and special code blocks
$self->find_commands_or_key_equals_values_braces_and_special;
+
+ # search for arguments
+ $self->find_opt_mand_arguments;
+
return;
}
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/FileContents.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/FileContents.pm
index 4ad2623fe0d..5ef487f9866 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/FileContents.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/FileContents.pm
@@ -120,7 +120,7 @@ sub find_file_contents_environments_and_preamble{
# try and find the preamble
if( ${$self}{body} =~ m/$preambleRegExp/sx and ${$masterSettings{lookForPreamble}}{${$self}{fileExtension}}){
- $logger->trace("\\begin{document} found in body (after searching for filecontents)-- assuming that a preamble exists",'heading') if $is_t_switch_active ;
+ $logger->trace("\\begin{document} found in body (after searching for filecontents)-- assuming that a preamble exists") if $is_t_switch_active ;
# create a preamble object
$preamble = LatexIndent::Preamble->new( begin=>q(),
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm
index b5a9037a907..8fb07087c35 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm
@@ -223,7 +223,32 @@ sub readSettings{
}
}
} else {
- $masterSettings{$firstLevelKey}{$secondLevelKey} = $secondLevelValue;
+ # settings such as commandCodeBlocks can have arrays, which may wish
+ # to be amalgamated, rather than overwritten
+ if(ref($secondLevelValue) eq "ARRAY"
+ and
+ ${${$masterSettings{$firstLevelKey}{$secondLevelKey}}[0]}{amalgamate}
+ and
+ !(ref(${$secondLevelValue}[0]) eq "HASH" and defined ${$secondLevelValue}[0]{amalgamate} and !${$secondLevelValue}[0]{amalgamate})
+ ){
+ $logger->trace("*$firstLevelKey -> $secondLevelKey, amalgamate: 1") if($is_t_switch_active);
+ foreach (@{$secondLevelValue}){
+ $logger->trace("$_") if($is_t_switch_active);
+ push (@{$masterSettings{$firstLevelKey}{$secondLevelKey}},$_) unless(ref($_) eq "HASH");
+ }
+
+ # remove duplicated entries, https://stackoverflow.com/questions/7651/how-do-i-remove-duplicate-items-from-an-array-in-perl
+ my %seen = ();
+ my @unique = grep { ! $seen{ $_ }++ } @{$masterSettings{$firstLevelKey}{$secondLevelKey}};
+ @{$masterSettings{$firstLevelKey}{$secondLevelKey}} = @unique;
+
+ $logger->trace("*master settings for $firstLevelKey -> $secondLevelKey now look like:") if $is_t_switch_active;
+ foreach (@{$masterSettings{$firstLevelKey}{$secondLevelKey}}){
+ $logger->trace("$_") if($is_t_switch_active);
+ }
+ } else {
+ $masterSettings{$firstLevelKey}{$secondLevelKey} = $secondLevelValue;
+ }
}
}
} else {
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/HiddenChildren.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/HiddenChildren.pm
index af7d513809d..768ec1651f9 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/HiddenChildren.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/HiddenChildren.pm
@@ -101,48 +101,52 @@ sub update_family_tree{
# loop through the hash
$logger->trace("*Updating FamilyTree...") if $is_t_switch_active;
while( my ($idToSearch,$ancestorToSearch)= each %familyTree){
+ $logger->trace("*current ID: $idToSearch") if($is_t_switch_active);
foreach(@{${$ancestorToSearch}{ancestors}}){
my $ancestorID = ${$_}{ancestorID};
- $logger->trace("current ID: $idToSearch, ancestor: $ancestorID") if($is_t_switch_active);
- if($familyTree{$ancestorID}){
- $logger->trace("$ancestorID is a key within familyTree, grabbing its ancestors") if($is_t_switch_active);
- my $naturalAncestors = q();
- foreach(@{${$familyTree{$idToSearch}}{ancestors}}){
- $naturalAncestors .= "---".${$_}{ancestorID} if(${$_}{type} eq "natural");
- }
- foreach(@{${$familyTree{$ancestorID}}{ancestors}}){
- $logger->trace("ancestor of *hidden* child: ${$_}{ancestorID}") if($is_t_switch_active);
- my $newAncestorId = ${$_}{ancestorID};
- my $type;
- if($naturalAncestors =~ m/$ancestorID/){
- $type = "natural";
- } else {
- $type = "adopted";
- }
- my $matched = grep { $_->{ancestorID} eq $newAncestorId } @{${$familyTree{$idToSearch}}{ancestors}};
- push(@{${$familyTree{$idToSearch}}{ancestors}},{ancestorID=>${$_}{ancestorID},ancestorIndentation=>${$_}{ancestorIndentation},type=>$type}) unless($matched);
- }
- } else {
- my $naturalAncestors = q();
- foreach(@{${$familyTree{$idToSearch}}{ancestors}}){
- $naturalAncestors .= "---".${$_}{ancestorID} if(${$_}{type} eq "natural");
- }
- $logger->trace("natural ancestors of $ancestorID: $naturalAncestors") if($is_t_switch_active);
- foreach(@{${$allChildren{$ancestorID}}{ancestors}}){
- my $newAncestorId = ${$_}{ancestorID};
- my $type;
- if($naturalAncestors =~ m/$newAncestorId/){
- $type = "natural";
- } else {
- $type = "adopted";
- }
- my $matched = grep { $_->{ancestorID} eq $newAncestorId } @{${$familyTree{$idToSearch}}{ancestors}};
- unless($matched){
- $logger->trace("ancestor of UNHIDDEN child: ${$_}{ancestorID}") if($is_t_switch_active);
- push(@{${$familyTree{$idToSearch}}{ancestors}},{ancestorID=>${$_}{ancestorID},ancestorIndentation=>${$_}{ancestorIndentation},type=>$type});
+
+ # construct the natural ancestors
+ my $naturalAncestors = q();
+ foreach(@{${$familyTree{$idToSearch}}{ancestors}}){
+ $naturalAncestors .= "---".${$_}{ancestorID} if(${$_}{type} eq "natural");
+ }
+
+ # we only need to update the family tree if the $ancestorID is *not* a natural
+ # ancestor, otherwise everything will be taken care of by the natural ancestor
+ if($naturalAncestors !~ m/$ancestorID/){
+ $logger->trace("ancestor: $ancestorID") if($is_t_switch_active);
+ if($familyTree{$ancestorID}){
+ $logger->trace("$ancestorID is a key within familyTree, grabbing its ancestors") if($is_t_switch_active);
+ foreach(@{${$familyTree{$ancestorID}}{ancestors}}){
+ $logger->trace("ancestor of *hidden* child: ${$_}{ancestorID}") if($is_t_switch_active);
+ my $newAncestorId = ${$_}{ancestorID};
+ my $type;
+ if($naturalAncestors =~ m/$ancestorID/){
+ $type = "natural";
+ } else {
+ $type = "adopted";
+ }
+ my $matched = grep { $_->{ancestorID} eq $newAncestorId } @{${$familyTree{$idToSearch}}{ancestors}};
+ push(@{${$familyTree{$idToSearch}}{ancestors}},{ancestorID=>${$_}{ancestorID},ancestorIndentation=>${$_}{ancestorIndentation},type=>$type}) unless($matched);
}
- }
- }
+ } else {
+ $logger->trace("natural ancestors of $ancestorID: $naturalAncestors") if($is_t_switch_active);
+ foreach(@{${$allChildren{$ancestorID}}{ancestors}}){
+ my $newAncestorId = ${$_}{ancestorID};
+ my $type;
+ if($naturalAncestors =~ m/$newAncestorId/){
+ $type = "natural";
+ } else {
+ $type = "adopted";
+ }
+ my $matched = grep { $_->{ancestorID} eq $newAncestorId } @{${$familyTree{$idToSearch}}{ancestors}};
+ unless($matched){
+ $logger->trace("ancestor of UNHIDDEN child: ${$_}{ancestorID}") if($is_t_switch_active);
+ push(@{${$familyTree{$idToSearch}}{ancestors}},{ancestorID=>${$_}{ancestorID},ancestorIndentation=>${$_}{ancestorIndentation},type=>$type});
+ }
+ }
+ }
+ }
}
}
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/IfElseFi.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/IfElseFi.pm
index 1a0529d3aac..ecceb00fec6 100755
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/IfElseFi.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/IfElseFi.pm
@@ -101,12 +101,17 @@ sub find_ifelsefi{
sub post_indentation_check{
# needed to remove leading horizontal space before \else
my $self = shift;
- if(${$self}{body} =~ m/^\h*\\else/sm
- and
- !(${$self}{body} =~ m/^\h*\\else/s and ${$self}{linebreaksAtEnd}{begin}==0)
- ){
- $logger->trace("*Adding surrounding indentation to \\else statement ('${$self}{surroundingIndentation}')") if $is_t_switch_active;
- ${$self}{body} =~ s/^\h*\\else/${$self}{surroundingIndentation}\\else/sm;
+
+ # loop through \else and \or
+ foreach ({regExp=>qr/\\else/},{regExp=>qr/\\or/}){
+ my %else = %{$_};
+ if(${$self}{body} =~ m/^\h*$else{regExp}/sm
+ and
+ !(${$self}{body} =~ m/^\h*$else{regExp}/s and ${$self}{linebreaksAtEnd}{begin}==0)
+ ){
+ $logger->trace("*Adding surrounding indentation to $else{regExp} statement(s) ('${$self}{surroundingIndentation}')") if $is_t_switch_active;
+ ${$self}{body} =~ s/^\h*($else{regExp})/${$self}{surroundingIndentation}$1/smg;
+ }
}
return;
}
@@ -115,7 +120,32 @@ sub tasks_particular_to_each_object{
my $self = shift;
# check for existence of \else statement, and associated line break information
- $self->check_for_else_statement;
+ $self->check_for_else_statement(
+ # else name regexp
+ elseNameRegExp=>qr|\\else|,
+ # else statements name
+ ElseStartsOnOwnLine=>"ElseStartsOnOwnLine",
+ # end statements
+ ElseFinishesWithLineBreak=>"ElseFinishesWithLineBreak",
+ # for the YAML settings storage
+ storageNameAppend=>"else",
+ # logfile information
+ logName=>"else",
+ );
+
+ # check for existence of \or statement, and associated line break information
+ $self->check_for_else_statement(
+ # else name regexp
+ elseNameRegExp=>qr|\\or|,
+ # else statements name
+ ElseStartsOnOwnLine=>"OrStartsOnOwnLine",
+ # end statements
+ ElseFinishesWithLineBreak=>"OrFinishesWithLineBreak",
+ # for the YAML settings storage
+ storageNameAppend=>"or",
+ # logfile information
+ logName=>"or",
+ );
# search for headings (important to do this before looking for commands!)
$self->find_heading;
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/NamedGroupingBracesBrackets.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/NamedGroupingBracesBrackets.pm
index 22429677894..4508943ddfa 100755
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/NamedGroupingBracesBrackets.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/NamedGroupingBracesBrackets.pm
@@ -39,7 +39,7 @@ sub construct_grouping_braces_brackets_regexp{
\h|\R|\{|\[|\$|\)|\(
)
(
- [0-9a-zA-Z@\*><]+? # lowercase|uppercase letters, @, *, numbers, forward slash, dots
+ [0-9\.a-zA-Z@\*><]+? # lowercase|uppercase letters, @, *, numbers, forward slash, dots
) # $2 name
(\h*) # $3 h-space
(\R*) # $4 linebreaks
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Special.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Special.pm
index 461c620e53f..45dd4c3ec16 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Special.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Special.pm
@@ -130,6 +130,7 @@ sub find_special{
# the regexp
my $specialRegExp = $individualSpecialRegExps{$specialName};
+ $logger->trace("$specialName regexp: \n$specialRegExp") if $is_tt_switch_active ;
while(${$self}{body} =~ m/$specialRegExp(\h*)($trailingCommentRegExp)?/){
@@ -163,7 +164,7 @@ sub find_special{
);
# log file output
- $logger->trace("*Special found: $specialName",'heading') if $is_t_switch_active;
+ $logger->trace("*Special found: $specialName") if $is_t_switch_active;
# the settings and storage of most objects has a lot in common
$self->get_settings_and_store_new_object($specialObject);
@@ -179,16 +180,80 @@ sub find_special{
sub tasks_particular_to_each_object{
my $self = shift;
+ if( defined ${${$masterSettings{specialBeginEnd}}{${$self}{name}}}{middle}){
+ $logger->trace("middle specified for ${$self}{name} (see specialBeginEnd -> ${$self}{name} -> middle)") if $is_t_switch_active ;
+
+ # initiate the middle regexp
+ my $specialMiddle = q();
+
+ # we can specify middle as either an array or a hash
+ if(ref(${${$masterSettings{specialBeginEnd}}{${$self}{name}}}{middle}) eq "ARRAY"){
+ $logger->trace("looping through middle array for ${$self}{name}") if $is_t_switch_active ;
+ foreach(@{${${$masterSettings{specialBeginEnd}}{${$self}{name}}}{middle}}){
+ $specialMiddle .= ($specialMiddle eq ""?q():"|").$_;
+ }
+ $specialMiddle = qr/$specialMiddle/;
+ } else {
+ $specialMiddle = qr/${${$masterSettings{specialBeginEnd}}{${$self}{name}}}{middle}/;
+ }
+
+ $logger->trace("overall middle regexp for ${$self}{name}: $specialMiddle") if $is_t_switch_active ;
+
+ # store the middle regexp for later
+ ${$self}{middleRegExp} = $specialMiddle;
+
+ # check for existence of a 'middle' statement, and associated line break information
+ $self->check_for_else_statement(
+ # else name regexp
+ elseNameRegExp=>$specialMiddle,
+ # else statements name
+ ElseStartsOnOwnLine=>"SpecialMiddleStartsOnOwnLine",
+ # end statements
+ ElseFinishesWithLineBreak=>"SpecialMiddleFinishesWithLineBreak",
+ # for the YAML settings storage
+ storageNameAppend=>"middle",
+ # logfile information
+ logName=>"special middle",
+ );
+
+
+ }
+
return unless(${$masterSettings{specialBeginEnd}}{specialBeforeCommand});
# search for commands with arguments
$self->find_commands_or_key_equals_values_braces;
+
+ # search for arguments
+ $self->find_opt_mand_arguments;
# search for ifElseFi blocks
$self->find_ifelsefi;
}
+sub post_indentation_check{
+ # needed to remove leading horizontal space before \else
+ my $self = shift;
+
+ return unless ( defined ${${$masterSettings{specialBeginEnd}}{${$self}{name}}}{middle});
+
+ $logger->trace("post indentation check for ${$self}{name} to account for middle") if $is_t_switch_active ;
+
+ # loop through \else and \or
+ foreach ({regExp=>${$self}{middleRegExp}}){
+ my %else = %{$_};
+ if(${$self}{body} =~ m/^\h*$else{regExp}/sm
+ and
+ !(${$self}{body} =~ m/^\h*$else{regExp}/s and ${$self}{linebreaksAtEnd}{begin}==0)
+ ){
+ $logger->trace("*Adding surrounding indentation to $else{regExp} statement(s) ('${$self}{surroundingIndentation}')") if $is_t_switch_active;
+ ${$self}{body} =~ s/^\h*($else{regExp})/${$self}{surroundingIndentation}$1/smg;
+ }
+ }
+ return;
+}
+
sub create_unique_id{
my $self = shift;
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm
index 945841208c7..c048b649a66 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm
@@ -19,6 +19,6 @@ use warnings;
use Exporter qw/import/;
our @EXPORT_OK = qw/$versionNumber $versionDate/;
-our $versionNumber = '3.4.1';
-our $versionDate = '2018-01-18';
+our $versionNumber = '3.4.2';
+our $versionDate = '2018-04-27';
1
diff --git a/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml b/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml
index 5f733c2ca23..4fa5eed5cc1 100755
--- a/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml
+++ b/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml
@@ -1,4 +1,4 @@
-# defaultSettings.yaml for latexindent.pl, version 3.4.1, 2018-01-18
+# defaultSettings.yaml for latexindent.pl, version 3.4.2, 2018-04-27
# a script that aims to
# beautify .tex, .sty, .cls files
#
@@ -311,14 +311,18 @@ indentRulesGlobal:
commandCodeBlocks:
roundParenthesesAllowed: 1
stringsAllowedBetweenArguments:
- node: 1
- at: 1
- to: 1
- decoration: 1
- ++: 1
- --: 1
+ -
+ amalgamate: 1
+ - 'node'
+ - 'at'
+ - 'to'
+ - 'decoration'
+ - '\+\+'
+ - '\-\-'
commandNameSpecial:
- @ifnextchar[: 1
+ -
+ amalgamate: 1
+ - '@ifnextchar\['
# modifyLineBreaks will only be searched if the -m
# switch is active
@@ -451,6 +455,8 @@ modifyLineBreaks:
ifElseFi:
IfStartsOnOwnLine: 0
BodyStartsOnOwnLine: 0
+ OrStartsOnOwnLine: 0
+ OrFinishesWithLineBreak: 0
ElseStartsOnOwnLine: 0
ElseFinishesWithLineBreak: 0
FiStartsOnOwnLine: 0
@@ -458,6 +464,8 @@ modifyLineBreaks:
ifnum:
IfStartsOnOwnLine: 0
BodyStartsOnOwnLine: 0
+ OrStartsOnOwnLine: 0
+ OrFinishesWithLineBreak: 0
ElseStartsOnOwnLine: 0
ElseFinishesWithLineBreak: 0
FiStartsOnOwnLine: 0
diff --git a/Master/texmf-dist/scripts/latexindent/latexindent.pl b/Master/texmf-dist/scripts/latexindent/latexindent.pl
index 97f8269ab88..b49b2a009cc 100755
--- a/Master/texmf-dist/scripts/latexindent/latexindent.pl
+++ b/Master/texmf-dist/scripts/latexindent/latexindent.pl
@@ -1,5 +1,5 @@
#!/usr/bin/env perl
-# latexindent.pl, version 3.4.1, 2018-01-18
+# latexindent.pl, version 3.4.2, 2018-04-27
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by