Closed AntoineMissier closed 7 months ago
Many thanks.
I present two options, both give your desired output:
fineTuning:
commands:
name: (?!infty)[+a-zA-Z@\*0-9_\:]+?
namedGroupingBracesBrackets: # <!-- NEW
name: [.a-zA-Z@\*><]+? # <!-- NEW
fineTuning:
commands:
name: (?!infty)[+a-zA-Z@\*0-9_\:]+?
specialBeginEnd:
specialBeforeCommand: 1
The two solutions work fine. I thought the option 2 could break indentation inside a command with braces, but not! Only with square brackets as expected, it's perfect! But I don't understand what causes this issue. Thanks Chris
Great, glad it helped :)
The issue comes from the first line in your code
$f(x)= \dfrac{1}{(1-x)^2}$ on $]-\infty, 1[ $.
^^^
In particular, by default, latexindent looks for 'named braces/brackets' that can have a number in them, such as 1
in your case.
If you specify specialBeforeCommand: 1
then this won't be an issue, because the $...$
will be found first, and then the named braces/brackets routine won't be a problem.
But, if you leave specialBeforeCommand: 0
then we need to tell latexindent that named braces/brackets can not have numbers, hence the fineTuning.
Thanks for the answer :-) Indeed, the problem occurs with the '1['. If I replace $]-\infty, 1[$ by $]-\infty, 1]$, no unexpected indentation is produced. I don't know in which cases a routine to find 'named braces/brackets' could be useful, I think you have good reasons for that and your script is great and really helpful.
Great, glad it works!
Please provide the following when posting an issue:
original .tex code
yaml settings
actual/given output
desired or expected output
anything else
How to completely deactivate any indentation after square brackets, but not with braces?