From dfba327ead142f0b6bc2d4cc326dc5accd491b0a Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 6 Nov 2020 21:53:13 +0000 Subject: latexindent (6nov20) git-svn-id: svn://tug.org/texlive/trunk@56869 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/support/latexindent/README | 2 +- .../doc/support/latexindent/appendices.tex | 57 +++++++++++++++++---- .../doc/support/latexindent/latexindent.pdf | Bin 873938 -> 888691 bytes .../doc/support/latexindent/latexindent.tex | 42 +++++++-------- .../support/latexindent/sec-default-user-local.tex | 36 ++++++++++++- .../doc/support/latexindent/sec-how-to-use.tex | 3 +- .../doc/support/latexindent/sec-the-m-switch.tex | 41 +++++++++++---- .../texmf-dist/doc/support/latexindent/title.tex | 2 +- 8 files changed, 137 insertions(+), 46 deletions(-) (limited to 'Master/texmf-dist/doc/support') diff --git a/Master/texmf-dist/doc/support/latexindent/README b/Master/texmf-dist/doc/support/latexindent/README index 24a4de4fc94..05a58a37fa5 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.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. diff --git a/Master/texmf-dist/doc/support/latexindent/appendices.tex b/Master/texmf-dist/doc/support/latexindent/appendices.tex index aa228a9f1a3..e756fb9533f 100644 --- a/Master/texmf-dist/doc/support/latexindent/appendices.tex +++ b/Master/texmf-dist/doc/support/latexindent/appendices.tex @@ -47,15 +47,11 @@ perl latexindent-module-installer.pl \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::Log4perl 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::Log4perl 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 @@ latexindent.pl myfile.tex -outputfile outputfile.tex \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} diff --git a/Master/texmf-dist/doc/support/latexindent/latexindent.pdf b/Master/texmf-dist/doc/support/latexindent/latexindent.pdf index e8ae413aab4..ec8fbfd2696 100644 Binary files a/Master/texmf-dist/doc/support/latexindent/latexindent.pdf and b/Master/texmf-dist/doc/support/latexindent/latexindent.pdf differ diff --git a/Master/texmf-dist/doc/support/latexindent/latexindent.tex b/Master/texmf-dist/doc/support/latexindent/latexindent.tex index 5ecfce6268d..81a00604835 100644 --- a/Master/texmf-dist/doc/support/latexindent/latexindent.tex +++ b/Master/texmf-dist/doc/support/latexindent/latexindent.tex @@ -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, } 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 fc40a70b5e9..2d0498749e9 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 @@ -624,8 +624,9 @@ latexindent.pl tabbing.tex -l=delimiterRegEx3.yaml 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 @@ latexindent.pl special3.tex -l=special-verb1 \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!, 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 172c2ec078c..86ee34a6739 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 @@ -195,7 +195,8 @@ latexindent.pl myfile.tex -l=first.yaml,second.yaml,third.yaml \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}. 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 39d69ceb644..03e09db2598 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 @@ -153,9 +153,7 @@ latexindent.pl -m textwrap4.tex -o textwrap4-mod2.tex -l textwrap2.yaml 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 @@ latexindent.pl -m textwrap4.tex -o=+-mod2B -l textwrap2B.yaml \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 @@ latexindent.pl -m textwrap7.tex -l=textwrap12.yaml -o=+-mod12 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{} can be removed (assuming that \texttt{preserveBlankLines} is set to \texttt{0}); @@ -977,7 +999,7 @@ latexindent.pl -m textwrap7.tex -l=textwrap12.yaml -o=+-mod12 \announce{2019-07-13}{blank line poly-switch}; a blank line will be added before or after the \emph{} under consideration, even if the \emph{} is already on its own line. - \end{itemize} + \end{description} In the above, \emph{} 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 @@ latexindent.pl -m env-mlb.tex -l env-mlb2.yaml \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 @@ latexindent.pl -m env-mlb.tex -l env-mlb2.yaml \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} diff --git a/Master/texmf-dist/doc/support/latexindent/title.tex b/Master/texmf-dist/doc/support/latexindent/title.tex index 3d93349f6ac..444213847f9 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.8.2 + \centering\ttfamily\bfseries latexindent.pl\\[1cm] Version 3.8.3 \end{tcolorbox} } \author{Chris Hughes \thanks{and contributors! -- cgit v1.2.3