latexindent.pl
latexindent.pl copied to clipboard
Preventing indentation of in macro after newline
original .tex code
xxxx-xxxxxxxxxxxxxx xxxxxx xxxxxxxxxx, xx xxxx xxxxxxxxxxx xxxxxxxx \emph{xxx
xxx xxx} xxxxx xxxxxxxxxxxxx, xxxxxxxxxxxxxx xxx xxxxxxxxxx xxx xxxxxxxxxx
xxxxxxxx xxx xxxxxxxxxxxxxxxxxxx xxxxx xxx xxxxxxxx xxx xxxxx xxx xxx
xxxxxxxxxxx xxxxxxxxxxx.
yaml settings
I do have customer settings but the shown indentation stems from the default configuration. I can reproduce it with --onlydefault
.
actual/given output
xxxx-xxxxxxxxxxxxxx xxxxxx xxxxxxxxxx, xx xxxx xxxxxxxxxxx xxxxxxxx \emph{xxx
xxx xxx} xxxxx xxxxxxxxxxxxx, xxxxxxxxxxxxxx xxx xxxxxxxxxx xxx xxxxxxxxxx
xxxxxxxx xxx xxxxxxxxxxxxxxxxxxx xxxxx xxx xxxxxxxx xxx xxxxx xxx xxx
xxxxxxxxxxx xxxxxxxxxxx.
desired or expected output
xxxx-xxxxxxxxxxxxxx xxxxxx xxxxxxxxxx, xx xxxx xxxxxxxxxxx xxxxxxxx \emph{xxx
xxx xxx} xxxxx xxxxxxxxxxxxx, xxxxxxxxxxxxxx xxx xxxxxxxxxx xxx xxxxxxxxxx
xxxxxxxx xxx xxxxxxxxxxxxxxxxxxx xxxxx xxx xxxxxxxx xxx xxxxx xxx xxx
xxxxxxxxxxx xxxxxxxxxxx.
(the same as the original tex code)
anything else
Specifically I would like to not have \emph{}
(and potentially other) macros indented when they contain a newline.
Thank you for your tool and your time!
Thanks for this :)
Does the following help:
https://latexindentpl.readthedocs.io/en/latest/sec-default-user-local.html#commands-with-arguments
See also
https://latexindentpl.readthedocs.io/en/latest/sec-default-user-local.html#summary
More details....
option 1 (emph only)
Using
noAdditionalIndent:
emph: 1
gives
xxxx-xxxxxxxxxxxxxx xxxxxx xxxxxxxxxx, xx xxxx xxxxxxxxxxx xxxxxxxx \emph{xxx
xxx xxx} xxxxx xxxxxxxxxxxxx, xxxxxxxxxxxxxx xxx xxxxxxxxxx xxx xxxxxxxxxx
xxxxxxxx xxx xxxxxxxxxxxxxxxxxxx xxxxx xxx xxxxxxxx xxx xxxxx xxx xxx
xxxxxxxxxxx xxxxxxxxxxx.
but this will only apply to the emph
command.
option 2 (global commands)
Using
noAdditionalIndentGlobal:
mandatoryArguments: 1
gives the same output
xxxx-xxxxxxxxxxxxxx xxxxxx xxxxxxxxxx, xx xxxx xxxxxxxxxxx xxxxxxxx \emph{xxx
xxx xxx} xxxxx xxxxxxxxxxxxx, xxxxxxxxxxxxxx xxx xxxxxxxxxx xxx xxxxxxxxxx
xxxxxxxx xxx xxxxxxxxxxxxxxxxxxx xxxxx xxx xxxxxxxx xxx xxxxx xxx xxx
xxxxxxxxxxx xxxxxxxxxxx.
but this applies to all mandatory arguments.
Let me know if you need anything further :)
@cmhughes Sorry for the late reply and thank you very much for your time! Your suggestion is exactly what I was looking for and it works as expected.