summaryrefslogtreecommitdiff
path: root/support/latexindent
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-11-07 03:00:56 +0000
committerNorbert Preining <norbert@preining.info>2020-11-07 03:00:56 +0000
commitec3426946c37f270d71e8c4ad19d37beea726e7d (patch)
tree4f9a4ffaa8d056d3d160ba1be76408a2e20d6fb7 /support/latexindent
parentac4210da60306c356c4f9344b65e1f8345314267 (diff)
CTAN sync 202011070300
Diffstat (limited to 'support/latexindent')
-rw-r--r--support/latexindent/LatexIndent/AlignmentAtAmpersand.pm30
-rw-r--r--support/latexindent/LatexIndent/Arguments.pm9
-rw-r--r--support/latexindent/LatexIndent/GetYamlSettings.pm12
-rw-r--r--support/latexindent/LatexIndent/Indent.pm8
-rw-r--r--support/latexindent/LatexIndent/LogFile.pm5
-rw-r--r--support/latexindent/LatexIndent/ModifyLineBreaks.pm6
-rw-r--r--support/latexindent/LatexIndent/Version.pm4
-rw-r--r--support/latexindent/README2
-rw-r--r--support/latexindent/defaultSettings.yaml44
-rw-r--r--support/latexindent/documentation/appendices.tex57
-rw-r--r--support/latexindent/documentation/latexindent.pdfbin873938 -> 888691 bytes
-rw-r--r--support/latexindent/documentation/latexindent.tex42
-rw-r--r--support/latexindent/documentation/sec-default-user-local.tex36
-rw-r--r--support/latexindent/documentation/sec-how-to-use.tex3
-rw-r--r--support/latexindent/documentation/sec-the-m-switch.tex41
-rw-r--r--support/latexindent/documentation/title.tex2
-rwxr-xr-xsupport/latexindent/latexindent.pl2
17 files changed, 238 insertions, 65 deletions
diff --git a/support/latexindent/LatexIndent/AlignmentAtAmpersand.pm b/support/latexindent/LatexIndent/AlignmentAtAmpersand.pm
index deb2d75032..993423ab2e 100644
--- a/support/latexindent/LatexIndent/AlignmentAtAmpersand.pm
+++ b/support/latexindent/LatexIndent/AlignmentAtAmpersand.pm
@@ -400,6 +400,36 @@ sub align_at_ampersand{
# 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 {
diff --git a/support/latexindent/LatexIndent/Arguments.pm b/support/latexindent/LatexIndent/Arguments.pm
index 96450fdaaf..385a3fcb47 100644
--- a/support/latexindent/LatexIndent/Arguments.pm
+++ b/support/latexindent/LatexIndent/Arguments.pm
@@ -118,6 +118,15 @@ sub find_opt_mand_arguments{
$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
diff --git a/support/latexindent/LatexIndent/GetYamlSettings.pm b/support/latexindent/LatexIndent/GetYamlSettings.pm
index addcdaf3f1..e46eccf380 100644
--- a/support/latexindent/LatexIndent/GetYamlSettings.pm
+++ b/support/latexindent/LatexIndent/GetYamlSettings.pm
@@ -20,6 +20,7 @@ use LatexIndent::Switches qw/%switches $is_m_switch_active $is_t_switch_active $
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 @@ sub yaml_read_settings{
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 @@ sub yaml_read_settings{
# 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
diff --git a/support/latexindent/LatexIndent/Indent.pm b/support/latexindent/LatexIndent/Indent.pm
index eb36db2108..ffb4d3f737 100644
--- a/support/latexindent/LatexIndent/Indent.pm
+++ b/support/latexindent/LatexIndent/Indent.pm
@@ -108,9 +108,6 @@ sub indent_begin{
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 @@ sub indent_body{
# 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});
diff --git a/support/latexindent/LatexIndent/LogFile.pm b/support/latexindent/LatexIndent/LogFile.pm
index 763ca6e39e..205d72031e 100644
--- a/support/latexindent/LatexIndent/LogFile.pm
+++ b/support/latexindent/LatexIndent/LogFile.pm
@@ -62,8 +62,9 @@ usage: latexindent.pl [options] [file][.tex|.sty|.cls|.bib|...]
-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
diff --git a/support/latexindent/LatexIndent/ModifyLineBreaks.pm b/support/latexindent/LatexIndent/ModifyLineBreaks.pm
index de630a584b..8b00c52272 100644
--- a/support/latexindent/LatexIndent/ModifyLineBreaks.pm
+++ b/support/latexindent/LatexIndent/ModifyLineBreaks.pm
@@ -168,7 +168,7 @@ sub modify_line_breaks_end{
# 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 @@ sub modify_line_breaks_end{
$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 @@ sub text_wrap{
}
$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});
}
diff --git a/support/latexindent/LatexIndent/Version.pm b/support/latexindent/LatexIndent/Version.pm
index b2c63ba457..a5dd88c027 100644
--- a/support/latexindent/LatexIndent/Version.pm
+++ b/support/latexindent/LatexIndent/Version.pm
@@ -19,6 +19,6 @@ use warnings;
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
diff --git a/support/latexindent/README b/support/latexindent/README
index 24a4de4fc9..05a58a37fa 100644
--- a/support/latexindent/README
+++ b/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/support/latexindent/defaultSettings.yaml b/support/latexindent/defaultSettings.yaml
index 86b5113e9e..d4ed8f0c80 100644
--- a/support/latexindent/defaultSettings.yaml
+++ b/support/latexindent/defaultSettings.yaml
@@ -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 @@ lookForAlignDelims:
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),
diff --git a/support/latexindent/documentation/appendices.tex b/support/latexindent/documentation/appendices.tex
index aa228a9f1a..e756fb9533 100644
--- a/support/latexindent/documentation/appendices.tex
+++ b/support/latexindent/documentation/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/support/latexindent/documentation/latexindent.pdf b/support/latexindent/documentation/latexindent.pdf
index e8ae413aab..ec8fbfd269 100644
--- a/support/latexindent/documentation/latexindent.pdf
+++ b/support/latexindent/documentation/latexindent.pdf
Binary files differ
diff --git a/support/latexindent/documentation/latexindent.tex b/support/latexindent/documentation/latexindent.tex
index 5ecfce6268..81a0060483 100644
--- a/support/latexindent/documentation/latexindent.tex
+++ b/support/latexindent/documentation/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/support/latexindent/documentation/sec-default-user-local.tex b/support/latexindent/documentation/sec-default-user-local.tex
index fc40a70b5e..2d0498749e 100644
--- a/support/latexindent/documentation/sec-default-user-local.tex
+++ b/support/latexindent/documentation/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/support/latexindent/documentation/sec-how-to-use.tex b/support/latexindent/documentation/sec-how-to-use.tex
index 172c2ec078..86ee34a673 100644
--- a/support/latexindent/documentation/sec-how-to-use.tex
+++ b/support/latexindent/documentation/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/support/latexindent/documentation/sec-the-m-switch.tex b/support/latexindent/documentation/sec-the-m-switch.tex
index 39d69ceb64..03e09db259 100644
--- a/support/latexindent/documentation/sec-the-m-switch.tex
+++ b/support/latexindent/documentation/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{<part of thing>} 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{<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 @@ 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/support/latexindent/documentation/title.tex b/support/latexindent/documentation/title.tex
index 3d93349f6a..444213847f 100644
--- a/support/latexindent/documentation/title.tex
+++ b/support/latexindent/documentation/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!
diff --git a/support/latexindent/latexindent.pl b/support/latexindent/latexindent.pl
index c54ad5c980..f38d6c3fb5 100755
--- a/support/latexindent/latexindent.pl
+++ b/support/latexindent/latexindent.pl
@@ -1,5 +1,5 @@
#!/usr/bin/env perl
-# latexindent.pl, version 3.8.2, 2020-06-10
+# latexindent.pl, version 3.8.3, 2020-11-06
#
# 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