texstudio icon indicating copy to clipboard operation
texstudio copied to clipboard

LaTeX auto insertion of maths delimiters rather than TeX's

Open Atcold opened this issue 2 years ago • 8 comments

Environment

  • TeXstudio: 4.2.2
  • Qt: 6.2.2
  • OS: MacOS 12.2.1
  • TeX distribution: texlive 2021

Expected behaviour

"Auto insert maths delimiters where needed" should add LaTeX maths delimiters \(…\) rather than TeX's $…$, or should let the user choose between LaTeX and TeX.

Moreover, how does one add custom maths to this auto delimiter insertion mechanism?

Atcold avatar Mar 08 '22 22:03 Atcold

You are wrong. $ ... $ can be used in LaTeX in the same way as in Plain TeX. But $$ ... $$ is not recommended for use in LaTeX.

hair-splitter avatar Mar 09 '22 09:03 hair-splitter

\( ... \) is LaTeX syntax. $ ... $ is TeX syntax.

plainTeX only allows $. In LaTeX you can use both, but \( ... \) will give less obscure error messages when there is a mistake inside it.

Both are shortcuts to start inline math environments.

https://tex.stackexchange.com/a/513/33287

Atcold avatar Mar 11 '22 17:03 Atcold

$ ... $ is officially-supported LaTeX2e syntax!

hair-splitter avatar Mar 11 '22 18:03 hair-splitter

Yes, LaTeX does support TeX commands, whereas TeX does not support LaTeX commands. Nothing I wrote seems incorrect to me.

Atcold avatar Mar 11 '22 18:03 Atcold

Your request suggested to me that using $ ... $ in LaTeX is incorrect, it is only correct to use it in plain TeX. I claim that $ ... $ is allowed in LaTeX as well as Plain TeX.

On the other hand, not all Plain TeX methods are supported in LaTeX! For example, $$ ... $$ works in LaTeX but is not supported!

hair-splitter avatar Mar 11 '22 18:03 hair-splitter

I take the feature request as making the delimiters user changeable. However that does not have a priority for me.

sunderme avatar Mar 11 '22 19:03 sunderme

@sunderme, thanks.

Could you also address my question? I.e. how to add custom maths to the auto-insertion of delimiters? Currently, typing \alpha will trigger the insertion of maths delimiters. But this won't happen, say, for \myAlpha. So, where is the list that the auto-insertion is checking? Is it user editable?

Atcold avatar Mar 11 '22 20:03 Atcold

cwl (completion word list) contain a indicator that a command is a math command, see manual/wiki.

sunderme avatar Mar 11 '22 20:03 sunderme