diff options
author | Karl Berry <karl@freefriends.org> | 2022-01-21 22:50:29 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-01-21 22:50:29 +0000 |
commit | 59ab26e4b8b11acdd61b232207d7a9ae578c63e4 (patch) | |
tree | 9b46f49bce2c90b1ff5cf9d37bb9f6854110df55 /Master/texmf-dist/doc/support/latexindent | |
parent | 87aba59c84e17b383ab231357b7f9e75330738a4 (diff) |
latexindent (21jan22)
git-svn-id: svn://tug.org/texlive/trunk@61686 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/support/latexindent')
-rw-r--r-- | Master/texmf-dist/doc/support/latexindent/README | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/latexindent/latexindent-yaml-schema.json | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/latexindent/latexindent.pdf | bin | 1066210 -> 1089386 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/support/latexindent/latexindent.tex | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/latexindent/references.tex | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/latexindent/sec-appendices.tex (renamed from Master/texmf-dist/doc/support/latexindent/appendices.tex) | 162 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/latexindent/sec-fine-tuning.tex | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/latexindent/sec-references.tex | 16 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/latexindent/title.tex | 4 |
9 files changed, 181 insertions, 15 deletions
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/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 Binary files differindex 90a746666f2..78f618b3770 100644 --- a/Master/texmf-dist/doc/support/latexindent/latexindent.pdf +++ b/Master/texmf-dist/doc/support/latexindent/latexindent.pdf diff --git a/Master/texmf-dist/doc/support/latexindent/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/appendices.tex b/Master/texmf-dist/doc/support/latexindent/sec-appendices.tex index b69e2b34fe8..b797f2ebcca 100644 --- a/Master/texmf-dist/doc/support/latexindent/appendices.tex +++ b/Master/texmf-dist/doc/support/latexindent/sec-appendices.tex @@ -65,6 +65,7 @@ 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 @@ -232,14 +233,14 @@ echo %path% \end{enumerate} \begin{widepage} - \cmhlistingsfromfile*{demonstrations/settings.json}[yaml-TCB]{\texttt{settings.json}}{lst:settings.json} + \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} + \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 @@ -247,13 +248,13 @@ echo %path% 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} + \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} + \section{Using conda}\label{sec:app:conda} If you use conda you'll only need \begin{commandshell} conda install latexindent.pl -c conda-forge @@ -265,6 +266,159 @@ conda install latexindent.pl -c conda-forge 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 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 |