diff options
Diffstat (limited to 'support/latexindent')
-rw-r--r-- | support/latexindent/LatexIndent/GetYamlSettings.pm | 7 | ||||
-rw-r--r-- | support/latexindent/LatexIndent/Version.pm | 4 | ||||
-rw-r--r-- | support/latexindent/README | 2 | ||||
-rw-r--r-- | support/latexindent/defaultSettings.yaml | 146 | ||||
-rw-r--r-- | support/latexindent/documentation/latexindent-yaml-schema.json | 2 | ||||
-rw-r--r-- | support/latexindent/documentation/latexindent.pdf | bin | 1066210 -> 1089386 bytes | |||
-rw-r--r-- | support/latexindent/documentation/latexindent.tex | 4 | ||||
-rw-r--r-- | support/latexindent/documentation/references.tex | 4 | ||||
-rw-r--r-- | support/latexindent/documentation/sec-appendices.tex (renamed from support/latexindent/documentation/appendices.tex) | 162 | ||||
-rw-r--r-- | support/latexindent/documentation/sec-fine-tuning.tex | 2 | ||||
-rw-r--r-- | support/latexindent/documentation/sec-references.tex | 16 | ||||
-rw-r--r-- | support/latexindent/documentation/title.tex | 4 | ||||
-rwxr-xr-x | support/latexindent/latexindent.pl | 2 |
13 files changed, 262 insertions, 93 deletions
diff --git a/support/latexindent/LatexIndent/GetYamlSettings.pm b/support/latexindent/LatexIndent/GetYamlSettings.pm index bb88a5a8b1..50d33a4f2f 100644 --- a/support/latexindent/LatexIndent/GetYamlSettings.pm +++ b/support/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/support/latexindent/LatexIndent/Version.pm b/support/latexindent/LatexIndent/Version.pm index 8b3aadca2d..313d0ffb02 100644 --- a/support/latexindent/LatexIndent/Version.pm +++ b/support/latexindent/LatexIndent/Version.pm @@ -19,6 +19,6 @@ use warnings; use Exporter qw/import/; our @EXPORT_OK = qw/$versionNumber $versionDate/; -our $versionNumber = '3.14'; -our $versionDate = '2022-01-08'; +our $versionNumber = '3.15'; +our $versionDate = '2022-01-21'; 1 diff --git a/support/latexindent/README b/support/latexindent/README index 50605df131..f14024e491 100644 --- a/support/latexindent/README +++ b/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/support/latexindent/defaultSettings.yaml b/support/latexindent/defaultSettings.yaml index 32bab97e97..f375b47023 100644 --- a/support/latexindent/defaultSettings.yaml +++ b/support/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/support/latexindent/documentation/latexindent-yaml-schema.json b/support/latexindent/documentation/latexindent-yaml-schema.json index 6aaf8d80df..013c7c7656 100644 --- a/support/latexindent/documentation/latexindent-yaml-schema.json +++ b/support/latexindent/documentation/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/support/latexindent/documentation/latexindent.pdf b/support/latexindent/documentation/latexindent.pdf Binary files differindex 90a746666f..78f618b377 100644 --- a/support/latexindent/documentation/latexindent.pdf +++ b/support/latexindent/documentation/latexindent.pdf diff --git a/support/latexindent/documentation/latexindent.tex b/support/latexindent/documentation/latexindent.tex index 5a50dad577..0ccca1d0ea 100644 --- a/support/latexindent/documentation/latexindent.tex +++ b/support/latexindent/documentation/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/support/latexindent/documentation/references.tex b/support/latexindent/documentation/references.tex deleted file mode 100644 index 548b394578..0000000000 --- a/support/latexindent/documentation/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/support/latexindent/documentation/appendices.tex b/support/latexindent/documentation/sec-appendices.tex index b69e2b34fe..b797f2ebcc 100644 --- a/support/latexindent/documentation/appendices.tex +++ b/support/latexindent/documentation/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/support/latexindent/documentation/sec-fine-tuning.tex b/support/latexindent/documentation/sec-fine-tuning.tex index 9aa24fd9c8..0a0739adc8 100644 --- a/support/latexindent/documentation/sec-fine-tuning.tex +++ b/support/latexindent/documentation/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/support/latexindent/documentation/sec-references.tex b/support/latexindent/documentation/sec-references.tex new file mode 100644 index 0000000000..ba74633165 --- /dev/null +++ b/support/latexindent/documentation/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/support/latexindent/documentation/title.tex b/support/latexindent/documentation/title.tex index 9384d7b1b9..6e559866e2 100644 --- a/support/latexindent/documentation/title.tex +++ b/support/latexindent/documentation/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/support/latexindent/latexindent.pl b/support/latexindent/latexindent.pl index eedd30b286..d52f46f10f 100755 --- a/support/latexindent/latexindent.pl +++ b/support/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 |