Closed tdegeus closed 1 year ago
This isn't a bug. I'll explain when I get time :)
To understand this, we reference https://latexindentpl.readthedocs.io/en/latest/sec-the-m-switch.html#onesentenceperline-modifying-line-breaks-for-sentences which details that the oneSentencePerLine
routine happens before the code blocks have been found.
So both of the sentences in the following are put onto one line:
This is a\footnote{
My footnote
}
sentence.
This is a sentence\footnote{
My footnote
}.
and will become
This is a\footnote{My footnote} sentence.
This is a sentence\footnote{My footnote}.
Then, after the oneSentencePerLine
routine has completed, the main code blocks are found, which is when the poly-switches are activated, and you receive
This is a\footnote{
My footnote
}%
sentence.
This is a sentence\footnote{
My footnote
}%
.
As previously, the oneSentencePerLine
routine activates first and will give
This is a\footnote{My footnote} sentence.
%
This is a sentence\footnote{My footnote}.
%
Then, as previously, the main code block routine activates, including the poly-switches. The value of 2
means check if there is a line break or a comment, and if there isn't one, then add one, and then a line break
. It does not find a line break or a comment, so it adds a %
and then a line break.
If you want an option for oneSentencePerLine
to remove all comments within sentences, that could be a thing.
Please provide the following when posting an issue:
original .tex code
yaml settings
actual/given output
Running once (output as expected):
Running twice (comments recursively added):
Running three times (comments recursively added):
desired or expected output
anything else
Following https://github.com/cmhughes/latexindent.pl/issues/414