texstudio
texstudio copied to clipboard
Inline math env with wrong highlighting
Environment
- TeXstudio: current dev / 4.6.3
- Qt: 6.6.0 / 6.5.2
- OS: Win10
- TeX distribution: miktex
Expected behavior
No error highlighting
Actual behavior
How to reproduce
Start txs without document. Press Ctrl+N, type doc, press Ctrl+Alt+Space, Enter to select document env, Del to remove placeholder, Ctrl+Shift+M , (, ), /, (, ), twice Crsr right. You may also fill in characters within parentheses pairs. Similar effects have been observed with inline math env. But this one is reproducible for me.
Note: From scratch this issue is reproducible. When you continue editing this mismatch can disappear. This may indicate some internal representation error when the $$ env is inserted.
not reproducible
maybe another time or someone else can reproduce
Since I see this very often I give it a second try. Three notes: When you type $, then \sin(x) then $ everything seems to be fine. By removing \sin(x) you can copy $$to clipboard. Using clipboard to insert $$ shows same issue as using ctrl+shift+m. So it seems that entering $ next to each other is not handled correctly. Inserting and deleting some character near or within the environment or current line normally fixes the issue.
Open a new editor, use ctrl+shift+m, type \sin(x) and then move cursor two times left to the x (i.e. the blinking line is left to the x, s. image). You can even walk around with the cursor and the red coloring appears when the cursor reaches ( or x.
Delete all and you can repeat the procedure. Often it doesn't work the fourth time but works again after that.
It happens that this has side effects: When such a 'defective' inline math env is within another environment (say from ntheorem), then alt+p may not be able do find/highlight the whole env that contains the inline math env and the preview breaks. This is shown here:
Be aware that the \end{Remark} is not within the selection for preview and thus preview fails.
This is reproducible when starting txs with option --no-session
to reproduce Adv. Editor option Auto Complete Parentheses needs to be checked
not reproducible.