diff options
author | Karl Berry <karl@freefriends.org> | 2022-06-05 21:03:30 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-06-05 21:03:30 +0000 |
commit | 6508d94a133775c00a40256e3b31a49ece9abeec (patch) | |
tree | c6ec0f928c855f23bcbab513aaa34e424c832d51 /Master/texmf-dist | |
parent | 80aa3b5de37b11d9f895cf844adcd9bb8fc127d2 (diff) |
latexindent (5jun22)
git-svn-id: svn://tug.org/texlive/trunk@63492 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
14 files changed, 183 insertions, 29 deletions
diff --git a/Master/texmf-dist/doc/support/latexindent/README b/Master/texmf-dist/doc/support/latexindent/README index 6ea4b951d14..9a6c7d27185 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.17.2, 2022-04-14 + latexindent.pl, version 3.17.3, 2022-06-05 PERL script to indent code within environments, and align delimited environments in .tex files. diff --git a/Master/texmf-dist/doc/support/latexindent/latexindent-yaml-schema.json b/Master/texmf-dist/doc/support/latexindent/latexindent-yaml-schema.json index 8b5378679c0..47b70ecf994 100644 --- a/Master/texmf-dist/doc/support/latexindent/latexindent-yaml-schema.json +++ b/Master/texmf-dist/doc/support/latexindent/latexindent-yaml-schema.json @@ -2,7 +2,7 @@ "$schema": "http://json-schema.org/schema", "$id": "latexindent-yaml-schema.json", "title": "latexindent.pl YAML schema", - "description": "latexindent.pl YAML schema helper, V3.17.2 2022-04-14", + "description": "latexindent.pl YAML schema helper, V3.17.3 2022-06-05", "type": "object", "properties": { "fileExtensionPreference": { diff --git a/Master/texmf-dist/doc/support/latexindent/latexindent.pdf b/Master/texmf-dist/doc/support/latexindent/latexindent.pdf Binary files differindex 86b5f93d0b4..323e4716d27 100644 --- a/Master/texmf-dist/doc/support/latexindent/latexindent.pdf +++ b/Master/texmf-dist/doc/support/latexindent/latexindent.pdf diff --git a/Master/texmf-dist/doc/support/latexindent/sec-appendices.tex b/Master/texmf-dist/doc/support/latexindent/sec-appendices.tex index ca4608a2592..03a2961cc6f 100644 --- a/Master/texmf-dist/doc/support/latexindent/sec-appendices.tex +++ b/Master/texmf-dist/doc/support/latexindent/sec-appendices.tex @@ -2,10 +2,16 @@ \appendix \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}. + standalone executable files (\texttt{latexindent.exe} is available for Windows users + without Perl, see \cref{subsubsec:latexindent:exe}), then you will need a few standard + Perl modules. + + If you can run the minimum code in \cref{lst:helloworld} as in + \begin{commandshell} +perl helloworld.pl + \end{commandshell} + 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}. \begin{cmhlistings}[style=tcblatex,language=Perl]{\texttt{helloworld.pl}}{lst:helloworld} #!/usr/bin/perl @@ -137,6 +143,10 @@ brew install cpanm cpanm YAML::Tiny cpanm File::HomeDir \end{commandshell} + Alternatively, + \begin{commandshell} +brew install latexindent +\end{commandshell} \subsubsection{Windows} Strawberry Perl users on Windows might use \texttt{CPAN client}. All of the modules are @@ -595,8 +605,8 @@ latexindent.pl -y="dos2unixlinebreaks:1" myfile.tex \section{Differences from Version 2.2 to 3.0}\label{app:differences} There are a few (small) changes to the interface when comparing Version 2.2 to Version - 3.0. Explicitly, in previous versions you might have run, for example, - \index{switches!-o demonstration} + 3.0. Explicitly, in previous versions you might have run, for example, \index{switches!-o + demonstration} \begin{commandshell} latexindent.pl -o myfile.tex outputfile.tex \end{commandshell} 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 82fe6264284..7a45e463823 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 @@ -1,7 +1,7 @@ % arara: pdflatex: { files: [latexindent]} \section{Conclusions and known limitations}\label{sec:knownlimitations} There are a number of known limitations of the script, and almost certainly quite a few - that are \emph{unknown}! The known issues include: + that are \emph{unknown}! The known issues include: \begin{description} \item[multicolumn alignment] when working with code blocks in which multicolumn commands overlap, the algorithm can fail; see \vref{lst:tabular2-mod2}. diff --git a/Master/texmf-dist/doc/support/latexindent/sec-fine-tuning.tex b/Master/texmf-dist/doc/support/latexindent/sec-fine-tuning.tex index ed0039a8057..8798b276ab7 100644 --- a/Master/texmf-dist/doc/support/latexindent/sec-fine-tuning.tex +++ b/Master/texmf-dist/doc/support/latexindent/sec-fine-tuning.tex @@ -24,7 +24,7 @@ \end{warning} \begin{widepage} - \cmhlistingsfromfile[style=fineTuning]{../defaultSettings.yaml}[width=.95\linewidth,before=\centering,yaml-TCB]{\texttt{fineTuning}}{lst:fineTuning} + \cmhlistingsfromfile[style=fineTuning]{../defaultSettings.yaml}[width=.95\linewidth,before=\centering,enhanced jigsaw,breakable,yaml-TCB]{\texttt{fineTuning}}{lst:fineTuning} \end{widepage} The fields given in \cref{lst:fineTuning} are all \emph{regular expressions}. This manual 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 9faa4112654..c8db5d20d1c 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 @@ -16,17 +16,25 @@ respectively. We will discuss how to change the settings and behaviour of the script in \vref{sec:defuseloc}. +\subsection{Requirements} +\subsubsection{Perl users} + Perl users 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 + that a module installer helper script is shipped with \texttt{latexindent.pl}.% + +\subsubsection{Windows users without perl}\label{subsubsec:latexindent:exe} \texttt{latexindent.pl} ships with \texttt{latexindent.exe} for Windows - 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 that a module installer helper script is shipped with - \texttt{latexindent.pl}. + users, so that you can use the script with or without a Perl distribution. + + Users of \texttt{latexindent.exe} need only two files: \texttt{latexindent.exe} and + \texttt{defaultSettings.yaml}, both of which are available from \cite{latexindent-home}. MiKTeX users on Windows may like to see \cite{miktex-guide} for details of how to use \texttt{latexindent.exe} without a Perl installation. \index{MiKTeX} - \index{latexindent.exe} + \index{latexindent.exe} \index{Windows} + +\subsubsection{conda users} + Users of \texttt{conda} should see the details given in \cref{sec:app:conda}. \subsection{From the command line}\label{sec:commandline} \texttt{latexindent.pl} has a number of different switches/flags/options, which diff --git a/Master/texmf-dist/doc/support/latexindent/subsec-text-wrap.tex b/Master/texmf-dist/doc/support/latexindent/subsec-text-wrap.tex index e03eb66395f..fddbffd98b8 100644 --- a/Master/texmf-dist/doc/support/latexindent/subsec-text-wrap.tex +++ b/Master/texmf-dist/doc/support/latexindent/subsec-text-wrap.tex @@ -30,7 +30,17 @@ \item setting \texttt{columns} to $-1$ will \emph{only} remove line breaks within the text wrap block; \item by default, the text wrapping routine will remove line breaks within text blocks because - \texttt{removeBlockLineBreaks} is set to 1; switch it to 0 if you wish to change this. + \texttt{removeBlockLineBreaks} is set to 1; switch it to 0 if you wish to change this; + \item about trailing comments within text wrap blocks: + \begin{enumerate} + \item trailing comments that do \emph{not} have leading space instruct the text wrap routine to + connect the lines \emph{without} space (see \cref{lst:tw-tc2}); + \item multiple trailing comments will be connected at the end of the text wrap block (see + \cref{lst:tw-tc4}); + \item the number of spaces between the end of the text wrap block and the (possibly combined) + trailing comments is determined by the spaces (if any) at the end of the text wrap block + (see \cref{lst:tw-tc5}). + \end{enumerate} \end{enumerate} We demonstrate this feature using a series of examples. @@ -349,6 +359,101 @@ latexindent.pl -m -l textwrap1A.yaml,tw-be-equation.yaml tw-be-equation.tex Naturally, you should feel encouraged to customise this as you see fit. \end{example} +\subsubsection{Text wrap: trailing comments and spaces} + We explore the behaviour of the text wrap routine in relation to trailing comments using + the following examples. + + \begin{example} + The file in \cref{lst:tw-tc1} contains a trailing comment which \emph{does} have a space + infront of it. + + Running the command + \begin{commandshell} +latexindent.pl -m tw-tc1.tex -l textwrap1A.yaml -o=+-mod1 +\end{commandshell} + gives the output given in \cref{lst:tw-tc1-mod1}. + + \begin{cmhtcbraster}[raster column skip=.1\linewidth] + \cmhlistingsfromfile*[showspaces=true]{demonstrations/tw-tc1.tex}{\texttt{tw-tc1.tex}}{lst:tw-tc1} + \cmhlistingsfromfile*{demonstrations/tw-tc1-mod1.tex}{\texttt{tw-tc1-mod1.tex}}{lst:tw-tc1-mod1} + \end{cmhtcbraster} + \end{example} + + \begin{example} + The file in \cref{lst:tw-tc2} contains a trailing comment which does \emph{not} have a + space infront of it. + + Running the command + \begin{commandshell} +latexindent.pl -m tw-tc2.tex -l textwrap1A.yaml -o=+-mod1 +\end{commandshell} + gives the output in \cref{lst:tw-tc2-mod1}. + \begin{cmhtcbraster}[raster column skip=.1\linewidth] + \cmhlistingsfromfile*{demonstrations/tw-tc2.tex}{\texttt{tw-tc2.tex}}{lst:tw-tc2} + \cmhlistingsfromfile*{demonstrations/tw-tc2-mod1.tex}{\texttt{tw-tc2-mod1.tex}}{lst:tw-tc2-mod1} + \end{cmhtcbraster} + We note that, because there is \emph{not} a space before the trailing comment, that the + lines have been joined \emph{without} a space. + \end{example} + + \begin{example} + The file in \cref{lst:tw-tc3} contains multiple trailing comments. + + Running the command + \begin{commandshell} +latexindent.pl -m tw-tc3.tex -l textwrap1A.yaml -o=+-mod1 +\end{commandshell} + gives the output in \cref{lst:tw-tc3-mod1}. + \begin{cmhtcbraster}[raster column skip=.1\linewidth] + \cmhlistingsfromfile*{demonstrations/tw-tc3.tex}{\texttt{tw-tc3.tex}}{lst:tw-tc3} + \cmhlistingsfromfile*{demonstrations/tw-tc3-mod1.tex}{\texttt{tw-tc3-mod1.tex}}{lst:tw-tc3-mod1} + \end{cmhtcbraster} + \end{example} + + \begin{example} + The file in \cref{lst:tw-tc4} contains multiple trailing comments. + + Running the command + \begin{commandshell} +latexindent.pl -m tw-tc4.tex -l textwrap1A.yaml -o=+-mod1 +\end{commandshell} + gives the output in \cref{lst:tw-tc4-mod1}. + \begin{cmhtcbraster}[raster column skip=.1\linewidth] + \cmhlistingsfromfile*{demonstrations/tw-tc4.tex}{\texttt{tw-tc4.tex}}{lst:tw-tc4} + \cmhlistingsfromfile*{demonstrations/tw-tc4-mod1.tex}{\texttt{tw-tc4-mod1.tex}}{lst:tw-tc4-mod1} + \end{cmhtcbraster} + \end{example} + + \begin{example} + The file in \cref{lst:tw-tc5} contains multiple trailing comments. + + Running the command + \begin{commandshell} +latexindent.pl -m tw-tc5.tex -l textwrap1A.yaml -o=+-mod1 +\end{commandshell} + gives the output in \cref{lst:tw-tc5-mod1}. + \begin{cmhtcbraster}[raster column skip=.1\linewidth] + \cmhlistingsfromfile*[showspaces=true]{demonstrations/tw-tc5.tex}{\texttt{tw-tc5.tex}}{lst:tw-tc5} + \cmhlistingsfromfile*[showspaces=true]{demonstrations/tw-tc5-mod1.tex}{\texttt{tw-tc5-mod1.tex}}{lst:tw-tc5-mod1} + \end{cmhtcbraster} + The space at the end of the text block has been preserved. + \end{example} + + \begin{example} + The file in \cref{lst:tw-tc6} contains multiple trailing comments. + + Running the command + \begin{commandshell} +latexindent.pl -m tw-tc6.tex -l textwrap1A.yaml -o=+-mod1 +\end{commandshell} + gives the output in \cref{lst:tw-tc6-mod1}. + \begin{cmhtcbraster}[raster column skip=.1\linewidth] + \cmhlistingsfromfile*[showspaces=true]{demonstrations/tw-tc6.tex}{\texttt{tw-tc6.tex}}{lst:tw-tc6} + \cmhlistingsfromfile*[showspaces=true]{demonstrations/tw-tc6-mod1.tex}{\texttt{tw-tc6-mod1.tex}}{lst:tw-tc6-mod1} + \end{cmhtcbraster} + The space at the end of the text block has been preserved. + \end{example} + \subsubsection{Text wrap: huge, tabstop and separator} The \announce{2021-07-23}*{huge:overflow is now default} default value of \texttt{huge} is \texttt{overflow}, which means that words will \emph{not} be broken by the text diff --git a/Master/texmf-dist/doc/support/latexindent/title.tex b/Master/texmf-dist/doc/support/latexindent/title.tex index ef2c39d1c29..bf6b1ec03d0 100644 --- a/Master/texmf-dist/doc/support/latexindent/title.tex +++ b/Master/texmf-dist/doc/support/latexindent/title.tex @@ -8,14 +8,14 @@ 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.17.2 + \centering\ttfamily\bfseries latexindent.pl\\[1cm] Version 3.17.3 \end{tcolorbox} } \author{Chris Hughes \thanks{and contributors! See \vref{sec:contributors}. For all communication, please visit \cite{latexindent-home}.}} -\date{2022-04-14} +\date{2022-06-05} \maketitle \begin{adjustwidth}{1cm}{1cm} \small @@ -26,5 +26,5 @@ regex-based substitutions. All user options are customisable via the switches and the YAML interface. - A quick start guide is given in \vref{sec:quickstart}. + tl;dr, a quick start guide is given in \vref{sec:quickstart}. \end{adjustwidth} diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm index 24e1291e754..96577d28d0a 100644 --- a/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm +++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm @@ -435,6 +435,13 @@ sub yaml_read_settings { $logger->info( "Not showing settings in the log file (see showEveryYamlRead and showAmalgamatedSettings)."); } + + # warning to log file if modifyLineBreaks specified and m switch not active + if ( ${ $userSettings->[0] }{modifyLineBreaks} and !$is_m_switch_active ) { + $logger->warn("*modifyLineBreaks specified and m switch is *not* active"); + $logger->warn("perhaps you intended to call"); + $logger->warn(" latexindent.pl -m -l $settings ${$self}{fileName}"); + } } else { # otherwise print a warning that we can not read userSettings.yaml diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm index edbb6252aa5..5decf68ddd6 100644 --- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm +++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm @@ -20,6 +20,6 @@ use warnings; use Exporter qw/import/; our @EXPORT_OK = qw/$versionNumber $versionDate/; -our $versionNumber = '3.17.2'; -our $versionDate = '2022-04-14'; +our $versionNumber = '3.17.3'; +our $versionDate = '2022-06-05'; 1 diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Wrap.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Wrap.pm index 1850a83c90d..7f3d026a4e6 100644 --- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Wrap.pm +++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Wrap.pm @@ -249,12 +249,36 @@ sub text_wrap { # initiate the trailing comments storage my $trailingComments = q(); - # grab all *internal* trailing comments from the block - while ( $textWrapBlockStorageValue =~ m|$trailingCommentRegExp| ) { - $textWrapBlockStorageValue =~ s|(\h*$trailingCommentRegExp)||s; - $trailingComments .= $1; + # about trailing comments + # + # - trailing comments that do *not* have leading space instruct the text + # wrap routine to connect the lines *without* space + # + # - multiple trailing comments will be connected at the end of the text wrap block + # + # - the number of spaces between the end of the text wrap block and + # the (possibly combined) trailing comments is determined by the + # spaces (if any) at the end of the text wrap block + + # for trailing comments that + # + # do *NOT* have a leading space + # do have a trailing line break + # + # then we *remove* the trailing line break + while ( $textWrapBlockStorageValue =~ m|\H$trailingCommentRegExp\h*\R|s ) { + $textWrapBlockStorageValue =~ s|(\H)($trailingCommentRegExp)\h*\R|$1$2|s; + } + + # now we put all of the trailing comments together + while ( $textWrapBlockStorageValue =~ m|$trailingCommentRegExp|s ) { + $textWrapBlockStorageValue =~ s|($trailingCommentRegExp)||s; + $trailingComments = $trailingComments . $1; } + $trailingComments =~ s/\h{2,}/ /sg + if ${ $mainSettings{modifyLineBreaks}{textWrapOptions} }{multipleSpacesToSingle}; + # determine if text wrapping will remove paragraph line breaks my $removeBlockLineBreaks = ${ $mainSettings{modifyLineBreaks}{textWrapOptions} }{removeBlockLineBreaks}; diff --git a/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml b/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml index c64dd5aeae5..dd59a83531b 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.17.2, 2022-04-14 +# defaultSettings.yaml for latexindent.pl, version 3.17.3, 2022-06-05 # a script that aims to # beautify .tex, .sty, .cls files # diff --git a/Master/texmf-dist/scripts/latexindent/latexindent.pl b/Master/texmf-dist/scripts/latexindent/latexindent.pl index f75b8165a5f..2915e567932 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.17.2, 2022-04-14 +# latexindent.pl, version 3.17.3, 2022-06-05 # # 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 |