Closed tdegeus closed 1 year ago
This seems related to https://github.com/cmhughes/latexindent.pl/issues/418
Here I am suggesting that it would be very nice to have the option to have oneSentencePerLine
simply act as if a command is not there altogether everywhere in the formatted file.
Instead, in https://github.com/cmhughes/latexindent.pl/issues/418 I am suggesting that it would be good to have the option to switch of (a part of) latexindent.pl
on a specific line of code.
As of https://github.com/cmhughes/latexindent.pl/commit/167c88ef353ce5bdc2266eb4ff205b1d66715aef I've implemented a new feature sentencesDoNOTcontain
.
The default is
sentencesDoNOTcontain:
other: \\begin # regex
which means that sentences do not contain \begin
Starting with your file, and using
modifyLineBreaks:
oneSentencePerLine:
manipulateSentences: 1
sentencesDoNOTcontain:
other: \\TG
and the output is
\section{Foo?
Bar?
}
I do not\TG{?} want this to change.
But this should change.
If we want the output that you've specified, then we can use
modifyLineBreaks:
oneSentencePerLine:
manipulateSentences: 1
sentencesDoNOTcontain:
other: |-
(?x)
(?:
\\begin
|
\\TG
)
sentencesFollow:
questionMark: 0 # 0/1
other: |-
(?x)
\h+[a-zA-Z]+?
\?
and then we receive
\section{Foo? Bar?}
I do not\TG{?} want this to change.
But this should change.
I'll get this released soon.
I like
modifyLineBreaks
a lot, but I do find that it is a bit too aggressive in some cases. I would like to be able to exclude specific commands from the line break manipulation. For example, the settings could be as follows:original .tex code
yaml settings
actual/given output
desired or expected output
anything else
@cmhughes Sorry for the amount of issues. They have been accumulating for a while, as I had little time to prepare minimal reproducers.