From 59ab26e4b8b11acdd61b232207d7a9ae578c63e4 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 21 Jan 2022 22:50:29 +0000 Subject: latexindent (21jan22) git-svn-id: svn://tug.org/texlive/trunk@61686 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/support/latexindent/README | 2 +- .../doc/support/latexindent/appendices.tex | 395 --------------- .../latexindent/latexindent-yaml-schema.json | 2 +- .../doc/support/latexindent/latexindent.pdf | Bin 1066210 -> 1089386 bytes .../doc/support/latexindent/latexindent.tex | 4 +- .../doc/support/latexindent/references.tex | 4 - .../doc/support/latexindent/sec-appendices.tex | 549 +++++++++++++++++++++ .../doc/support/latexindent/sec-fine-tuning.tex | 2 +- .../doc/support/latexindent/sec-references.tex | 16 + .../texmf-dist/doc/support/latexindent/title.tex | 4 +- .../latexindent/LatexIndent/GetYamlSettings.pm | 7 +- .../scripts/latexindent/LatexIndent/Version.pm | 4 +- .../scripts/latexindent/defaultSettings.yaml | 146 +++--- .../texmf-dist/scripts/latexindent/latexindent.pl | 2 +- 14 files changed, 653 insertions(+), 484 deletions(-) delete mode 100644 Master/texmf-dist/doc/support/latexindent/appendices.tex delete mode 100644 Master/texmf-dist/doc/support/latexindent/references.tex create mode 100644 Master/texmf-dist/doc/support/latexindent/sec-appendices.tex create mode 100644 Master/texmf-dist/doc/support/latexindent/sec-references.tex (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/support/latexindent/README b/Master/texmf-dist/doc/support/latexindent/README index 50605df1312..f14024e491b 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.14, 2022-01-08 + latexindent.pl, version 3.15, 2022-01-21 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 deleted file mode 100644 index b69e2b34fe8..00000000000 --- a/Master/texmf-dist/doc/support/latexindent/appendices.tex +++ /dev/null @@ -1,395 +0,0 @@ -% arara: pdflatex: { files: [latexindent]} -\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}. - - \begin{cmhlistings}[style=tcblatex,language=Perl]{\texttt{helloworld.pl}}{lst:helloworld} -#!/usr/bin/perl - -use strict; -use warnings; -use utf8; -use PerlIO::encoding; -use Unicode::GCString; -use open ':std', ':encoding(UTF-8)'; -use Text::Wrap; -use Text::Tabs; -use FindBin; -use YAML::Tiny; -use File::Copy; -use File::Basename; -use File::HomeDir; -use Encode; -use Getopt::Long; -use Data::Dumper; -use List::Util qw(max); - -print "hello world"; -exit; -\end{cmhlistings} - - \subsection{Module installer script}\label{sec:module-installer} - \announce{2018-01-13}{perl module helper script} \texttt{latexindent.pl} ships with a - helper script that will install any missing \texttt{perl} modules on your system; if you - run - \begin{commandshell} -perl latexindent-module-installer.pl -\end{commandshell} - or - \begin{dosprompt} -perl latexindent-module-installer.pl - \end{dosprompt} - then, once you have answered \texttt{Y}, the appropriate modules will be installed onto - your distribution. - - \subsection{Manually installing 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. - - \subsubsection{Linux} - \paragraph{perlbrew} - Linux users may be interested in exploring Perlbrew \cite{perlbrew}; an example - installation would be: - \begin{commandshell} -sudo apt-get install perlbrew -perlbrew init -perlbrew install perl-5.28.1 -perlbrew switch perl-5.28.1 -sudo apt-get install curl -curl -L http://cpanmin.us | perl - App::cpanminus -cpanm YAML::Tiny -cpanm File::HomeDir -cpanm Unicode::GCString -\end{commandshell} - - \paragraph{Ubuntu/Debian} - For other distributions, the Ubuntu/Debian approach may work as follows - \begin{commandshell} -sudo apt install perl -sudo cpan -i App::cpanminus -sudo cpanm YAML::Tiny -sudo cpanm File::HomeDir -sudo cpanm Unicode::GCString -\end{commandshell} - or else by running, for example, - \begin{commandshell} -sudo perl -MCPAN -e'install "File::HomeDir"' -\end{commandshell} - - \paragraph{Ubuntu: using the texlive from apt-get} - Ubuntu users that install texlive using \texttt{apt-get} as in the following - \begin{commandshell} -sudo apt install texlive -sudo apt install texlive-latex-recommended -\end{commandshell} - may need the following additional command to work with \texttt{latexindent.pl} - \begin{commandshell} -sudo apt install texlive-extra-utils -\end{commandshell} - - \paragraph{Alpine} - 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-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} -brew install perl -brew install cpanm - -cpanm YAML::Tiny -cpanm File::HomeDir -cpanm Unicode::GCString -\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}. - - \texttt{indent.log} will contain details of the location - of the Perl modules on your system. \texttt{latexindent.exe} is a standalone executable - for Windows (and therefore does not require a Perl distribution) and caches copies of the - Perl modules onto your system; if you wish to see where they are cached, use the - \texttt{trace} option, e.g - \begin{dosprompt} -latexindent.exe -t myfile.tex - \end{dosprompt} - - \section{Updating the path variable}\label{sec:updating-path} - \texttt{latexindent.pl} has a few scripts (available at \cite{latexindent-home}) that can - update the \texttt{path} variables. Thank you to \cite{jasjuang} for this feature. If - you're on a Linux or Mac machine, then you'll want \texttt{CMakeLists.txt} from - \cite{latexindent-home}. - \subsection{Add to path for Linux} - To add \texttt{latexindent.pl} to the path for Linux, follow these steps: - \begin{enumerate} - \item download \texttt{latexindent.pl} and its associated modules, - \texttt{defaultSettings.yaml}, to your chosen directory from \cite{latexindent-home} ; - \item within your directory, create a directory called \texttt{path-helper-files} and download - \texttt{CMakeLists.txt} and \lstinline!cmake_uninstall.cmake.in! from - \cite{latexindent-home}/path-helper-files to this directory; - \item run - \begin{commandshell} -ls /usr/local/bin -\end{commandshell} - to see what is \emph{currently} in there; - \item run the following commands - \begin{commandshell} -sudo apt-get install cmake -sudo apt-get update && sudo apt-get install build-essential -mkdir build && cd build -cmake ../path-helper-files -sudo make install -\end{commandshell} - \item run - \begin{commandshell} -ls /usr/local/bin -\end{commandshell} - again to check that \texttt{latexindent.pl}, its modules and - \texttt{defaultSettings.yaml} have been added. - \end{enumerate} - To \emph{remove} the files, run - \begin{commandshell} -sudo make uninstall -\end{commandshell} - \subsection{Add to path for Windows} - To add \texttt{latexindent.exe} to the path for Windows, follow these steps: - \begin{enumerate} - \item download \texttt{latexindent.exe}, \texttt{defaultSettings.yaml}, - \texttt{add-to-path.bat} from \cite{latexindent-home} to your chosen directory; - \item open a command prompt and run the following command to see what is \emph{currently} in - your \lstinline!%path%! variable; - \begin{dosprompt} -echo %path% - \end{dosprompt} - \item right click on \texttt{add-to-path.bat} and \emph{Run as administrator}; - \item log out, and log back in; - \item open a command prompt and run - \begin{dosprompt} -echo %path% - \end{dosprompt} - to check that the appropriate directory has been added to your \lstinline!%path%!. - \end{enumerate} - To \emph{remove} the directory from your \lstinline!%path%!, run - \texttt{remove-from-path.bat} as administrator. - - \section{latexindent-yaml-schema.json} - - \texttt{latexindent.pl} - \announce{2022-01-02}{latexindent-yaml-schema.json} ships with - \texttt{latexindent-yaml-schema.json} - which might help you when constructing your YAML files. - \index{json!schema for YAML files} - - \subsection{VSCode demonstration} - To use \texttt{latexindent-yaml-schema.json} with \texttt{VSCode}, you can use the - following steps: - \index{VSCode} - \index{json!VSCode} - \begin{enumerate} - \item download \texttt{latexindent-yaml-schema.json} from the \texttt{documentation} folder of - \cite{latexindent-home}, save it in whichever directory you would like, noting it for - reference; - \item following the instructions from \cite{vscode-yaml-demo}, for example, you should install - the VSCode YAML extension \cite{vscode-yaml-extentions}; - \item set up your \texttt{settings.json} file using the directory you saved the file by - adapting \cref{lst:settings.json}; on my Ubuntu laptop this file lives at - \texttt{/home/cmhughes/.config/Code/User/settings.json}. - \end{enumerate} - - \begin{widepage} - \cmhlistingsfromfile*{demonstrations/settings.json}[yaml-TCB]{\texttt{settings.json}}{lst:settings.json} - \end{widepage} - - Alternatively, if you would prefer not to download the json file, you might be able to - use an adapted version of \cref{lst:settings-alt.json}. - - \begin{widepage} - \cmhlistingsfromfile*{demonstrations/settings-alt.json}[yaml-TCB]{\texttt{settings-alt.json}}{lst:settings-alt.json} - \end{widepage} - - Finally, if your TeX distribution is up to date, then - \texttt{latexindent-yaml-schema.json} \emph{should} be in the documentation folder of - your installation, so an adapted version of \cref{lst:settings-alt1.json} may work. - - \begin{widepage} - \cmhlistingsfromfile*{demonstrations/settings-alt1.json}[yaml-TCB]{\texttt{settings-alt1.json}}{lst:settings-alt1.json} - \end{widepage} - - If you have details of how to implement this schema in other editors, please feel - encouraged to contribute to this documentation. - - \section{Using conda} - If you use conda you'll only need - \begin{commandshell} -conda install latexindent.pl -c conda-forge -\end{commandshell} - this will install the executable and all its dependencies (including perl) in the - activate environment. You don't even have to worry about \texttt{defaultSettings.yaml} as - it included too, you can thus skip \cref{sec:requiredmodules,sec:updating-path}. - \index{conda} - - You can get a conda installation for example from \cite{conda} or from \cite{anacoda}. - - \section{logFilePreferences}\label{app:logfile-demo} - \Vref{lst:logFilePreferences} describes the options for customising the information given - to the log file, and we provide a few demonstrations here. Let's say that we start with - the code given in \cref{lst:simple}, and the settings specified in - \cref{lst:logfile-prefs1-yaml}. - - \begin{minipage}{.35\linewidth} - \cmhlistingsfromfile{demonstrations/simple.tex}{\texttt{simple.tex}}{lst:simple} - \end{minipage} - \hfill - \begin{minipage}{.6\linewidth} - \cmhlistingsfromfile{demonstrations/logfile-prefs1.yaml}[yaml-TCB]{\texttt{logfile-prefs1.yaml}}{lst:logfile-prefs1-yaml} - \end{minipage} - - If we run the following command (noting that \texttt{-t} is active) - \begin{commandshell} -latexindent.pl -t -l=logfile-prefs1.yaml simple.tex -\end{commandshell} - then on inspection of \texttt{indent.log} we will find the snippet given in - \cref{lst:indentlog}. - \begin{cmhlistings}[style=tcblatex,morekeywords={TRACE}]{\texttt{indent.log}}{lst:indentlog} - +++++ -TRACE: environment found: myenv - No ancestors found for myenv - Storing settings for myenvenvironments - indentRulesGlobal specified (0) for environments, ... - Using defaultIndent for myenv - Putting linebreak after replacementText for myenv - looking for COMMANDS and key = {value} -TRACE: Searching for commands with optional and/or mandatory arguments AND key = {value} - looking for SPECIAL begin/end -TRACE: Searching myenv for special begin/end (see specialBeginEnd) -TRACE: Searching myenv for optional and mandatory arguments - ... no arguments found - ----- - \end{cmhlistings} - Notice that the information given about \texttt{myenv} is `framed' using \texttt{+++++} - and \lstinline!-----! respectively. - - \section{Encoding indentconfig.yaml}\label{app:encoding} - In relation to \vref{sec:indentconfig}, Windows users that encounter encoding issues with - \texttt{indentconfig.yaml}, may wish to run the following command in either - \texttt{cmd.exe} or \texttt{powershell.exe}: - \begin{dosprompt} -chcp - \end{dosprompt} - They may receive the following result - \begin{dosprompt} -Active code page: 936 - \end{dosprompt} - and can then use the settings given in \cref{lst:indentconfig-encoding1} within their - \texttt{indentconfig.yaml}, where 936 is the result of the \texttt{chcp} command. - - \cmhlistingsfromfile{demonstrations/encoding1.yaml}[yaml-TCB]{\texttt{encoding} demonstration for \texttt{indentconfig.yaml}}{lst:indentconfig-encoding1} - - \section{dos2unix linebreak adjustment} - - \yamltitle{dos2unixlinebreaks}*{integer} - If you use \texttt{latexindent.pl} on a dos-based Windows file on Linux - \announce{2021-06-19}{dos2unix linebreaks} then you may find that trailing horizontal - space is not removed as you hope. - - In such a case, you may wish to try setting \texttt{dos2unixlinebreaks} to 1 and - employing, for example, the following command. - - \begin{commandshell} -latexindent.pl -y="dos2unixlinebreaks:1" myfile.tex -\end{commandshell} - - See \cite{bersbersbers} for further dertails. - - \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} - \begin{commandshell} -latexindent.pl -o myfile.tex outputfile.tex -\end{commandshell} - whereas in Version 3.0 you would run any of the following, for example, - \index{switches!-o demonstration} - \begin{commandshell} -latexindent.pl -o=outputfile.tex myfile.tex -latexindent.pl -o outputfile.tex myfile.tex -latexindent.pl myfile.tex -o outputfile.tex -latexindent.pl myfile.tex -o=outputfile.tex -latexindent.pl myfile.tex -outputfile=outputfile.tex -latexindent.pl myfile.tex -outputfile outputfile.tex -\end{commandshell} - noting that the \emph{output} file is given \emph{next to} the \texttt{-o} switch. - - The fields given in \cref{lst:obsoleteYaml} are \emph{obsolete} from Version 3.0 onwards. - \cmhlistingsfromfile{demonstrations/obsolete.yaml}[yaml-obsolete]{Obsolete YAML fields from Version 3.0}{lst:obsoleteYaml} - - There is a slight difference when specifying indentation after headings; specifically, we - now write \texttt{indentAfterThisHeading} instead of \texttt{indent}. See - \cref{lst:indentAfterThisHeadingOld,lst:indentAfterThisHeadingNew} - - \begin{minipage}{.45\textwidth} - \cmhlistingsfromfile{demonstrations/indentAfterThisHeadingOld.yaml}[yaml-TCB]{\texttt{indentAfterThisHeading} in Version 2.2}{lst:indentAfterThisHeadingOld} - \end{minipage}% - \hfill - \begin{minipage}{.45\textwidth} - \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, \cref{lst:indentAfterThisHeadingNew2}. - \index{specialBeginEnd!update to displaymath V3.0} - - \begin{minipage}{.45\textwidth} - \cmhlistingsfromfile{demonstrations/noAddtionalIndentOld.yaml}[yaml-TCB]{\texttt{noAdditionalIndent} in Version 2.2}{lst:noAdditionalIndentOld} - \end{minipage}% - \hfill - \begin{minipage}{.45\textwidth} - \cmhlistingsfromfile{demonstrations/noAddtionalIndentNew.yaml}[yaml-TCB]{\texttt{noAdditionalIndent} for \texttt{displayMath} in Version 3.0}{lst:indentAfterThisHeadingNew1} - - \cmhlistingsfromfile{demonstrations/noAddtionalIndentNew1.yaml}[yaml-TCB]{\texttt{noAdditionalIndent} for \texttt{displayMath} in Version 3.0}{lst:indentAfterThisHeadingNew2} - \end{minipage}% - - \mbox{}\hfill - \begin{minipage}{.25\textwidth} - \hrule - - \hfill\itshape End\\\mbox{}\hfill\mbox{}\rlap{\hfill\includegraphics{logo}} - - \end{minipage} 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 6aaf8d80dfc..013c7c76562 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.14 2022-01-08", + "description": "latexindent.pl YAML schema helper, V3.15 2022-01-21", "type": "object", "properties": { "fileExtensionPreference": { diff --git a/Master/texmf-dist/doc/support/latexindent/latexindent.pdf b/Master/texmf-dist/doc/support/latexindent/latexindent.pdf index 90a746666f2..78f618b3770 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 5a50dad577d..0ccca1d0ea2 100644 --- a/Master/texmf-dist/doc/support/latexindent/latexindent.tex +++ b/Master/texmf-dist/doc/support/latexindent/latexindent.tex @@ -835,8 +835,8 @@ \input{sec-the-line-switch} \input{sec-fine-tuning} \input{sec-conclusions-know-limitations} - \input{references} - \input{appendices} + \input{sec-references} + \input{sec-appendices} {\clearpage\addcontentsline{toc}{section}{List of listings}\small\lstlistoflistings} \printindex \fi diff --git a/Master/texmf-dist/doc/support/latexindent/references.tex b/Master/texmf-dist/doc/support/latexindent/references.tex deleted file mode 100644 index 548b3945784..00000000000 --- a/Master/texmf-dist/doc/support/latexindent/references.tex +++ /dev/null @@ -1,4 +0,0 @@ -\nocite{*} -\section{References} - \printbibliography[heading=subbibnumbered,title={External links},notkeyword=contributor] - \printbibliography[env=specialbib,heading=subbibnumbered,title={Contributors\label{sec:contributors}},keyword=contributor] diff --git a/Master/texmf-dist/doc/support/latexindent/sec-appendices.tex b/Master/texmf-dist/doc/support/latexindent/sec-appendices.tex new file mode 100644 index 00000000000..b797f2ebcca --- /dev/null +++ b/Master/texmf-dist/doc/support/latexindent/sec-appendices.tex @@ -0,0 +1,549 @@ +% arara: pdflatex: { files: [latexindent]} +\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}. + + \begin{cmhlistings}[style=tcblatex,language=Perl]{\texttt{helloworld.pl}}{lst:helloworld} +#!/usr/bin/perl + +use strict; +use warnings; +use utf8; +use PerlIO::encoding; +use Unicode::GCString; +use open ':std', ':encoding(UTF-8)'; +use Text::Wrap; +use Text::Tabs; +use FindBin; +use YAML::Tiny; +use File::Copy; +use File::Basename; +use File::HomeDir; +use Encode; +use Getopt::Long; +use Data::Dumper; +use List::Util qw(max); + +print "hello world"; +exit; +\end{cmhlistings} + + \subsection{Module installer script}\label{sec:module-installer} + \announce{2018-01-13}{perl module helper script} \texttt{latexindent.pl} ships with a + helper script that will install any missing \texttt{perl} modules on your system; if you + run + \begin{commandshell} +perl latexindent-module-installer.pl +\end{commandshell} + or + \begin{dosprompt} +perl latexindent-module-installer.pl + \end{dosprompt} + then, once you have answered \texttt{Y}, the appropriate modules will be installed onto + your distribution. + + \subsection{Manually installing 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. + + \subsubsection{Linux} + \paragraph{perlbrew} + Linux users may be interested in exploring Perlbrew \cite{perlbrew}; an example + installation would be: + \begin{commandshell} +sudo apt-get install perlbrew +perlbrew init +perlbrew install perl-5.28.1 +perlbrew switch perl-5.28.1 +sudo apt-get install curl +curl -L http://cpanmin.us | perl - App::cpanminus +cpanm YAML::Tiny +cpanm File::HomeDir +cpanm Unicode::GCString +\end{commandshell} + \index{cpan} + + \paragraph{Ubuntu/Debian} + For other distributions, the Ubuntu/Debian approach may work as follows + \begin{commandshell} +sudo apt install perl +sudo cpan -i App::cpanminus +sudo cpanm YAML::Tiny +sudo cpanm File::HomeDir +sudo cpanm Unicode::GCString +\end{commandshell} + or else by running, for example, + \begin{commandshell} +sudo perl -MCPAN -e'install "File::HomeDir"' +\end{commandshell} + + \paragraph{Ubuntu: using the texlive from apt-get} + Ubuntu users that install texlive using \texttt{apt-get} as in the following + \begin{commandshell} +sudo apt install texlive +sudo apt install texlive-latex-recommended +\end{commandshell} + may need the following additional command to work with \texttt{latexindent.pl} + \begin{commandshell} +sudo apt install texlive-extra-utils +\end{commandshell} + + \paragraph{Alpine} + 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-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} +brew install perl +brew install cpanm + +cpanm YAML::Tiny +cpanm File::HomeDir +cpanm Unicode::GCString +\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}. + + \texttt{indent.log} will contain details of the location + of the Perl modules on your system. \texttt{latexindent.exe} is a standalone executable + for Windows (and therefore does not require a Perl distribution) and caches copies of the + Perl modules onto your system; if you wish to see where they are cached, use the + \texttt{trace} option, e.g + \begin{dosprompt} +latexindent.exe -t myfile.tex + \end{dosprompt} + + \section{Updating the path variable}\label{sec:updating-path} + \texttt{latexindent.pl} has a few scripts (available at \cite{latexindent-home}) that can + update the \texttt{path} variables. Thank you to \cite{jasjuang} for this feature. If + you're on a Linux or Mac machine, then you'll want \texttt{CMakeLists.txt} from + \cite{latexindent-home}. + \subsection{Add to path for Linux} + To add \texttt{latexindent.pl} to the path for Linux, follow these steps: + \begin{enumerate} + \item download \texttt{latexindent.pl} and its associated modules, + \texttt{defaultSettings.yaml}, to your chosen directory from \cite{latexindent-home} ; + \item within your directory, create a directory called \texttt{path-helper-files} and download + \texttt{CMakeLists.txt} and \lstinline!cmake_uninstall.cmake.in! from + \cite{latexindent-home}/path-helper-files to this directory; + \item run + \begin{commandshell} +ls /usr/local/bin +\end{commandshell} + to see what is \emph{currently} in there; + \item run the following commands + \begin{commandshell} +sudo apt-get install cmake +sudo apt-get update && sudo apt-get install build-essential +mkdir build && cd build +cmake ../path-helper-files +sudo make install +\end{commandshell} + \item run + \begin{commandshell} +ls /usr/local/bin +\end{commandshell} + again to check that \texttt{latexindent.pl}, its modules and + \texttt{defaultSettings.yaml} have been added. + \end{enumerate} + To \emph{remove} the files, run + \begin{commandshell} +sudo make uninstall +\end{commandshell} + \subsection{Add to path for Windows} + To add \texttt{latexindent.exe} to the path for Windows, follow these steps: + \begin{enumerate} + \item download \texttt{latexindent.exe}, \texttt{defaultSettings.yaml}, + \texttt{add-to-path.bat} from \cite{latexindent-home} to your chosen directory; + \item open a command prompt and run the following command to see what is \emph{currently} in + your \lstinline!%path%! variable; + \begin{dosprompt} +echo %path% + \end{dosprompt} + \item right click on \texttt{add-to-path.bat} and \emph{Run as administrator}; + \item log out, and log back in; + \item open a command prompt and run + \begin{dosprompt} +echo %path% + \end{dosprompt} + to check that the appropriate directory has been added to your \lstinline!%path%!. + \end{enumerate} + To \emph{remove} the directory from your \lstinline!%path%!, run + \texttt{remove-from-path.bat} as administrator. + + \section{latexindent-yaml-schema.json} + + \texttt{latexindent.pl} + \announce{2022-01-02}{latexindent-yaml-schema.json} ships with + \texttt{latexindent-yaml-schema.json} + which might help you when constructing your YAML files. + \index{json!schema for YAML files} + + \subsection{VSCode demonstration} + To use \texttt{latexindent-yaml-schema.json} with \texttt{VSCode}, you can use the + following steps: + \index{VSCode} + \index{json!VSCode} + \begin{enumerate} + \item download \texttt{latexindent-yaml-schema.json} from the \texttt{documentation} folder of + \cite{latexindent-home}, save it in whichever directory you would like, noting it for + reference; + \item following the instructions from \cite{vscode-yaml-demo}, for example, you should install + the VSCode YAML extension \cite{vscode-yaml-extentions}; + \item set up your \texttt{settings.json} file using the directory you saved the file by + adapting \cref{lst:settings.json}; on my Ubuntu laptop this file lives at + \texttt{/home/cmhughes/.config/Code/User/settings.json}. + \end{enumerate} + + \begin{widepage} + \cmhlistingsfromfile{demonstrations/settings.json}[yaml-TCB]{\texttt{settings.json}}{lst:settings.json} + \end{widepage} + + Alternatively, if you would prefer not to download the json file, you might be able to + use an adapted version of \cref{lst:settings-alt.json}. + + \begin{widepage} + \cmhlistingsfromfile{demonstrations/settings-alt.json}[yaml-TCB]{\texttt{settings-alt.json}}{lst:settings-alt.json} + \end{widepage} + + Finally, if your TeX distribution is up to date, then + \texttt{latexindent-yaml-schema.json} \emph{should} be in the documentation folder of + your installation, so an adapted version of \cref{lst:settings-alt1.json} may work. + + \begin{widepage} + \cmhlistingsfromfile{demonstrations/settings-alt1.json}[yaml-TCB]{\texttt{settings-alt1.json}}{lst:settings-alt1.json} + \end{widepage} + + If you have details of how to implement this schema in other editors, please feel + encouraged to contribute to this documentation. + + \section{Using conda}\label{sec:app:conda} + If you use conda you'll only need + \begin{commandshell} +conda install latexindent.pl -c conda-forge +\end{commandshell} + this will install the executable and all its dependencies (including perl) in the + activate environment. You don't even have to worry about \texttt{defaultSettings.yaml} as + it included too, you can thus skip \cref{sec:requiredmodules,sec:updating-path}. + \index{conda} + + You can get a conda installation for example from \cite{conda} or from \cite{anacoda}. + + \subsection{Sample conda installation on Ubuntu} + On Ubuntu I followed the 64-bit installation instructions at \cite{condainstallubuntu} + and then I ran the following commands: + \begin{commandshell} +conda create -n latexindent.pl +conda activate latexindent.pl +conda install latexindent.pl -c conda-forge +conda info --envs +conda list +conda run latexindent.pl -vv +\end{commandshell} + I found the details given at \cite{condainstallhelp} to be helpful. + + \section{pre-commit} + + Users of \texttt{.git} may be interested + \announce*{2022-01-21}{pre-commit for latexindent.pl} in + exploring the \texttt{pre-commit} tool \cite{pre-commithome}, which is supported by + \texttt{latexindent.pl}. Thank you to \cite{tdegeusprecommit} for contributing this + feature. + + To use the \texttt{pre-commit} tool, you will need to install \texttt{pre-commit}; sample + instructions for Ubuntu are given in \cref{sec:pre-commit-ubuntu}. Once installed, there + are two ways to use \texttt{pre-commit}: using \texttt{CPAN} or using \texttt{conda}, + detailed in \cref{sec:pre-commit-cpan} and \cref{sec:pre-commit-conda} respectively. + + \subsection{Sample pre-commit installation on Ubuntu}\label{sec:pre-commit-ubuntu} + On Ubuntu I ran the following command: + \begin{commandshell} +python3 -m pip install pre-commit +\end{commandshell} + I then updated my path via .bashrc so that it includes the line in + \cref{lst:bashrc-update}. + \begin{cmhlistings}*[style=tcblatex,language=Bash]{\texttt{.bashrc} update}{lst:bashrc-update} +... +export PATH=$PATH:/home/cmhughes/.local/bin +\end{cmhlistings} + + \subsection{pre-commit using CPAN}\label{sec:pre-commit-cpan} + + To use \texttt{latexindent.pl} with \texttt{pre-commit}, create the file + \texttt{.pre-commit-config.yaml} given in \cref{lst:.pre-commit-config.yaml-cpan} in your + git-repository. + \index{cpan} + \index{git} + \index{pre-commit!cpan} + \begin{cmhlistings}*[style=tcblatex]{\texttt{.pre-commit-config.yaml} (cpan)}{lst:.pre-commit-config.yaml-cpan} +- repo: https://github.com/cmhughes/latexindent.pl + rev: V3.15 + hooks: + - id: latexindent + args: [-s] +\end{cmhlistings} + Once created, you should then be able to run the following command: + \begin{commandshell} +pre-commit run --all-files +\end{commandshell} + A few notes about \cref{lst:.pre-commit-config.yaml-cpan}: + \begin{itemize} + \item the settings given in \cref{lst:.pre-commit-config.yaml-cpan} instruct + \texttt{pre-commit} to use \texttt{CPAN} to get dependencies; + \item this requires \texttt{pre-commit} and \texttt{perl} to be installed on your system; + \item the \texttt{args} lists selected command-line options; the settings in + \cref{lst:.pre-commit-config.yaml-cpan} are equivalent to calling + \begin{commandshell} +latexindent.pl -s myfile.tex +\end{commandshell} + for each \texttt{.tex} file in your repository; + \item to instruct \texttt{latexindent.pl} to overwrite the files in your repository, then you + can update \cref{lst:.pre-commit-config.yaml-cpan} so that \texttt{args: [-s, -w]}. + \end{itemize} + + Naturally you can add options, or omit \texttt{-s} and \texttt{-w}, according to your + preference. + + \subsection{pre-commit using conda}\label{sec:pre-commit-conda} + + You can also rely on \texttt{conda} (detailed in \cref{sec:app:conda}) instead of + \texttt{CPAN} for all dependencies, including \texttt{latexindent.pl} itself. + \index{conda} + \index{git} + \index{pre-commit!conda} + + \begin{cmhlistings}*[style=tcblatex]{\texttt{.pre-commit-config.yaml} (conda)}{lst:.pre-commit-config.yaml-conda} +- repo: https://github.com/cmhughes/latexindent.pl + rev: V3.15 + hooks: + - id: latexindent-conda + args: [-s] +\end{cmhlistings} + Once created, you should then be able to run the following command: + \begin{commandshell} +pre-commit run --all-files +\end{commandshell} + A few notes about \cref{lst:.pre-commit-config.yaml-cpan}: + \begin{itemize} + \item the settings given in \cref{lst:.pre-commit-config.yaml-conda} instruct + \texttt{pre-commit} to use \texttt{conda} to get dependencies; + \item this requires \texttt{pre-commit} and \texttt{conda} to be installed on your system; + \item the \texttt{args} lists selected command-line options; the settings in + \cref{lst:.pre-commit-config.yaml-cpan} are equivalent to calling + \begin{commandshell} +conda run latexindent.pl -s myfile.tex +\end{commandshell} + for each \texttt{.tex} file in your repository; + \item to instruct \texttt{latexindent.pl} to overwrite the files in your repository, then you + can update \cref{lst:.pre-commit-config.yaml-cpan} so that \texttt{args: [-s, -w]}. + \end{itemize} + + \subsection{pre-commit example using -l, -m switches} + Let's consider a small example, with local \texttt{latexindent.pl} settings in + \texttt{.latexindent.yaml}. + + \begin{example} + We use the local settings given in \cref{lst:.latexindent.yaml}. + \begin{cmhlistings}*[style=tcblatex]{\texttt{.latexindent.yaml}}{lst:.latexindent.yaml} +onlyOneBackUp: 1 + +modifyLineBreaks: + oneSentencePerLine: + manipulateSentences: 1 +\end{cmhlistings} + + and \texttt{.pre-commit-config.yaml} as in \cref{lst:.latexindent.yaml-switches}: + \begin{cmhlistings}*[style=tcblatex]{\texttt{.pre-commit-config.yaml}}{lst:.latexindent.yaml-switches} +repos: +- repo: https://github.com/cmhughes/latexindent.pl + rev: V3.15 + hooks: + - id: latexindent + args: [-l, -m, -s, -w] +\end{cmhlistings} + Now running + \begin{commandshell} +pre-commit run --all-files +\end{commandshell} + is equivalent to running + \begin{commandshell} +latexindent.pl -l -m -s -w myfile.tex +\end{commandshell} + for each \texttt{.tex} file in your repository. + + A few notes about \cref{lst:.latexindent.yaml-switches}: + \begin{itemize} + \item the \texttt{-l} option was added to use the local \texttt{.latexindent.yaml} (where it + was specified to only create one back-up file, as \texttt{git} typically takes care of + this when you use \texttt{pre-commit}); + \item \texttt{-m} to modify line breaks; in addition to \texttt{-s} to suppress command-line + output, + and \texttt{-w} to format files in place. + \end{itemize} + \end{example} + + \section{logFilePreferences}\label{app:logfile-demo} + \Vref{lst:logFilePreferences} describes the options for customising the information given + to the log file, and we provide a few demonstrations here. Let's say that we start with + the code given in \cref{lst:simple}, and the settings specified in + \cref{lst:logfile-prefs1-yaml}. + + \begin{minipage}{.35\linewidth} + \cmhlistingsfromfile{demonstrations/simple.tex}{\texttt{simple.tex}}{lst:simple} + \end{minipage} + \hfill + \begin{minipage}{.6\linewidth} + \cmhlistingsfromfile{demonstrations/logfile-prefs1.yaml}[yaml-TCB]{\texttt{logfile-prefs1.yaml}}{lst:logfile-prefs1-yaml} + \end{minipage} + + If we run the following command (noting that \texttt{-t} is active) + \begin{commandshell} +latexindent.pl -t -l=logfile-prefs1.yaml simple.tex +\end{commandshell} + then on inspection of \texttt{indent.log} we will find the snippet given in + \cref{lst:indentlog}. + \begin{cmhlistings}[style=tcblatex,morekeywords={TRACE}]{\texttt{indent.log}}{lst:indentlog} + +++++ +TRACE: environment found: myenv + No ancestors found for myenv + Storing settings for myenvenvironments + indentRulesGlobal specified (0) for environments, ... + Using defaultIndent for myenv + Putting linebreak after replacementText for myenv + looking for COMMANDS and key = {value} +TRACE: Searching for commands with optional and/or mandatory arguments AND key = {value} + looking for SPECIAL begin/end +TRACE: Searching myenv for special begin/end (see specialBeginEnd) +TRACE: Searching myenv for optional and mandatory arguments + ... no arguments found + ----- + \end{cmhlistings} + Notice that the information given about \texttt{myenv} is `framed' using \texttt{+++++} + and \lstinline!-----! respectively. + + \section{Encoding indentconfig.yaml}\label{app:encoding} + In relation to \vref{sec:indentconfig}, Windows users that encounter encoding issues with + \texttt{indentconfig.yaml}, may wish to run the following command in either + \texttt{cmd.exe} or \texttt{powershell.exe}: + \begin{dosprompt} +chcp + \end{dosprompt} + They may receive the following result + \begin{dosprompt} +Active code page: 936 + \end{dosprompt} + and can then use the settings given in \cref{lst:indentconfig-encoding1} within their + \texttt{indentconfig.yaml}, where 936 is the result of the \texttt{chcp} command. + + \cmhlistingsfromfile{demonstrations/encoding1.yaml}[yaml-TCB]{\texttt{encoding} demonstration for \texttt{indentconfig.yaml}}{lst:indentconfig-encoding1} + + \section{dos2unix linebreak adjustment} + + \yamltitle{dos2unixlinebreaks}*{integer} + If you use \texttt{latexindent.pl} on a dos-based Windows file on Linux + \announce{2021-06-19}{dos2unix linebreaks} then you may find that trailing horizontal + space is not removed as you hope. + + In such a case, you may wish to try setting \texttt{dos2unixlinebreaks} to 1 and + employing, for example, the following command. + + \begin{commandshell} +latexindent.pl -y="dos2unixlinebreaks:1" myfile.tex +\end{commandshell} + + See \cite{bersbersbers} for further dertails. + + \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} + \begin{commandshell} +latexindent.pl -o myfile.tex outputfile.tex +\end{commandshell} + whereas in Version 3.0 you would run any of the following, for example, + \index{switches!-o demonstration} + \begin{commandshell} +latexindent.pl -o=outputfile.tex myfile.tex +latexindent.pl -o outputfile.tex myfile.tex +latexindent.pl myfile.tex -o outputfile.tex +latexindent.pl myfile.tex -o=outputfile.tex +latexindent.pl myfile.tex -outputfile=outputfile.tex +latexindent.pl myfile.tex -outputfile outputfile.tex +\end{commandshell} + noting that the \emph{output} file is given \emph{next to} the \texttt{-o} switch. + + The fields given in \cref{lst:obsoleteYaml} are \emph{obsolete} from Version 3.0 onwards. + \cmhlistingsfromfile{demonstrations/obsolete.yaml}[yaml-obsolete]{Obsolete YAML fields from Version 3.0}{lst:obsoleteYaml} + + There is a slight difference when specifying indentation after headings; specifically, we + now write \texttt{indentAfterThisHeading} instead of \texttt{indent}. See + \cref{lst:indentAfterThisHeadingOld,lst:indentAfterThisHeadingNew} + + \begin{minipage}{.45\textwidth} + \cmhlistingsfromfile{demonstrations/indentAfterThisHeadingOld.yaml}[yaml-TCB]{\texttt{indentAfterThisHeading} in Version 2.2}{lst:indentAfterThisHeadingOld} + \end{minipage}% + \hfill + \begin{minipage}{.45\textwidth} + \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, \cref{lst:indentAfterThisHeadingNew2}. + \index{specialBeginEnd!update to displaymath V3.0} + + \begin{minipage}{.45\textwidth} + \cmhlistingsfromfile{demonstrations/noAddtionalIndentOld.yaml}[yaml-TCB]{\texttt{noAdditionalIndent} in Version 2.2}{lst:noAdditionalIndentOld} + \end{minipage}% + \hfill + \begin{minipage}{.45\textwidth} + \cmhlistingsfromfile{demonstrations/noAddtionalIndentNew.yaml}[yaml-TCB]{\texttt{noAdditionalIndent} for \texttt{displayMath} in Version 3.0}{lst:indentAfterThisHeadingNew1} + + \cmhlistingsfromfile{demonstrations/noAddtionalIndentNew1.yaml}[yaml-TCB]{\texttt{noAdditionalIndent} for \texttt{displayMath} in Version 3.0}{lst:indentAfterThisHeadingNew2} + \end{minipage}% + + \mbox{}\hfill + \begin{minipage}{.25\textwidth} + \hrule + + \hfill\itshape End\\\mbox{}\hfill\mbox{}\rlap{\hfill\includegraphics{logo}} + + \end{minipage} 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 9aa24fd9c82..0a0739adc8d 100644 --- a/Master/texmf-dist/doc/support/latexindent/sec-fine-tuning.tex +++ b/Master/texmf-dist/doc/support/latexindent/sec-fine-tuning.tex @@ -30,7 +30,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,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-references.tex b/Master/texmf-dist/doc/support/latexindent/sec-references.tex new file mode 100644 index 00000000000..ba746331659 --- /dev/null +++ b/Master/texmf-dist/doc/support/latexindent/sec-references.tex @@ -0,0 +1,16 @@ +\nocite{*} +\section{References} + \printbibliography[heading=subbibnumbered,title={perl-related links},keyword=perl] + + \printbibliography[heading=subbibnumbered,title={conda-related links},keyword=conda] + \index{conda} + + \printbibliography[heading=subbibnumbered,title={VScode-related links},keyword=vscode] + \index{VSCode} + + \printbibliography[heading=subbibnumbered,title={Other links},keyword=other] + \index{pre-commit} + \index{MiKTeX} + + \index{contributors} + \printbibliography[env=specialbib,heading=subbibnumbered,title={Contributors\label{sec:contributors}},keyword=contributor] diff --git a/Master/texmf-dist/doc/support/latexindent/title.tex b/Master/texmf-dist/doc/support/latexindent/title.tex index 9384d7b1b92..6e559866e26 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.14 + \centering\ttfamily\bfseries latexindent.pl\\[1cm] Version 3.15 \end{tcolorbox} } \author{Chris Hughes \thanks{and contributors! See \vref{sec:contributors}. For all communication, please visit \cite{latexindent-home}.}} -\date{2022-01-08} +\date{2022-01-21} \maketitle \begin{adjustwidth}{1cm}{1cm} \small diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm index bb88a5a8b16..50d33a4f2ff 100644 --- a/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm +++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm @@ -61,8 +61,9 @@ sub yaml_read_settings{ # grab the logger object $logger->info("*YAML settings read: defaultSettings.yaml"); $logger->info("Reading defaultSettings.yaml from $FindBin::RealBin/defaultSettings.yaml"); - - # if latexindent.exe is invoked from TeXLive, then defaultSettings.yaml won't be in + my $myLibDir = dirname(__FILE__); + + # if latexindent.exe is invoked from TeXLive, then defaultSettings.yaml won't be in # the same directory as it; we need to navigate to it if(!$defaultSettings) { $logger->info("Reading defaultSettings.yaml (2nd attempt) from $FindBin::RealBin/../../texmf-dist/scripts/latexindent/defaultSettings.yaml"); @@ -71,6 +72,8 @@ sub yaml_read_settings{ $defaultSettings = YAML::Tiny->read( "$FindBin::RealBin/../../texmf-dist/scripts/latexindent/defaultSettings.yaml"); } elsif ( -e "$FindBin::RealBin/LatexIndent/defaultSettings.yaml" ) { $defaultSettings = YAML::Tiny->read( "$FindBin::RealBin/LatexIndent/defaultSettings.yaml"); + } elsif ( -e "$myLibDir/defaultSettings.yaml" ) { ++ $defaultSettings = YAML::Tiny->read( "$myLibDir/defaultSettings.yaml"); } else { $logger->fatal("*Could not open defaultSettings.yaml"); $self->output_logfile(); diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm index 8b3aadca2dd..313d0ffb02c 100644 --- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm +++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm @@ -19,6 +19,6 @@ use warnings; use Exporter qw/import/; our @EXPORT_OK = qw/$versionNumber $versionDate/; -our $versionNumber = '3.14'; -our $versionDate = '2022-01-08'; +our $versionNumber = '3.15'; +our $versionDate = '2022-01-21'; 1 diff --git a/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml b/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml index 32bab97e976..f375b470230 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.14, 2022-01-08 +# defaultSettings.yaml for latexindent.pl, version 3.15, 2022-01-21 # a script that aims to # beautify .tex, .sty, .cls files # @@ -9,21 +9,21 @@ # 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 # #--------------------------------------------------------------------------------------- -# You should feel encouraged to change anything you like in these settings, but -# it would probably be better to have your own user settings +# You should feel encouraged to change anything you like in these settings, but +# it would probably be better to have your own user settings # files somewhere else - remember that this file may be overwritten # when you update your tex distribution. Please see the manual linked from: # @@ -35,7 +35,7 @@ # #--------------------------------------------------------------------------------------- -# latexindent can be called to act on a file without using the file's extension, +# latexindent can be called to act on a file without using the file's extension, # e.g, simply # latexindent myfile # in which case the choice of file extension is chosen @@ -50,13 +50,13 @@ fileExtensionPreference: # default file extension of backup file (if -w switch is active) # for example, if your .tex file is called # myfile.tex -# and you specify the backupExtension as BACKUP.bak then your +# and you specify the backupExtension as BACKUP.bak then your # backup file will be # myfileBACKUP.bak backupExtension: .bak -# only one backup per file: -# - if onlyOneBackUp is 0 then, as a safety measure, +# only one backup per file: +# - if onlyOneBackUp is 0 then, as a safety measure, # the number on the extension increments by 1 each time: # # myfile.bak0, myfile.bak1, myfile.bak2 @@ -64,16 +64,16 @@ backupExtension: .bak # be overwritten each time (not recommended until you trust the script) onlyOneBackUp: 0 -# some users may want a finite number of backup files, +# some users may want a finite number of backup files, # say at most 3; in which case, they can change this maxNumberOfBackUps. # -# If maxNumberOfBackUps is set to 0 (or less) then infinitely +# If maxNumberOfBackUps is set to 0 (or less) then infinitely # many backups are possible, unless onlyOneBackUp is switched on maxNumberOfBackUps: 0 -# some users may wish to cycle through back up files. +# some users may wish to cycle through back up files. # -# for example, with maxNumberOfBackUps: 4, they may +# for example, with maxNumberOfBackUps: 4, they may # wish to delete the oldest back up file, and keep only the most recent. # # copy myfile.bak1 to myfile.bak0 @@ -90,7 +90,7 @@ logFilePreferences: showAmalgamatedSettings: 0 showDecorationStartCodeBlockTrace: 0 showDecorationFinishCodeBlockTrace: 0 - endLogFileWith: '--------------' + endLogFileWith: '--------------' showGitHubInfoFooter: 1 Dumper: Terse: 1 @@ -101,7 +101,7 @@ logFilePreferences: Sortkeys: 1 Pair: " => " -# verbatim environments specified +# verbatim environments specified # in this field will not be changed at all! verbatimEnvironments: verbatim: 1 @@ -113,7 +113,7 @@ verbatimCommands: verb: 1 lstinline: 1 -# no indent blocks (not necessarily verbatim +# no indent blocks (not necessarily verbatim # environments) which are marked as %\begin{noindent} # or anything else that you detail in the following noIndentBlock: @@ -146,14 +146,14 @@ preambleCommandsBeforeEnvironments: 0 # default value of indentation defaultIndent: "\t" -# remove trailing whitespace from all lines +# remove trailing whitespace from all lines removeTrailingWhitespace: beforeProcessing: 0 afterProcessing: 1 # name of code blocks that should have their body aligned at ampersand delimiters lookForAlignDelims: - tabular: + tabular: delims: 1 alignDoubleBackSlash: 1 spacesBeforeDoubleBackSlash: 1 @@ -217,7 +217,7 @@ lookForAlignDelims: VNiceArrayRC: 1 NiceArrayRCwithDelims: 1 -# if you want the script to look for \item commands +# if you want the script to look for \item commands # and format it, as follows (for example), # \begin{itemize} # \item content here @@ -234,7 +234,7 @@ indentAfterItems: # if you want to use other names for your items (for example, \part) # then populate them here; note that you can trick latexindent.pl -# into indenting all kinds of commands (within environments specified in +# into indenting all kinds of commands (within environments specified in # indentAfterItems) using this technique. itemNames: item: 1 @@ -259,17 +259,17 @@ specialBeginEnd: # if you want to add indentation after # a heading, such as \part, \chapter, etc -# then populate it in here - you can add -# an indent rule to indentRules if you would +# then populate it in here - you can add +# an indent rule to indentRules if you would # like something other than defaultIndent # -# you can also change the level if you like, +# you can also change the level if you like, # or add your own title command indentAfterHeadings: part: indentAfterThisHeading: 0 level: 1 - chapter: + chapter: indentAfterThisHeading: 0 level: 2 section: @@ -294,9 +294,9 @@ indentAfterHeadings: # maximum indentation, off by default maximumIndentation: -1 -# if you don't want to have additional indentation +# if you don't want to have additional indentation # in a code block, then add it to noAdditionalIndent; note that -# code blocks in this field will inherit +# code blocks in this field will inherit # the *current* level of indentation they just won't # get any *additional* indentation noAdditionalIndent: @@ -312,7 +312,7 @@ noAdditionalIndent: frame: 0 # if you have indent rules for particular code blocks -# then you can populate them in indentRules; for example, you might just want +# then you can populate them in indentRules; for example, you might just want # to use a space " " or maybe a double tab "\t\t" indentRules: myenvironment: "\t\t" @@ -337,7 +337,7 @@ noAdditionalIndentGlobal: afterHeading: 0 filecontents: 0 -# set indentRules globally for codeblocks; these need +# set indentRules globally for codeblocks; these need # to be horizontal spaces, if they are to be used indentRulesGlobal: environments: 0 @@ -357,7 +357,7 @@ indentRulesGlobal: commandCodeBlocks: roundParenthesesAllowed: 1 stringsAllowedBetweenArguments: - - + - amalgamate: 1 - 'node' - 'at' @@ -367,128 +367,128 @@ commandCodeBlocks: - '\-\-' - '\#\#\d' commandNameSpecial: - - + - amalgamate: 1 - '@ifnextchar\[' # change dos line breaks into unix dos2unixlinebreaks: 0 -# modifyLineBreaks will only be searched if the -m +# modifyLineBreaks will only be searched if the -m # switch is active # # poly-switch examples: # -# BeginStartsOnOwnLine: +# BeginStartsOnOwnLine: # modify line breaks before a begin statement # -# when set to -1, e.g -# some text some text +# when set to -1, e.g +# some text some text # \begin{myenvironment} # will be changed to # some text some text \begin{myenvironment} # when set to 0, the switch is ignored -# when set to 1, e.g +# when set to 1, e.g # some text some text \begin{myenvironment} # will be changed to -# some text some text +# some text some text # \begin{myenvironment} -# when set to 2, e.g +# when set to 2, e.g # some text some text \begin{myenvironment} # will be changed to # some text some text% # \begin{myenvironment} -# when set to 3, e.g +# when set to 3, e.g # some text some text \begin{myenvironment} # will be changed to # some text some text # # \begin{myenvironment} # -# BodyStartsOnOwnLine: +# BodyStartsOnOwnLine: # modify line breaks before the beginning of the body # -# when set to -1, e.g +# when set to -1, e.g # \begin{myenv} # body text body text # will be changed to # \begin{myenv}body text body text # when set to 0, the switch is ignored -# when set to 1, e.g +# when set to 1, e.g # \begin{myenv}body text body text # will be changed to # \begin{myenv} # body text body text -# when set to 2, e.g +# when set to 2, e.g # \begin{myenv}body text body text # will be changed to # \begin{myenv}% # body text body text -# when set to 3, e.g +# when set to 3, e.g # \begin{myenv}body text body text # will be changed to # \begin{myenv} # # body text body text # -# EndStartsOnOwnLine: +# EndStartsOnOwnLine: # modify line breaks before the end statement # -# when set to -1, e.g -# some text some text +# when set to -1, e.g +# some text some text # \end{myenvironment} # will be changed to # some text some text \end{myenvironment} # when set to 0, the switch is ignored -# when set to 1, e.g +# when set to 1, e.g # some text some text \end{myenvironment} # will be changed to -# some text some text +# some text some text # \end{myenvironment} -# when set to 2, e.g +# when set to 2, e.g # some text some text \end{myenvironment} # will be changed to # some text some text% # \end{myenvironment} -# when set to 3, e.g +# when set to 3, e.g # some text some text \end{myenvironment} # will be changed to # some text some text # # \end{myenvironment} # -# EndFinishesWithLineBreak: +# EndFinishesWithLineBreak: # modify line breaks after the end statement -# -# when set to -1, e.g +# +# when set to -1, e.g # \end{myenvironment} -# some text some text +# some text some text # will be changed to -# \end{myenvironment}some text some text +# \end{myenvironment}some text some text # when set to 0, the switch is ignored -# when set to 1, e.g -# \end{myenvironment}some text some text +# when set to 1, e.g +# \end{myenvironment}some text some text # will be changed to # \end{myenvironment} -# some text some text -# when set to 2, e.g -# \end{myenvironment}some text some text +# some text some text +# when set to 2, e.g +# \end{myenvironment}some text some text # will be changed to # \end{myenvironment}% -# some text some text -# when set to 3, e.g -# \end{myenvironment}some text some text +# some text some text +# when set to 3, e.g +# \end{myenvironment}some text some text # will be changed to # \end{myenvironment} # -# some text some text +# some text some text # # you can specify settings on a per-name basis modifyLineBreaks: preserveBlankLines: 1 condenseMultipleBlankLinesInto: 1 oneSentencePerLine: - manipulateSentences: 0 + manipulateSentences: 0 removeSentenceLineBreaks: 1 textWrapSentences: 0 sentenceIndent: "" @@ -519,7 +519,7 @@ modifyLineBreaks: beforeFindingChildCodeBlocks: 0 all: 0 alignAtAmpersandTakesPriority: 1 - environments: + environments: quotation: 0 ifElseFi: 0 optionalArguments: 0 @@ -534,7 +534,7 @@ modifyLineBreaks: all: 0 beforeTextWrap: 0 alignAtAmpersandTakesPriority: 1 - environments: + environments: quotation: 0 ifElseFi: 0 optionalArguments: 0 @@ -617,7 +617,7 @@ modifyLineBreaks: # replacements, only active when either -r or -rr switches are active replacements: - - + - amalgamate: 1 - this: 'latexindent.pl' @@ -625,11 +625,11 @@ replacements: lookForThis: 0 when: before -# fineTuning allows you to tweak the internal pattern matching that +# fineTuning allows you to tweak the internal pattern matching that # is central to latexindent.pl fineTuning: environments: - name: '[a-zA-Z@\*0-9_\\]+' + name: '[a-zA-Z@\*0-9_\\]+' ifElseFi: name: '(?!@?if[a-zA-Z@]*?\{)@?if[a-zA-Z@]*?' commands: @@ -642,7 +642,7 @@ fineTuning: namedGroupingBracesBrackets: name: '[0-9\.a-zA-Z@\*><]+?' follow: '\h|\R|\{|\[|\$|\)|\(' - UnNamedGroupingBracesBrackets: + UnNamedGroupingBracesBrackets: follow: '\{|\[|,|&|\)|\(|\$' arguments: before: '(?:#\d\h*;?,?\/?)+|\<.*?\>' diff --git a/Master/texmf-dist/scripts/latexindent/latexindent.pl b/Master/texmf-dist/scripts/latexindent/latexindent.pl index eedd30b286a..d52f46f10fd 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.14, 2022-01-08 +# latexindent.pl, version 3.15, 2022-01-21 # # 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 -- cgit v1.2.3