latexindent.pl
operates by looking for the code blocks detailed in tab:code-blocks
. The fine tuning of the details of such code blocks is controlled by the fineTuning
field, detailed in lst:fineTuning
.
This field is for those that would like to peek under the bonnet/hood and make some fine tuning to latexindent.pl
’s operating.
warning;fine tuning
regular expressions;fine tuning
regular expressions;environments
regular expressions;ifElseFi
regular expressions;commands
regular expressions;keyEqualsValuesBracesBrackets
regular expressions;NamedGroupingBracesBrackets
regular expressions;UnNamedGroupingBracesBrackets
regular expressions;arguments
regular expressions;modifyLineBreaks
regular expressions;lowercase alph a-z
regular expressions;uppercase alph A-Z
regular expressions;numeric 0-9
regular expressions;at least one +
Warning
Making changes to the fine tuning may have significant consequences for your indentation scheme, proceed with caution!
../defaultSettings.yaml
The fields given in lst:fineTuning
are all regular expressions. This manual is not intended to be a tutorial on regular expressions; you might like to read, for example, (Friedl, n.d.) for a detailed covering of the topic.
We make the following comments with reference to lst:fineTuning
:
the
environments:name
field details that the name of an environment can contain:a-z
lower case lettersA-Z
upper case letters@
the@
’letter’\*
stars0-9
numbers_
underscores\
backslashes
regular expressions;at least one +
The
+
at the end means at least one of the above characters.- the
ifElseFi:name
field:@?
means that it can possibly begin with@
- followed by
if
- followed by 0 or more characters from
a-z
,A-Z
and@
- the
?
the end means non-greedy, which means ‘stop the match as soon as possible’
- the
keyEqualsValuesBracesBrackets
contains some interesting syntax:|
means ‘or’(?:(?<!\\)\{)
the(?:...)
uses a non-capturing group – you don’t necessarily need to worry about what this means, but just know that for thefineTuning
feature you should only ever use non-capturing groups, and not capturing groups, which are simply(...)
(?<!\\)\{)
means a{
but it can not be immediately preceded by a\
- in the
arguments:before
field\d\h*
means a digit (i.e. a number), followed by 0 or more horizontal spaces;?,?
means possibly a semi-colon, and possibly a comma\<.*?\>
is designed for ’beamer’-type commands; the.*?
means anything in between<...>
- the
modifyLineBreaks
field refers to fine tuning settings detailed insec:modifylinebreaks
. In particular:betterFullStop
is in relation to the one sentence per line routine, detailed insec:onesentenceperline
doubleBackSlash
is in relation to theDBSStartsOnOwnLine
andDBSFinishesWithLineBreak
polyswitches surrounding double back slashes, seesubsec:dbs
comma
is in relation to theCommaStartsOnOwnLine
andCommaFinishesWithLineBreak
polyswitches surrounding commas in optional and mandatory arguments; seetab:poly-switch-mapping
It is not obvious from lst:fineTuning
, but each of the follow
, before
and between
fields allow trailing comments, line breaks, and horizontal spaces between each character.
warning;capture groups
Warning
For the fineTuning
feature you should only ever use non-capturing groups, such as (?:...)
and not capturing groups, which are (...)
Friedl, Jeffrey E. F. n.d. Mastering Regular Expressions.