summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-06-25 21:50:47 +0000
committerKarl Berry <karl@freefriends.org>2017-06-25 21:50:47 +0000
commita3d3b206eb2e58da4e00d07576e32c5bd9acbf69 (patch)
tree313d64a4fdbe9c168e5e210aedfd13312e6a1f44 /Master
parent00305c9e9703b6a03efb295fc20c04be6a65d447 (diff)
latexindent (25jun17)
git-svn-id: svn://tug.org/texlive/trunk@44695 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rwxr-xr-xMaster/bin/win32/latexindent.exebin6292756 -> 6294466 bytes
-rw-r--r--Master/texmf-dist/doc/support/latexindent/README2
-rw-r--r--Master/texmf-dist/doc/support/latexindent/latexindent.pdfbin570961 -> 580064 bytes
-rw-r--r--Master/texmf-dist/doc/support/latexindent/latexindent.tex77
-rw-r--r--Master/texmf-dist/doc/support/latexindent/sec-default-user-local.tex18
-rw-r--r--Master/texmf-dist/doc/support/latexindent/sec-how-to-use.tex93
-rw-r--r--Master/texmf-dist/doc/support/latexindent/sec-introduction.tex4
-rw-r--r--Master/texmf-dist/doc/support/latexindent/sec-the-m-switch.tex3
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/FileExtension.pm49
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm33
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm15
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm24
-rwxr-xr-xMaster/texmf-dist/scripts/latexindent/defaultSettings.yaml2
-rwxr-xr-xMaster/texmf-dist/scripts/latexindent/latexindent.pl3
14 files changed, 293 insertions, 30 deletions
diff --git a/Master/bin/win32/latexindent.exe b/Master/bin/win32/latexindent.exe
index f0ed21edc9c..3958a2bdfbf 100755
--- a/Master/bin/win32/latexindent.exe
+++ b/Master/bin/win32/latexindent.exe
Binary files differ
diff --git a/Master/texmf-dist/doc/support/latexindent/README b/Master/texmf-dist/doc/support/latexindent/README
index a55d4c72804..fd6048669ed 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.2, 2017-06-19
+ latexindent.pl, version 3.2.1, 2017-06-25
PERL script to indent code within environments, and align delimited
environments in .tex files.
diff --git a/Master/texmf-dist/doc/support/latexindent/latexindent.pdf b/Master/texmf-dist/doc/support/latexindent/latexindent.pdf
index 1df40469213..33903c4df03 100644
--- a/Master/texmf-dist/doc/support/latexindent/latexindent.pdf
+++ b/Master/texmf-dist/doc/support/latexindent/latexindent.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/support/latexindent/latexindent.tex b/Master/texmf-dist/doc/support/latexindent/latexindent.tex
index 8dffa3fa4e6..ceedc72719b 100644
--- a/Master/texmf-dist/doc/support/latexindent/latexindent.tex
+++ b/Master/texmf-dist/doc/support/latexindent/latexindent.tex
@@ -16,7 +16,7 @@
%
% See <http://www.gnu.org/licenses/>.
\usepackage[left=4.5cm,right=2.5cm,showframe=false,
- top=2cm,bottom=1.5cm]{geometry} % page setup
+ top=2cm,bottom=1.5cm,marginparsep=2cm]{geometry} % page setup
\usepackage{lmodern}
\usepackage{parskip} % paragraph skips
\usepackage{booktabs} % beautiful tables
@@ -31,6 +31,7 @@
\usepackage[sc,format=hang,font=small]{caption} % captions
\usepackage[backend=bibtex]{biblatex} % bibliography
\usepackage{tcolorbox} % framed environments
+\usepackage{tikz}
\usepackage{xparse}
\usepackage[charter]{mathdesign} % changes font
\usepackage[expansion=false,kerning=true]{microtype} % better kerning
@@ -39,16 +40,12 @@
\usepackage{array}
% setup gitinfo2, as in the manual, details just above begin{document}
\usepackage[mark,grumpy]{gitinfo2}
-% tcolorbox libraries
-\tcbuselibrary{breakable,skins,listings,minted,xparse}
-%\usepackage{varioref} % clever referencing
-%\tcbuselibrary{documentation,breakable,skins,minted}
-% tikz libraries
+% tikz, tcolorbox libraries
\usetikzlibrary{positioning}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations,shapes}
-\usepackage{varioref} % clever referencing
-\usepackage{hyperref}
+\usepackage{varioref} % the documentation library from tcolorbox loads hyperref
+\tcbuselibrary{breakable,minted,xparse,documentation}
\hypersetup{
pdfauthor={Chris Hughes},
pdftitle={latexindent.pl package},
@@ -62,6 +59,21 @@
}
\usepackage{cleveref}
+% customise the \tcbdocnew command
+\tcbset{doclang/new={{\bfseries\color{green!50!black}N\normalfont\color{black}}}}
+\tcbset{doc marginnote={width=1.6cm}}
+%\newcommand{\announce}[1]{\tcbdocmarginnote{\tcbdocnew{#1}}}
+\NewDocumentCommand{\announce}{ s m }{%
+ \IfBooleanTF{#1}
+ {% \announce*
+ \tcbdocmarginnote[overlay={\node[anchor=north east,text=cmhgold] at ([yshift=3mm,xshift=4mm]frame.north east) {$\bigstar$}; }]{\tcbdocnew{#2}}
+ }
+ {% \announce
+ \tcbdocmarginnote{\tcbdocnew{#2}}
+ }}
+
+\reversemarginpar
+% bibliographies
\addbibresource{latex-indent}
\addbibresource{contributors}
@@ -404,7 +416,7 @@
\newcommand{\flagbox}[1]{%
\par
\makebox[30pt][l]{%
- \hspace{-2cm}%
+ \hspace{-1cm}%
\ttfamily\fontseries{b}\selectfont #1
}%
}
@@ -539,7 +551,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.2
+ \centering\ttfamily\bfseries latexindent.pl\\[1cm] Version 3.2.1
\end{tcolorbox}
}
\author{Chris Hughes \thanks{and contributors! See \vref{sec:contributors}. For
@@ -583,3 +595,48 @@
\input{references}
\input{appendices}
\end{document}
+
+version history:
+
+1.0: first release
+https://www.ctan.org/ctan-ann/id/mailman.278.1369470527.5851.ctan-ann@dante.de
+
+1.1R
+Changed Bin to RealBin so that I hope the script can get bun­dled into TeXLive 2013. Some other up­dates, too, detailed in the documentation.
+https://www.ctan.org/ctan-ann/id/mailman.3048.1384345731.2385.ctan-ann@dante.de
+
+1.11R
+This release updates the script to use $FindBin::RealBin which should help in the TeXLive implementation.
+
+Version 2.0R
+Ver­sion 2.0R of la­texin­dent.pl adds a num­ber of new fea­tures, in­clud­ing: - in­den­ta­tion af­ter \item com­mands - align­ment of de­lim­itered en­vi­ron­ments in com­mands, such as \ma­trix - in­den­ta­tion of \if...\else...\fi state­ments - max­i­mum num­ber of back­ups can cy­cle through back­ups - bet­ter sup­port for .cls and .sty files - and a few other bug fixes
+https://www.ctan.org/ctan-ann/id/mailman.3090.1417864461.4370.ctan-ann@dante.de
+
+Version 2.1R
+in­dent­con­fig.yaml can now be a 'hid­den' file, .in­dent­con­fig.yaml The Win­dows ex­e­cutable file, la­texin­dent.exe, should now work much bet­ter with Win­dows TeXLive.
+https://www.ctan.org/ctan-ann/id/mailman.343.1429509943.4405.ctan-ann@dante.de
+
+Version 2.2
+v2.2 addresses a reg­exp issue, and adds a few enhancements; full details are here: https://github.com/cmhughes/latexindent.pl/pull/49
+https://www.ctan.org/ctan-ann/id/mailman.198.1477655196.4574.ctan-ann@ctan.org
+
+Version 3.0
+latexindent.pl version 3.0: this represents a complete re-build of the script; full details are given here:
+https://github.com/cmhughes/la­texin­dent.pl/pull/56
+
+V3.0.1
+pro­vides sup­port for the align­ment at am­per­sands rou­tine for code that con­tains uni­code char­ac­ters; see
+https://github.com/cmhughes/la­texin­dent.pl/pull/61
+
+V3.0.2
+A mi­nor re­lease to fix a small bug re­lated to in­den­tPream­ble; de­tails given here:
+https://github.com/cmhughes/la­texin­dent.pl/pull/62
+
+Ver­sion 3.1 of la­texin­dent.pl,
+in­clud­ing op­tions for text wrap­ping and para­graph line break re­moval. Full de­tails here:
+https://github.com/cmhughes/la­texin­dent.pl/pull/64
+
+Ver­sion 3.2
+im­ple­ments a new fea­ture called 'mul­ti­Colum­nGroup­ing' which gives a new op­tion for the align­ment-at-am­per­sands rou­tine.
+More de­tails are given at
+https://github.com/cmhughes/la­texin­dent.pl/pull/67
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 ff99480cc80..70496f1bc35 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
@@ -32,7 +32,7 @@ latexindent.pl myfile
Calling \texttt{latexindent.pl myfile} with the (default) settings specified in \cref{lst:fileExtensionPreference}
means that the script will first look for \texttt{myfile.tex}, then \texttt{myfile.sty}, \texttt{myfile.cls},
- and finally \texttt{myfile.bib} in order\footnote{Throughout this manual, listings with line numbers represent code
+ and finally \texttt{myfile.bib} in order\footnote{Throughout this manual, listings shown with line numbers represent code
taken directly from \texttt{defaultSettings.yaml}.}.
\yamltitle{backupExtension}*{extension name}
@@ -219,14 +219,14 @@ lookForAlignDelims:
If you find that \texttt{latexindent.pl} does not perform satisfactorily on such
environments then you can set the relevant key to \texttt{0}, for example \texttt{tabular: 0}; alternatively, if you just want to ignore \emph{specific}
- instances of the environment, you could wrap them in something from \texttt{noIndentBlock} (see \cref{lst:noIndentBlock}).
+ instances of the environment, you could wrap them in something from \texttt{noIndentBlock} (see \vref{lst:noIndentBlock}).
\begin{minipage}{.45\textwidth}
- \cmhlistingsfromfile[columns=fixed]{demonstrations/tabular1.tex}{\texttt{tabular1.tex}}{lst:tabularbefore:basic}
+ \cmhlistingsfromfile*[showspaces=false,showtabs=false]{demonstrations/tabular1.tex}{\texttt{tabular1.tex}}{lst:tabularbefore:basic}
\end{minipage}%
\hfill
\begin{minipage}{.45\textwidth}
- \cmhlistingsfromfile[columns=fixed]{demonstrations/tabular1-default.tex}{\texttt{tabular1.tex} default output}{lst:tabularafter:basic}
+ \cmhlistingsfromfile*[showspaces=false,showtabs=false]{demonstrations/tabular1-default.tex}{\texttt{tabular1.tex} default output}{lst:tabularafter:basic}
\end{minipage}%
If you wish to remove the alignment of the \lstinline!\\! within a delimiter-aligned block, then the
@@ -244,9 +244,9 @@ lookForAlignDelims:
\item \texttt{spacesBeforeDoubleBackSlash}: optionally, specifies the number of spaces to be inserted
before (non-aligned) \lstinline!\\!. In order to use this field, \texttt{alignDoubleBackSlash} needs
to be set to 0 (default: 0).
- \item \texttt{multiColumnGrouping}: details if \texttt{latexindent.pl} should group columns
+ \item \announce{2017-06-19} \texttt{multiColumnGrouping}: details if \texttt{latexindent.pl} should group columns
underneath a \lstinline!\multicolumn! command (default: 0);
- \item \texttt{alignRowsWithoutMaxDelims}: details if rows that do not contain the
+ \item \announce{2017-06-19} \texttt{alignRowsWithoutMaxDelims}: details if rows that do not contain the
maximum number of delimeters should be formatted so as to have the ampersands aligned (default: 1).
\end{itemize}
@@ -260,11 +260,11 @@ latexindent.pl -l tabular.yaml tabular1.tex
the \lstinline!\\! have not (compare the alignment of \lstinline!\\! in \cref{lst:tabularafter:basic,lst:tabularafter:advanced}).
\begin{minipage}{.45\textwidth}
- \cmhlistingsfromfile[columns=fixed]{demonstrations/tabular1.tex}{\texttt{tabular1.tex}}{lst:tabularbefore:advanced}
+ \cmhlistingsfromfile*[showspaces=false,showtabs=false]{demonstrations/tabular1.tex}{\texttt{tabular1.tex}}{lst:tabularbefore:advanced}
\end{minipage}%
\hfill
\begin{minipage}{.45\textwidth}
- \cmhlistingsfromfile[columns=fixed]{demonstrations/tabular1-advanced.tex}{\texttt{tabular1.tex} using \cref{lst:aligndelims:advanced}}{lst:tabularafter:advanced}
+ \cmhlistingsfromfile*[showspaces=false,showtabs=false]{demonstrations/tabular1-advanced.tex}{\texttt{tabular1.tex} using \cref{lst:aligndelims:advanced}}{lst:tabularafter:advanced}
\end{minipage}%
Saving \cref{lst:aligndelims:advanced} into \texttt{tabular1.yaml} as in \cref{lst:tabular1YAML}, and running the command
@@ -274,7 +274,7 @@ latexindent.pl -l tabular1.yaml tabular1.tex
gives \cref{lst:tabularafter:spacing}; note the spacing before the \lstinline!\\!.
\begin{minipage}{.45\textwidth}
- \cmhlistingsfromfile[columns=fixed]{demonstrations/tabular1-advanced-3spaces.tex}{\texttt{tabular1.tex} using \cref{lst:tabular1YAML}}{lst:tabularafter:spacing}
+ \cmhlistingsfromfile*[showspaces=false,showtabs=false]{demonstrations/tabular1-advanced-3spaces.tex}{\texttt{tabular1.tex} using \cref{lst:tabular1YAML}}{lst:tabularafter:spacing}
\end{minipage}%
\hfill
\begin{minipage}{.54\textwidth}
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 35c0d1fe1a3..3f6921793ea 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
@@ -21,6 +21,12 @@
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.
+ As you read through this documentation, you'll occasionally see dates shown in the margin
+ (for example, next to this paragraph!)
+ \announce*{2017-06-25} which detail the date of the version in which the feature was implemented;
+ the `N' stands for `new as of the date shown'. If you see a $\color{cmhgold}\bigstar$, it
+ means that the feature is new as of the release of the current version.
+
\subsection{From the command line}\label{sec:commandline}
\texttt{latexindent.pl} has a number of different switches/flags/options, which
can be combined in any way that you like, either in short or long form as detailed below.
@@ -38,6 +44,13 @@ latexindent.pl
This will output a welcome message to the terminal, including the version number
and available options.
+\flagbox{-v, --version}
+ \announce*{2017-06-25}
+ \begin{commandshell}
+latexindent.pl -v
+ \end{commandshell}
+ This will output only the version number to the terminal.
+
\flagbox{-h, --help}
\begin{commandshell}
@@ -84,10 +97,60 @@ latexindent.pl --outputfile output.tex myfile.tex
be ignored and \texttt{-o} will take priority (this seems safer than the
other way round).
- Note that using \texttt{-o} is equivalent to using
+ Note that using \texttt{-o} as above is equivalent to using
\begin{commandshell}
latexindent.pl myfile.tex > output.tex
\end{commandshell}
+
+ You can call the \texttt{-o} switch with the name of the output file \emph{without} an extension; in
+ \announce*{2017-06-25}
+ this case, \texttt{latexindent.pl} will use the extension from the original file. For example,
+ the following two calls to \texttt{latexindent.pl} are equivalent:
+ \begin{commandshell}
+latexindent.pl myfile.tex -o=output
+latexindent.pl myfile.tex -o=output.tex
+\end{commandshell}
+
+ You can call the \texttt{-o} switch using a \texttt{+} symbol at the beginning; this will
+ \announce*{2017-06-25}
+ concatenate the name of the input file and the text given to the \texttt{-o} switch.
+ For example, the following two calls to \texttt{latexindent.pl} are equivalent:
+ \begin{commandshell}
+latexindent.pl myfile.tex -o=+new
+latexindent.pl myfile.tex -o=myfilenew.tex
+\end{commandshell}
+
+ You can call the \texttt{-o} switch using a \texttt{++} symbol at the end of the name
+ \announce*{2017-06-25}
+ of your output file; this tells \texttt{latexindent.pl} to search successively for
+ the name of your output file concatenated with $0, 1, \ldots$ while the name of the
+ output file exists. For example,
+ \begin{commandshell}
+latexindent.pl myfile.tex -o=output++
+\end{commandshell}
+ tells \texttt{latexindent.pl} to output to \texttt{output0.tex}, but if it exists then
+ output to \texttt{output1.tex}, and so on.
+
+ Calling \texttt{latexindent.pl} with simply
+ \begin{commandshell}
+latexindent.pl myfile.tex -o=++
+\end{commandshell}
+ tells it to output to \texttt{myfile0.tex}, but if it exists then output to \texttt{myfile1.tex}
+ and so on.
+
+ The \texttt{+} and \texttt{++} feature of the \texttt{-o} switch can be combined; for example, calling
+ \begin{commandshell}
+latexindent.pl myfile.tex -o=+out++
+\end{commandshell}
+ tells \texttt{latexindent.pl} to output to \texttt{myfileout0.tex}, but if it exists, then
+ try \texttt{myfileout1.tex}, and so on.
+
+ There is no need to specify a file extension when using the \texttt{++} feature, but if you wish to,
+ then you should include it \emph{after} the \texttt{++} symbols, for example
+ \begin{commandshell}
+latexindent.pl myfile.tex -o=+out++.tex
+\end{commandshell}
+
See \vref{app:differences} for details of how the interface has changed
from Version 2.2 to Version 3.0 for this flag.
\flagbox{-s, --silent}
@@ -146,6 +209,34 @@ latexindent.pl myfile.tex -l=first.yaml,second.yaml,third.yaml
absolute paths -- for absolute paths, see \vref{sec:indentconfig}.
Explicit demonstrations of how to use the \texttt{-l} switch are given throughout this documentation.
+ You can call the \texttt{-l} switch with a `+' symbol either before or after
+ \announce*{2017-06-25}
+ another YAML file; for example:
+ \begin{commandshell}
+latexindent.pl -l=+myyaml.yaml myfile.tex
+latexindent.pl -l "+ myyaml.yaml" myfile.tex
+latexindent.pl -l=myyaml.yaml+ myfile.tex
+ \end{commandshell}
+ which translate, respectively, to
+ \begin{commandshell}
+latexindent.pl -l=localSettings.yaml,myyaml.yaml myfile.tex
+latexindent.pl -l=localSettings.yaml,myyaml.yaml myfile.tex
+latexindent.pl -l=myyaml.yaml,localSettings.yaml myfile.tex
+ \end{commandshell}
+ Note that the following is \emph{not} allowed:
+ \begin{commandshell}
+latexindent.pl -l+myyaml.yaml myfile.tex
+ \end{commandshell}
+ and
+ \begin{commandshell}
+latexindent.pl -l + myyaml.yaml myfile.tex
+ \end{commandshell}
+ will \emph{only} load \texttt{localSettings.yaml}, and \texttt{myyaml.yaml} will be ignored.
+
+ You may also choose to omit the \texttt{yaml} extension, such as
+ \begin{commandshell}
+latexindent.pl -l=localSettings,myyaml myfile.tex
+ \end{commandshell}
\flagbox{-d, --onlydefault}
\begin{commandshell}
latexindent.pl -d myfile.tex
diff --git a/Master/texmf-dist/doc/support/latexindent/sec-introduction.tex b/Master/texmf-dist/doc/support/latexindent/sec-introduction.tex
index ffe81105a01..67826d37c24 100644
--- a/Master/texmf-dist/doc/support/latexindent/sec-introduction.tex
+++ b/Master/texmf-dist/doc/support/latexindent/sec-introduction.tex
@@ -19,7 +19,9 @@
at \cite{latexindent-home}.
\subsection{License}
- \texttt{latexindent.pl} is free and open source, and it always will be.
+ \texttt{latexindent.pl} is free and open source, and it always will be; it
+ is released under the GNU General Public License v3.0.
+
Before you start using it on any important files, bear in mind that \texttt{latexindent.pl} has the option to overwrite your \texttt{.tex} files.
It will always make at least one backup (you can choose how many it makes, see \cpageref{page:onlyonebackup})
but you should still be careful when using it. The script has been tested on many
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 091f9154203..8f645177c0b 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
@@ -58,6 +58,7 @@ latexindent.pl myfile.tex -m
\yamltitle{textWrapOptions}*{fields}
When the \texttt{-m} switch is active \texttt{latexindent.pl} has the ability to wrap text using the options
+ \announce{2017-05-27}
specified in the \texttt{textWrapOptions} field, see \cref{lst:textWrapOptions}. The value of
\texttt{columns} specifies the column at which the text should be wrapped.
By default, the value of \texttt{columns} is \texttt{0}, so \texttt{latexindent.pl}
@@ -148,6 +149,7 @@ latexindent.pl -m textwrap4.tex -o textwrap4-mod2.tex -l textwrap2.yaml
\yamltitle{removeParagraphLineBreaks}*{fields}
When the \texttt{-m} switch is active \texttt{latexindent.pl} has the ability to remove line breaks
+ \announce{2017-05-27}
from within paragraphs; the behaviour is controlled by the \texttt{removeParagraphLineBreaks} field, detailed in
\cref{lst:removeParagraphLineBreaks}. Thank you to \cite{jowens} for shaping and assisting with the testing of this feature.
@@ -277,6 +279,7 @@ latexindent.pl -m shortlines-md.tex -o shortlines-md4.tex -l remove-para4.yaml
\yamltitle{paragraphsStopAt}*{fields}
The paragraph line break routine considers blank lines and the \lstinline|\par| command to be the end of a paragraph;
+ \announce{2017-05-27}
you can fine tune the behaviour of the routine further by using the \texttt{paragraphsStopAt} fields, shown in \cref{lst:paragraphsStopAt}.
\cmhlistingsfromfile[style=paragraphsStopAt]{../defaultSettings.yaml}[MLB-TCB,width=.85\linewidth,before=\centering]{\texttt{paragraphsStopAt}}{lst:paragraphsStopAt}
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/FileExtension.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/FileExtension.pm
index 131c5c011eb..c2f6d0fcf3f 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/FileExtension.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/FileExtension.pm
@@ -22,6 +22,7 @@ use open ':std', ':encoding(UTF-8)';
use File::Basename; # to get the filename and directory path
use Exporter qw/import/;
use LatexIndent::GetYamlSettings qw/%masterSettings/;
+use LatexIndent::Switches qw/%switches/;
our @EXPORT_OK = qw/file_extension_check/;
sub file_extension_check{
@@ -37,7 +38,8 @@ sub file_extension_check{
my @fileExtensions = sort { $fileExtensionPreference{$a} <=> $fileExtensionPreference{$b} } keys(%fileExtensionPreference);
# get the base file name, allowing for different extensions (possibly no extension)
- my ($dir, $name, $ext) = fileparse($fileName, @fileExtensions);
+ my ($name, $dir, $ext) = fileparse($fileName, @fileExtensions);
+ ${$self}{baseName} = $name;
# check to make sure given file type is supported
if( -e $fileName and !$ext ){
@@ -90,6 +92,51 @@ sub file_extension_check{
# store the file extension
${$self}{fileExtension} = $ext;
+ # check to see if -o switch is active
+ if($switches{outputToFile}){
+
+ $self->logger("Output file check",'heading');
+
+ # the -o file name might begin with a + symbol
+ if($switches{outputToFile} =~ m/^\+(.*)/ and $1 ne "+"){
+ $self->logger("-o switch called with + symbol at the beginning: $switches{outputToFile}");
+ $switches{outputToFile} = ${$self}{baseName}.$1;
+ $self->logger("output file is now: $switches{outputToFile}");
+ }
+
+ my $strippedFileExtension = ${$self}{fileExtension};
+ $strippedFileExtension =~ s/\.//;
+
+ # grab the name, directory, and extension of the output file
+ my ($name, $dir, $ext) = fileparse($switches{outputToFile}, $strippedFileExtension);
+
+ # if there is no extension, then add the extension from the file to be operated upon
+ if(!$ext){
+ $self->logger("-o switch called with file name without extension: $switches{outputToFile}");
+ $switches{outputToFile} = $name.($name=~m/\.\z/ ? q() : ".").$strippedFileExtension;
+ $self->logger("Updated to $switches{outputToFile} as the file extension of the input file is $strippedFileExtension");
+ }
+
+ # the -o file name might end with ++ in which case we wish to search for existence,
+ # and then increment accordingly
+ $name =~ s/\.$//;
+ if($name =~ m/\+\+$/){
+ $self->logger("-o switch called with file name ending with ++: $switches{outputToFile}");
+ $name =~ s/\+\+$//;
+ $name = ${$self}{baseName} if ($name eq "");
+ my $outputFileCounter = 0;
+ my $fileName = $name.$outputFileCounter.".".$strippedFileExtension;
+ $self->logger("will search for exisitence and increment counter, starting with $fileName");
+ while( -e $fileName ){
+ $self->logger("$fileName exists, incrementing counter");
+ $outputFileCounter++;
+ $fileName = $name.$outputFileCounter.".".$strippedFileExtension;
+ }
+ $self->logger("$fileName does not exist, and will be the output file");
+ $switches{outputToFile} = $fileName;
+ }
+ }
+
# read the file into the Document body
my @lines;
open(MAINFILE, $fileName) or die "Could not open input file, $fileName";
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm
index e4b5f12c54d..0d51d5837db 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm
@@ -35,7 +35,6 @@ our %previouslyFoundSettings;
sub readSettings{
my $self = shift;
- $defaultSettings = YAML::Tiny->new;
$defaultSettings = YAML::Tiny->read( "$FindBin::RealBin/defaultSettings.yaml" );
$self->logger("YAML settings read",'heading');
$self->logger("Reading defaultSettings.yaml from $FindBin::RealBin/defaultSettings.yaml");
@@ -104,11 +103,34 @@ sub readSettings{
# get information about LOCAL settings, assuming that $readLocalSettings exists
my $directoryName = dirname (${$self}{fileName});
+ my @localSettings;
+
+ # local settings can be called with a + symbol, for example
+ # -l=+myfile.yaml
+ # -l "+ myfile.yaml"
+ # -l=myfile.yaml+
+ # which translates to, respectively
+ # -l=localSettings.yaml,myfile.yaml
+ # -l=myfile.yaml,localSettings.yaml
+ # Note: the following is *not allowed*:
+ # -l+myfile.yaml
+ # and
+ # -l + myfile.yaml
+ # will *only* load localSettings.yaml, and myfile.yaml will be ignored
+ if($switches{readLocalSettings} =~ m/\+/){
+ $self->logger("+ found in call for -l switch: will add localSettings.yaml");
+
+ # + can be either at the beginning or the end, which determines if where the comma should go
+ my $commaAtBeginning = ($switches{readLocalSettings} =~ m/^\h*\+/ ? q() : ",");
+ my $commaAtEnd = ($switches{readLocalSettings} =~ m/^\h*\+/ ? "," : q());
+ $switches{readLocalSettings} =~ s/\h*\+\h*/$commaAtBeginning."localSettings.yaml".$commaAtEnd/e;
+ $self->logger("New value of -l switch: $switches{readLocalSettings}");
+ }
+
# local settings can be separated by ,
# e.g
# -l = myyaml1.yaml,myyaml2.yaml
# and in which case, we need to read them all
- my @localSettings;
if($switches{readLocalSettings} =~ m/,/){
$self->logger("Multiple localSettings found, separated by commas:",'heading');
@localSettings = split(/,/,$switches{readLocalSettings});
@@ -118,6 +140,13 @@ sub readSettings{
# add local settings to the paths, if appropriate
foreach (@localSettings) {
+ # check for an extension (.yaml)
+ my ($dir, $name, $ext) = fileparse($_, "yaml");
+
+ # if no extension is found, append the current localSetting with .yaml
+ $_ = $_.($_=~m/\.\z/ ? q() : ".")."yaml" if(!$ext);
+
+ # check for existence and non-emptiness
if ( (-e "$directoryName/$_") and !(-z "$directoryName/$_")) {
$self->logger("Adding $directoryName/$_ to YAML read paths");
push(@absPaths,"$directoryName/$_");
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm
index 336ec34c7ad..fb7cb37ed00 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm
@@ -18,6 +18,7 @@ use strict;
use warnings;
use LatexIndent::GetYamlSettings qw/%masterSettings/;
use LatexIndent::Switches qw/%switches/;
+use LatexIndent::Version qw/$versionNumber $versionDate/;
use FindBin;
use File::Basename; # to get the filename and directory path
use Exporter qw/import/;
@@ -41,17 +42,25 @@ sub processSwitches{
my $self = shift;
# details of the script to log file
- $self->logger("$FindBin::Script version 3.2, a script to indent .tex files",'heading');
+ $self->logger("$FindBin::Script version $versionNumber, $versionDate, a script to indent .tex files",'heading');
$self->logger("$FindBin::Script lives here: $FindBin::RealBin/");
# time the script is used
my $time = localtime();
$self->logger("$time");
+ # -v switch is just to show the version number
+ if($switches{version}) {
+ print $versionNumber,", ",$versionDate,"\n";
+ exit(2);
+ }
+
if(scalar(@ARGV) < 1 or $switches{showhelp}) {
print <<ENDQUOTE
-latexindent.pl version 3.2
+latexindent.pl version $versionNumber, $versionDate
usage: latexindent.pl [options] [file][.tex|.sty|.cls|.bib|...]
+ -v, --version
+ displays the version number and date of release
-h, --help
help (see the documentation for detailed instructions and examples)
-o, --outputfile
@@ -72,7 +81,7 @@ usage: latexindent.pl [options] [file][.tex|.sty|.cls|.bib|...]
latexindent.pl -l=some.yaml,another.yaml myfile.tex
-d, --onlydefault
ONLY use defaultSettings.yaml, ignore ALL (yaml) user files
- -g, --logfile
+ -g, --logfile=<name of log file>
used to specify the name of logfile (default is indent.log)
-c, --cruft=<cruft directory>
used to specify the location of backup files and indent.log
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm
new file mode 100644
index 00000000000..1ebfb27171e
--- /dev/null
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm
@@ -0,0 +1,24 @@
+package LatexIndent::Version;
+# 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
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# See http://www.gnu.org/licenses/.
+#
+# Chris Hughes, 2017
+#
+# For all communication, please visit: https://github.com/cmhughes/latexindent.pl
+use strict;
+use warnings;
+use Exporter qw/import/;
+our @EXPORT_OK = qw/$versionNumber $versionDate/;
+
+our $versionNumber = '3.2.1';
+our $versionDate = '2017-06-25';
+1
diff --git a/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml b/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml
index 916efb46dd3..d29c887f2da 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.2, 2017-06-19
+# defaultSettings.yaml for latexindent.pl, version 3.2.1, 2017-06-25
# 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 107d4fab865..e4fc3ea64f6 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.2, 2017-06-19
+# latexindent.pl, version 3.2.1, 2017-06-25
#
# 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
@@ -30,6 +30,7 @@ use LatexIndent::Document;
my %switches = (readLocalSettings=>0);
GetOptions (
+ "version|v"=>\$switches{version},
"silent|s"=>\$switches{silentMode},
"trace|t"=>\$switches{trace},
"ttrace|tt"=>\$switches{ttrace},