overleaf-textarea icon indicating copy to clipboard operation
overleaf-textarea copied to clipboard

Unbalanced matching of curly brackets

Open dsavchenko opened this issue 5 years ago • 3 comments

If the text in \caption{ } (other environments as well, but appears in captions frequently) contains the closing bracket "}", it is matched instead of the outer one, leading to the subsequent part of the text going to the textarea. BTW, what is the reason behind skipping captions?

dsavchenko avatar Feb 06 '21 13:02 dsavchenko

Hi, can you give a few examples? It is not clear to me what the problem is.

robindijkhof avatar Feb 06 '21 16:02 robindijkhof

Consider following latex \caption{The beginning $a=b_{22}$ and the rest of text}

Resultant plain text will be '$ and the rest of text' instead of either remove or include all the caption.

So the task is to match the outermost bracket of environment, skipping inner uses of them.

dsavchenko avatar Feb 06 '21 17:02 dsavchenko

Unfortunately, this is not something that can be easily done with a regex. Also, I'm not much of a regex expert.

robindijkhof avatar Feb 06 '21 19:02 robindijkhof