texlive[56869] trunk: latexindent (6nov20)

commits+karl at tug.org commits+karl at tug.org
Fri Nov 6 22:53:13 CET 2020


Revision: 56869
          http://tug.org/svn/texlive?view=revision&revision=56869
Author:   karl
Date:     2020-11-06 22:53:13 +0100 (Fri, 06 Nov 2020)
Log Message:
-----------
latexindent (6nov20)

Modified Paths:
--------------
    trunk/Build/source/texk/texlive/linked_scripts/latexindent/latexindent.pl
    trunk/Build/source/texk/texlive/linked_scripts/texlive/mktexlsr
    trunk/Master/bin/win32/latexindent.exe
    trunk/Master/texmf-dist/doc/support/latexindent/README
    trunk/Master/texmf-dist/doc/support/latexindent/appendices.tex
    trunk/Master/texmf-dist/doc/support/latexindent/latexindent.pdf
    trunk/Master/texmf-dist/doc/support/latexindent/latexindent.tex
    trunk/Master/texmf-dist/doc/support/latexindent/sec-default-user-local.tex
    trunk/Master/texmf-dist/doc/support/latexindent/sec-how-to-use.tex
    trunk/Master/texmf-dist/doc/support/latexindent/sec-the-m-switch.tex
    trunk/Master/texmf-dist/doc/support/latexindent/title.tex
    trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/AlignmentAtAmpersand.pm
    trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Arguments.pm
    trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm
    trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Indent.pm
    trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm
    trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/ModifyLineBreaks.pm
    trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm
    trunk/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml
    trunk/Master/texmf-dist/scripts/latexindent/latexindent.pl

Modified: trunk/Build/source/texk/texlive/linked_scripts/latexindent/latexindent.pl
===================================================================
(Binary files differ)

Modified: trunk/Build/source/texk/texlive/linked_scripts/texlive/mktexlsr
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/texlive/mktexlsr	2020-11-06 21:52:45 UTC (rev 56868)
+++ trunk/Build/source/texk/texlive/linked_scripts/texlive/mktexlsr	2020-11-06 21:53:13 UTC (rev 56869)
@@ -10,7 +10,7 @@
 # Originally written as `texhash' by Thomas Esser, Okt., 1994.
 # Public domain.
 
-version='$Id: mktexlsr 53254 2019-12-29 19:18:55Z karl $'
+version='$Id: mktexlsr 56842 2020-11-02 23:00:54Z karl $'
 progname=`echo $0 | sed 's%.*/%%'`
 
 usage="Usage: $progname [OPTION]... [DIR]...
@@ -69,7 +69,7 @@
       export PATH ;;
 esac
 
-if tty -s; then verbose=true; else verbose=false; fi
+if tty -s >/dev/null 2>&1; then verbose=true; else verbose=false; fi
 dry_run=false
 trees=
 

Modified: trunk/Master/bin/win32/latexindent.exe
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/support/latexindent/README
===================================================================
--- trunk/Master/texmf-dist/doc/support/latexindent/README	2020-11-06 21:52:45 UTC (rev 56868)
+++ trunk/Master/texmf-dist/doc/support/latexindent/README	2020-11-06 21:53:13 UTC (rev 56869)
@@ -1,5 +1,5 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-    latexindent.pl, version 3.8.2, 2020-06-10
+    latexindent.pl, version 3.8.3, 2020-11-06
 
     PERL script to indent code within environments, and align delimited 
     environments in .tex files.

Modified: trunk/Master/texmf-dist/doc/support/latexindent/appendices.tex
===================================================================
--- trunk/Master/texmf-dist/doc/support/latexindent/appendices.tex	2020-11-06 21:52:45 UTC (rev 56868)
+++ trunk/Master/texmf-dist/doc/support/latexindent/appendices.tex	2020-11-06 21:53:13 UTC (rev 56869)
@@ -47,15 +47,11 @@
 
 	\subsection{Manually installed modules}\label{sec:manual-module-instal}
 		Manually installing the modules given in \cref{lst:helloworld} will vary depending on
-		your operating system and \texttt{Perl} distribution. For example, Ubuntu users
-		might visit the software center, or else run
-		\begin{commandshell}
-sudo perl -MCPAN -e 'install "File::HomeDir"'
-\end{commandshell}
+		your operating system and \texttt{Perl} distribution.
 
-		Linux users may be interested in exploring Perlbrew \cite{perlbrew}; possible
-		installation and setup options follow for Ubuntu (other distributions will need slightly
-		different commands).
+	\subsubsection{Linux}
+		Linux users may be interested in exploring Perlbrew \cite{perlbrew}; an example
+		installation would be:
 		\begin{commandshell}
 sudo apt-get install perlbrew
 perlbrew init
@@ -70,6 +66,44 @@
 cpanm Log::Dispatch
 \end{commandshell}
 
+		For other distributions, the Ubuntu/Debian approach may work by visiting the software
+		center, or else by running, for example,
+		\begin{commandshell}
+sudo perl -MCPAN -e'install "File::HomeDir"'
+\end{commandshell}
+
+		If you are using Alpine, some \texttt{Perl} modules are not build-compatible
+		with Alpine, but replacements are available through \texttt{apk}. For example,
+		you might use the commands given in \cref{lst:alpine-install}; thanks to
+		\cite{jun-sheaf} for providing these details.
+
+		\begin{cmhlistings}[style=tcblatex,language=Bash]{\texttt{alpine-install.sh}}{lst:alpine-install}
+# Installing perl
+apk --no-cache add miniperl perl-utils
+
+# Installing incompatible latexindent perl dependencies via apk
+apk --no-cache add \
+    perl-log-log4perl \
+    perl-log-dispatch \
+    perl-namespace-autoclean \
+    perl-specio \
+    perl-unicode-linebreak
+
+# Installing remaining latexindent perl dependencies via cpan
+apk --no-cache add curl wget make
+ls /usr/share/texmf-dist/scripts/latexindent
+cd /usr/local/bin && \
+    curl -L https://cpanmin.us/ -o cpanm && \
+    chmod +x cpanm
+cpanm -n App::cpanminus
+cpanm -n File::HomeDir
+cpanm -n Params::ValidationCompiler
+cpanm -n YAML::Tiny
+cpanm -n Unicode::GCString
+\end{cmhlistings}
+
+		Users of NixOS might like to see \href{https://github.com/cmhughes/latexindent.pl/issues/222}{https://github.com/cmhughes/latexindent.pl/issues/222} for tips.
+	\subsubsection{Mac}
 		Users of the Macintosh operating system might like to explore the following commands, for
 		example:
 		\begin{commandshell}
@@ -83,6 +117,7 @@
 cpanm Log::Dispatch
 \end{commandshell}
 
+	\subsubsection{Windows}
 		Strawberry Perl users on Windows might use \texttt{CPAN client}. All of the modules are
 		readily available on CPAN \cite{cpan}.
 
@@ -225,9 +260,9 @@
 		 \cmhlistingsfromfile{demonstrations/indentAfterThisHeadingNew.yaml}[yaml-TCB]{\texttt{indentAfterThisHeading} in Version 3.0}{lst:indentAfterThisHeadingNew}
 	 \end{minipage}%
 
-	 To specify \texttt{noAdditionalIndent} for display-math environments in Version 2.2, you would
-	 write YAML as in \cref{lst:noAdditionalIndentOld}; as of Version 3.0, you would write YAML as in
-	 \cref{lst:indentAfterThisHeadingNew1} or, if you're using \texttt{-m} switch,
+	 To specify \texttt{noAdditionalIndent} for display-math environments in Version 2.2, you
+	 would write YAML as in \cref{lst:noAdditionalIndentOld}; as of Version 3.0, you would write YAML
+	 as in \cref{lst:indentAfterThisHeadingNew1} or, if you're using \texttt{-m} switch,
 	 \cref{lst:indentAfterThisHeadingNew2}.
 
 	 \begin{minipage}{.45\textwidth}

Modified: trunk/Master/texmf-dist/doc/support/latexindent/latexindent.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/support/latexindent/latexindent.tex
===================================================================
--- trunk/Master/texmf-dist/doc/support/latexindent/latexindent.tex	2020-11-06 21:52:45 UTC (rev 56868)
+++ trunk/Master/texmf-dist/doc/support/latexindent/latexindent.tex	2020-11-06 21:53:13 UTC (rev 56869)
@@ -368,127 +368,127 @@
 
 \lstdefinestyle{indentAfterItems}{
 	style=yaml-LST,
-	firstnumber=191,linerange={191-195},
+	firstnumber=221,linerange={221-225},
 	numbers=left,
 }
 
 \lstdefinestyle{itemNames}{
 	style=yaml-LST,
-	firstnumber=201,linerange={201-203},
+	firstnumber=231,linerange={231-233},
 	numbers=left,
 }
 
 \lstdefinestyle{specialBeginEnd}{
 	style=yaml-LST,
-	firstnumber=207,linerange={207-220},
+	firstnumber=237,linerange={237-250},
 	numbers=left,
 }
 
 \lstdefinestyle{indentAfterHeadings}{
 	style=yaml-LST,
-	firstnumber=230,linerange={230-239},
+	firstnumber=260,linerange={260-269},
 	numbers=left,
 }
 
 \lstdefinestyle{noAdditionalIndentGlobalEnv}{
 	style=yaml-LST,
-	firstnumber=288,linerange={288-289},
+	firstnumber=318,linerange={318-319},
 	numbers=left,
 }
 
 \lstdefinestyle{noAdditionalIndentGlobal}{
 	style=yaml-LST,
-	firstnumber=288,linerange={288-300},
+	firstnumber=318,linerange={318-330},
 	numbers=left,
 }
 
 \lstdefinestyle{indentRulesGlobalEnv}{
 	style=yaml-LST,
-	firstnumber=304,linerange={304-305},
+	firstnumber=334,linerange={334-335},
 	numbers=left,
 }
 
 \lstdefinestyle{indentRulesGlobal}{
 	style=yaml-LST,
-	firstnumber=304,linerange={304-316},
+	firstnumber=334,linerange={334-346},
 	numbers=left,
 }
 
 \lstdefinestyle{commandCodeBlocks}{
 	style=yaml-LST,
-	firstnumber=319,linerange={319-333},
+	firstnumber=349,linerange={349-363},
 	numbers=left,
 }
 
 \lstdefinestyle{modifylinebreaks}{
 	style=yaml-LST,
-	firstnumber=445,linerange={445-447},
+	firstnumber=475,linerange={475-477},
 	numbers=left,
 }
 
 \lstdefinestyle{textWrapOptions}{
 	style=yaml-LST,
-	firstnumber=472,linerange={472-473},
+	firstnumber=502,linerange={502-503},
 	numbers=left,
 }
 
 \lstdefinestyle{textWrapOptionsAll}{
 	style=yaml-LST,
-	firstnumber=472,linerange={472-488},
+	firstnumber=502,linerange={502-518},
 	numbers=left,
 }
 
 \lstdefinestyle{removeParagraphLineBreaks}{
 	style=yaml-LST,
-	firstnumber=489,linerange={489-503},
+	firstnumber=519,linerange={519-533},
 	numbers=left,
 }
 
 \lstdefinestyle{paragraphsStopAt}{
 	style=yaml-LST,
-	firstnumber=504,linerange={504-513},
+	firstnumber=534,linerange={534-543},
 	numbers=left,
 }
 
 \lstdefinestyle{oneSentencePerLine}{
 	style=yaml-LST,
-	firstnumber=448,linerange={448-471},
+	firstnumber=478,linerange={478-501},
 	numbers=left,
 }
 
 \lstdefinestyle{sentencesFollow}{
 	style=yaml-LST,
-	firstnumber=453,linerange={453-461},
+	firstnumber=483,linerange={483-491},
 	numbers=left,
 }
 
 \lstdefinestyle{sentencesBeginWith}{
 	style=yaml-LST,
-	firstnumber=462,linerange={462-465},
+	firstnumber=492,linerange={492-495},
 	numbers=left,
 }
 
 \lstdefinestyle{sentencesEndWith}{
 	style=yaml-LST,
-	firstnumber=466,linerange={466-471},
+	firstnumber=496,linerange={496-501},
 	numbers=left,
 }
 
 \lstdefinestyle{modifylinebreaksEnv}{
 	style=yaml-LST,
-	firstnumber=514,linerange={514-523},
+	firstnumber=544,linerange={544-553},
 	numbers=left,
 }
 
 \lstdefinestyle{replacements}{
 	style=yaml-LST,
-	firstnumber=575,linerange={575-583},
+	firstnumber=605,linerange={605-613},
 	numbers=left,
 }
 
 \lstdefinestyle{fineTuning}{
 	style=yaml-LST,
-	firstnumber=586,linerange={586-607},
+	firstnumber=616,linerange={616-637},
 	numbers=left,
 }
 

Modified: trunk/Master/texmf-dist/doc/support/latexindent/sec-default-user-local.tex
===================================================================
--- trunk/Master/texmf-dist/doc/support/latexindent/sec-default-user-local.tex	2020-11-06 21:52:45 UTC (rev 56868)
+++ trunk/Master/texmf-dist/doc/support/latexindent/sec-default-user-local.tex	2020-11-06 21:53:13 UTC (rev 56869)
@@ -624,8 +624,9 @@
 
 	It is possible that delimiters specified within \texttt{delimiterRegEx} can be of
 	different lengths. Consider the file in \cref{lst:tabbing1}, and associated YAML in
-	\cref{lst:delimiterRegEx4}. Note that the			  \cref{lst:delimiterRegEx4}
-	specifies the option for the delimiter to be either \lstinline!#! or
+	\cref{lst:delimiterRegEx4}. Note that the \cref{lst:delimiterRegEx4} specifies the option for
+	the delimiter to be either
+	\lstinline!#! or
 	\lstinline!\>!, \emph{which are different lengths}. Upon running the command
 	\begin{commandshell}
 latexindent.pl tabbing1.tex -l=delimiterRegEx4.yaml -o=+-mod4
@@ -805,6 +806,37 @@
 		\cmhlistingsfromfile{demonstrations/special3-mod1.tex}{\texttt{special3.tex} and output using \cref{lst:special-verb1-yaml}}{lst:special3-mod1}
 	\end{cmhtcbraster}
 
+	We can combine the \texttt{specialBeginEnd} with the \texttt{lookForAlignDelims} feature. We
+	begin with the code in \cref{lst:special-align}.
+
+	\cmhlistingsfromfile*{demonstrations/special-align.tex}{\texttt{special-align.tex}}{lst:special-align}
+
+	Let's assume that our goal is to align the code at the \texttt{edge} and
+	\texttt{node} text; we employ the code given in \cref{lst:edge-node1} and run
+	the command
+	\begin{commandshell}
+latexindent.pl special-align.tex -l edge-node1.yaml -o=+-mod1
+\end{commandshell}
+	to receive the output in \cref{lst:special-align-mod1}.
+
+	\begin{cmhtcbraster}[ raster left skip=-3.5cm,]
+		\cmhlistingsfromfile*{demonstrations/edge-node1.yaml}[yaml-TCB]{\texttt{edge-node1.yaml}}{lst:edge-node1}
+		\cmhlistingsfromfile*{demonstrations/special-align-mod1.tex}{\texttt{special-align.tex} using \cref{lst:edge-node1}}{lst:special-align-mod1}
+	\end{cmhtcbraster}
+
+	The output in \cref{lst:special-align-mod1} is not quite ideal. We can tweak the settings
+	within \cref{lst:edge-node1} in order to improve the output; in particular, we employ
+	the code in \cref{lst:edge-node2} and run the command
+	\begin{commandshell}
+latexindent.pl special-align.tex -l edge-node2.yaml -o=+-mod2
+\end{commandshell}
+	to receive the output in \cref{lst:special-align-mod2}.
+
+	\begin{cmhtcbraster}[ raster left skip=-3.5cm,]
+		\cmhlistingsfromfile*{demonstrations/edge-node2.yaml}[yaml-TCB]{\texttt{edge-node2.yaml}}{lst:edge-node2}
+		\cmhlistingsfromfile*{demonstrations/special-align-mod2.tex}{\texttt{special-align.tex} using \cref{lst:edge-node2}}{lst:special-align-mod2}
+	\end{cmhtcbraster}
+
 \yamltitle{indentAfterHeadings}*{fields}
 	This field enables the user to specify indentation rules that take effect after heading
 	commands such as \lstinline!\part!, \lstinline!\chapter!,

Modified: trunk/Master/texmf-dist/doc/support/latexindent/sec-how-to-use.tex
===================================================================
--- trunk/Master/texmf-dist/doc/support/latexindent/sec-how-to-use.tex	2020-11-06 21:52:45 UTC (rev 56868)
+++ trunk/Master/texmf-dist/doc/support/latexindent/sec-how-to-use.tex	2020-11-06 21:53:13 UTC (rev 56869)
@@ -195,7 +195,8 @@
 	\label{page:localswitch}
 	\texttt{latexindent.pl} will always load \texttt{defaultSettings.yaml} (rhymes with camel)
 	and if it is called with the \texttt{-l} switch and it finds
-	\texttt{localSettings.yaml} in the same directory as \texttt{myfile.tex} then these
+	\texttt{localSettings.yaml} in the same directory as \texttt{myfile.tex}, then, if not
+	found, it looks for \texttt{localSettings.yaml} in the current working directory, then these
 	settings will be added to the indentation scheme. Information will be given in
 	\texttt{indent.log} on the success or failure of loading \texttt{localSettings.yaml}.
 

Modified: trunk/Master/texmf-dist/doc/support/latexindent/sec-the-m-switch.tex
===================================================================
--- trunk/Master/texmf-dist/doc/support/latexindent/sec-the-m-switch.tex	2020-11-06 21:52:45 UTC (rev 56868)
+++ trunk/Master/texmf-dist/doc/support/latexindent/sec-the-m-switch.tex	2020-11-06 21:53:13 UTC (rev 56869)
@@ -153,9 +153,7 @@
 latexindent.pl -m textwrap4.tex -o=+-mod2A -l textwrap2A.yaml
 latexindent.pl -m textwrap4.tex -o=+-mod2B -l textwrap2B.yaml
 \end{commandshell}
-	gives the respective output in \cref{lst:textwrap4-mod2A,lst:textwrap4-mod2B}. You can also specify
-	\texttt{break} in your settings, but I haven't found a useful reason to do
-	this; see \cite{textwrap} for more details.
+	gives the respective output in \cref{lst:textwrap4-mod2A,lst:textwrap4-mod2B}.
 
 	\begin{cmhtcbraster}[raster column skip=.1\linewidth]
 		\cmhlistingsfromfile{demonstrations/textwrap4-mod2A.tex}{\texttt{textwrap4-mod2A.tex}}{lst:textwrap4-mod2A}
@@ -165,6 +163,30 @@
 		\cmhlistingsfromfile{demonstrations/textwrap2B.yaml}[MLB-TCB]{\texttt{textwrap2B.yaml}}{lst:textwrap2B-yaml}
 	\end{cmhtcbraster}
 
+	You can also specify the \texttt{tabstop} field%
+	\announce*{2020-11-06}{tabstop option for text wrap module} as
+	an integer value, which is passed to the text wrap module; see
+	\cite{textwrap} for details. Starting with the code in
+	\cref{lst:textwrap-ts} with settings in \cref{lst:tabstop}, and running the
+	command
+	\begin{commandshell}
+latexindent.pl -m textwrap-ts.tex -o=+-mod1 -l tabstop.yaml
+\end{commandshell}
+	gives the code given in \cref{lst:textwrap-ts-mod1}.
+	\begin{cmhtcbraster}[raster columns=3,
+			raster left skip=-3.5cm,
+			raster right skip=-2cm,
+			raster column skip=.03\linewidth]
+		\cmhlistingsfromfile*[showtabs=true]*{demonstrations/textwrap-ts.tex}{\texttt{textwrap-ts.tex}}{lst:textwrap-ts}
+		\cmhlistingsfromfile*{demonstrations/tabstop.yaml}[MLB-TCB]{\texttt{tabstop.yaml}}{lst:tabstop}
+		\cmhlistingsfromfile*[showtabs=true]*{demonstrations/textwrap-ts-mod1.tex}{\texttt{textwrap-ts-mod1.tex}}{lst:textwrap-ts-mod1}
+	\end{cmhtcbraster}
+
+	You can specify \texttt{break} and \texttt{unexpand} options in
+	your settings in analogous ways to those demonstrated in \cref{lst:textwrap2B-yaml,lst:tabstop}, and
+	they will be passed to the \texttt{Text::Wrap} module. I have not found a useful
+	reason to do this; see \cite{textwrap} for more details.
+
 \subsubsection{text wrapping on a per-code-block basis}
 	By default, if the value of \texttt{columns} is greater than 0 and the
 	\texttt{-m} switch is active, then%
@@ -956,7 +978,7 @@
 	Every other field in the \texttt{modifyLineBreaks} field uses poly-switches, and can
 	take one of the following%
 	\announce{2017-08-21}*{blank line poly-switch} integer values:
-	\begin{itemize}[font=\bfseries]
+	\begin{description}
 		\item[$-1$] \emph{remove mode}: line breaks before or after the
 		      \emph{<part of thing>} can be removed (assuming that \texttt{preserveBlankLines} is
 		      set to \texttt{0});
@@ -977,7 +999,7 @@
 		      \announce{2019-07-13}{blank line poly-switch}; a blank line will
 		      be added before or after the \emph{<part of thing>} under consideration, even if the
 		      \emph{<part of thing>} is already on its own line.
-	\end{itemize}
+	\end{description}
 	In the above, \emph{<part of thing>} refers to either the
 	\emph{begin statement}, \emph{body} or \emph{end statement}
 	of the code blocks detailed in \vref{tab:code-blocks}. All poly-switches are
@@ -1104,9 +1126,9 @@
 	\emph{blank line} has been added after adding the line break.
 
 	Let's now change%
-	\announce{2019-07-13}{demonstration of new blank line poly-switch} each of
-	the \texttt{1} values in \cref{lst:env-mlb5,lst:env-mlb6} so that they are
-	$4$ and save them into \texttt{env-beg4.yaml} and
+	\announce{2019-07-13}{demonstration of new blank line poly-switch} each
+	of the \texttt{1} values in \cref{lst:env-mlb5,lst:env-mlb6} so that they
+	are $4$ and save them into \texttt{env-beg4.yaml} and
 	\texttt{env-body4.yaml} respectively (see \cref{lst:env-beg4,lst:env-body4}).
 
 	\begin{minipage}{.45\textwidth}
@@ -1117,7 +1139,8 @@
 		\cmhlistingsfromfile[style=yaml-LST]*{demonstrations/env-body4.yaml}[MLB-TCB]{\texttt{env-body4.yaml}}{lst:env-body4}
 	\end{minipage}
 
-	We will demonstrate this poly-switch value using the code in \cref{lst:env-mlb1-text}.
+	We will demonstrate this poly-switch value using the code in
+	\cref{lst:env-mlb1-text}.
 
 	\cmhlistingsfromfile{demonstrations/env-mlb1.tex}{\texttt{env-mlb1.tex}}{lst:env-mlb1-text}
 

Modified: trunk/Master/texmf-dist/doc/support/latexindent/title.tex
===================================================================
--- trunk/Master/texmf-dist/doc/support/latexindent/title.tex	2020-11-06 21:52:45 UTC (rev 56868)
+++ trunk/Master/texmf-dist/doc/support/latexindent/title.tex	2020-11-06 21:53:13 UTC (rev 56869)
@@ -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.8.2
+		\centering\ttfamily\bfseries latexindent.pl\\[1cm] Version 3.8.3
 	\end{tcolorbox}
 }
 \author{Chris Hughes \thanks{and contributors!

Modified: trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/AlignmentAtAmpersand.pm
===================================================================
--- trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/AlignmentAtAmpersand.pm	2020-11-06 21:52:45 UTC (rev 56868)
+++ trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/AlignmentAtAmpersand.pm	2020-11-06 21:53:13 UTC (rev 56869)
@@ -400,6 +400,36 @@
     # if the \end{} statement didn't originally have a line break before it, we need to remove the final 
     # line break added by the above
     ${$self}{body} =~ s/\h*\R$//s if !${$self}{linebreaksAtEnd}{body};
+
+    # if the \begin{} statement doesn't finish with a line break, then we adjust the indentation
+    # to be the length of the begin statement.
+    #
+    # example:
+    #
+    #       \begin{align*}1&2\\
+    #         3&4\\
+    #         5 &    6
+    #       \end{align*}
+    #
+    # goes to
+    #
+    #       \begin{align*}1 & 2 \\
+    #                     3 & 4 \\
+    #                     5 & 6
+    #       \end{align*}
+    #
+    # see https://github.com/cmhughes/latexindent.pl/issues/223 for example
+    if (!${${$self}{linebreaksAtEnd}}{begin} 
+            and ${$cellStorage[0][0]}{type} eq "X" 
+            and ${$cellStorage[0][0]}{measureThis}){
+
+        my $partToMeasure = ${$self}{begin};
+        if( (${$self}{begin} eq '{' | ${$self}{begin} eq '[') and ${$self}{parentBegin}){
+            $partToMeasure = ${$self}{parentBegin}."{";
+        }
+        ${$self}{indentation} = " " x Unicode::GCString->new($partToMeasure)->columns();
+        $logger->trace("Adjusting indentation of ${$self}{name} in AlignAtAmpersand routine") if($is_t_switch_active);
+    }
   }
 
 sub main_formatting {

Modified: trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Arguments.pm
===================================================================
--- trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Arguments.pm	2020-11-06 21:52:45 UTC (rev 56868)
+++ trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Arguments.pm	2020-11-06 21:53:13 UTC (rev 56869)
@@ -118,6 +118,15 @@
                 $arguments->find_round_brackets;
         }
 
+        # we need to store the parent begin in each of the arguments, for example, see
+        #   test-cases/texexchange/112343-morbusg.tex
+        # which has an alignment delimiter in the first line
+        if (${$self}{lookForAlignDelims}){
+            foreach (@{${$arguments}{children}}){
+                ${$_}{parentBegin} = ${$self}{begin};
+            }
+        }
+
         # examine *first* child
         #   situation: parent BodyStartsOnOwnLine >= 1, but first child has BeginStartsOnOwnLine == 0 || BeginStartsOnOwnLine == undef
         #   problem: the *body* of parent actually starts after the arguments

Modified: trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm
===================================================================
--- trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm	2020-11-06 21:52:45 UTC (rev 56868)
+++ trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm	2020-11-06 21:53:13 UTC (rev 56869)
@@ -20,6 +20,7 @@
 use YAML::Tiny;                # interpret defaultSettings.yaml and other potential settings files
 use File::Basename;            # to get the filename and directory path
 use File::HomeDir;
+use Cwd;
 use Log::Log4perl qw(get_logger :levels);
 use Exporter qw/import/;
 our @EXPORT_OK = qw/yaml_read_settings yaml_modify_line_breaks_settings yaml_get_indentation_settings_for_this_object yaml_poly_switch_get_every_or_custom_value yaml_get_indentation_information yaml_get_object_attribute_for_indentation_settings yaml_alignment_at_ampersand_settings yaml_get_textwrap_removeparagraphline_breaks %masterSettings yaml_get_columns/;
@@ -169,6 +170,7 @@
     push(@localSettings,$switches{readLocalSettings}) if($switches{readLocalSettings});
   }
 
+  my $workingFileLocation = dirname (${$self}{fileName});
   # add local settings to the paths, if appropriate
   foreach (@localSettings) {
     # check for an extension (.yaml)
@@ -180,8 +182,14 @@
     # if the -l switch is called on its own, or else with +
     # and latexindent.pl is called from a different directory, then
     # we need to account for this
-    if($_ eq "localSettings.yaml"){
-        $_ = dirname (${$self}{fileName})."/".$_;
+    if($_ eq "localSettings.yaml" ){
+        # check for existence in the directory of the file.
+        if ( (-e $workingFileLocation."/".$_) ) {
+            $_ = $workingFileLocation."/".$_;
+        # otherwise we fallback to the current directory
+    	} elsif( (-e cwd()."/".$_) ){
+            $_ = cwd()."/".$_;
+        }
     }
 
     # check for existence and non-emptiness

Modified: trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Indent.pm
===================================================================
--- trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Indent.pm	2020-11-06 21:52:45 UTC (rev 56868)
+++ trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Indent.pm	2020-11-06 21:53:13 UTC (rev 56869)
@@ -108,9 +108,6 @@
 sub indent_body{
     my $self = shift;
 
-    # grab the indentation of the object
-    my $indentation = ${$self}{indentation};
-
     # output to the logfile
     $logger->trace("Body (${$self}{name}) before indentation:\n${$self}{body}") if $is_tt_switch_active;
 
@@ -123,6 +120,11 @@
     # some objects can format their body to align at the & character
     $self->align_at_ampersand if ${$self}{lookForAlignDelims};
 
+    # grab the indentation of the object
+    # NOTE: we need this here, as ${$self}{indentation} can be updated by the align_at_ampersand routine, 
+    #       see https://github.com/cmhughes/latexindent.pl/issues/223 for example
+    my $indentation = ${$self}{indentation};
+
     # possibly remove paragraph line breaks
     $self->remove_paragraph_line_breaks if ($is_m_switch_active and ${$self}{removeParagraphLineBreaks} and !${$masterSettings{modifyLineBreaks}{removeParagraphLineBreaks}}{beforeTextWrap});
 

Modified: trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm
===================================================================
--- trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm	2020-11-06 21:52:45 UTC (rev 56868)
+++ trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm	2020-11-06 21:53:13 UTC (rev 56869)
@@ -62,8 +62,9 @@
       -t, --trace
           tracing mode: verbose information given to the log file
       -l, --local[=myyaml.yaml]
-          use localSettings.yaml (assuming it exists in the directory of your file);
-          alternatively, use myyaml.yaml, if it exists; sample usage:
+          use localSettings.yaml (assuming it exists in the directory of your file, 
+          or in the current working directory); alternatively, use myyaml.yaml, if it exists; 
+          sample usage:
                 latexindent.pl -l some.yaml myfile.tex 
                 latexindent.pl -l=another.yaml myfile.tex 
                 latexindent.pl -l=some.yaml,another.yaml myfile.tex 

Modified: trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/ModifyLineBreaks.pm
===================================================================
--- trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/ModifyLineBreaks.pm	2020-11-06 21:52:45 UTC (rev 56868)
+++ trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/ModifyLineBreaks.pm	2020-11-06 21:53:13 UTC (rev 56869)
@@ -168,7 +168,7 @@
 
         # possibly modify line break *after* \end{statement}
         if(defined $_ and $_>=1 
-           and !${$self}{linebreaksAtEnd}{end}){
+           and !${$self}{linebreaksAtEnd}{end} and ${$self}{end} ne ''){
                   # if the <end> statement doesn't finish with a line break, 
                   # then we have different actions based upon the value of EndFinishesWithLineBreak:
                   #     EndFinishesWithLineBreak == 1 just add a new line
@@ -187,7 +187,7 @@
                       $logger->trace("Even though $EndStringLogFile == 2, ${$self}{end} is immediately followed by a %, so not adding another; not adding line break.") if $is_t_switch_active;
                     } else {
                       # otherwise, create a trailing comment, and tack it on 
-                      $logger->trace("Adding a % immediately after, ${$self}{end} ($EndStringLogFile==2)") if $is_t_switch_active;
+                      $logger->trace("Adding a % immediately after ${$self}{end} ($EndStringLogFile==2)") if $is_t_switch_active;
                       my $trailingCommentToken = "%".$self->add_comment_symbol;
                       ${$self}{end} =~ s/\h*$//s;
                       ${$self}{replacementText} .= "$trailingCommentToken\n";
@@ -312,6 +312,8 @@
     }
     $Text::Wrap::huge = ${$masterSettings{modifyLineBreaks}{textWrapOptions}}{huge} if ${$masterSettings{modifyLineBreaks}{textWrapOptions}}{huge};
     $Text::Wrap::break = ${$masterSettings{modifyLineBreaks}{textWrapOptions}}{break} if ${$masterSettings{modifyLineBreaks}{textWrapOptions}}{break};
+    $Text::Wrap::unexpand = ${$masterSettings{modifyLineBreaks}{textWrapOptions}}{unexpand} if ${$masterSettings{modifyLineBreaks}{textWrapOptions}}{unexpand};
+    $Text::Wrap::tabstop = ${$masterSettings{modifyLineBreaks}{textWrapOptions}}{tabstop} if ${$masterSettings{modifyLineBreaks}{textWrapOptions}}{tabstop};
     ${$self}{body} = wrap('','',${$self}{body});
 }
 

Modified: trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm
===================================================================
--- trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm	2020-11-06 21:52:45 UTC (rev 56868)
+++ trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm	2020-11-06 21:53:13 UTC (rev 56869)
@@ -19,6 +19,6 @@
 use Exporter qw/import/;
 our @EXPORT_OK = qw/$versionNumber $versionDate/;
 
-our $versionNumber = '3.8.2';
-our $versionDate = '2020-06-10';
+our $versionNumber = '3.8.3';
+our $versionDate = '2020-11-06';
 1

Modified: trunk/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml
===================================================================
--- trunk/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml	2020-11-06 21:52:45 UTC (rev 56868)
+++ trunk/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml	2020-11-06 21:53:13 UTC (rev 56869)
@@ -1,4 +1,4 @@
-# defaultSettings.yaml for latexindent.pl, version 3.8.2, 2020-06-10
+# defaultSettings.yaml for latexindent.pl, version 3.8.3, 2020-11-06
 #                      a script that aims to
 #                      beautify .tex, .sty, .cls files
 #
@@ -165,19 +165,49 @@
    tabu: 1
    array: 1
    matrix: 1
-   bmatrix: 1
-   Bmatrix: 1
-   pmatrix: 1
-   vmatrix: 1
-   Vmatrix: 1
+   listabla: 1
+   # amsmath
    align: 1
    align*: 1
    alignat: 1
    alignat*: 1
    aligned: 1
+   bmatrix: 1
+   Bmatrix: 1
    cases: 1
+   flalign: 1
+   flalign*: 1
+   pmatrix: 1
+   vmatrix: 1
+   Vmatrix: 1
+   # mathtools
+   cases*: 1
    dcases: 1
-   listabla: 1
+   dcases*: 1
+   rcases: 1
+   rcases*: 1
+   drcases: 1
+   drcases*: 1
+   # nicematrix
+   NiceMatrix: 1
+   pNiceMatrix: 1
+   bNiceMatrix: 1
+   BNiceMatrix: 1
+   vNiceMatrix: 1
+   VNiceMatrix: 1
+   NiceArray: 1
+   pNiceArrayC: 1
+   bNiceArrayC: 1
+   BNiceArrayC: 1
+   vNiceArrayC: 1
+   VNiceArrayC: 1
+   NiceArrayCwithDelims: 1
+   pNiceArrayRC: 1
+   bNiceArrayRC: 1
+   BNiceArrayRC: 1
+   vNiceArrayRC: 1
+   VNiceArrayRC: 1
+   NiceArrayRCwithDelims: 1
 
 # if you want the script to look for \item commands 
 # and format it, as follows (for example),

Modified: trunk/Master/texmf-dist/scripts/latexindent/latexindent.pl
===================================================================
(Binary files differ)



More information about the tex-live-commits mailing list.