MathJax icon indicating copy to clipboard operation
MathJax copied to clipboard

Support for the LaTeX package `xparse`

Open MrWhiteRichard opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe. LaTeX Workshop uses MathJax to preview equations when hovering above them. However, when the commands, created with \NewDocumentCommand from the package xparse, are used in the equation, it is not rendered properly in the preview.

Describe the solution you'd like It would make sense to have some support for the commands in xparse, at the very least for \NewDocumentCommand, since it provides one of the best options for LaTeX macros with 2 or more optional parameters; something that is just not possible when using the vanilla \newcommand.

MrWhiteRichard avatar May 05 '21 10:05 MrWhiteRichard

I've also run into a use-case for this. Writing macros without \NewDocumentCommand can be quite cumbersome and implementing xparse would allow a lot more of the snippets with useful commands found around the internet to be used directly in MathJax as well!

JeppeKlitgaard avatar Oct 31 '22 18:10 JeppeKlitgaard

I made a little package implementing some of xparse commands: https://github.com/lucasvreis/xparsejax

A lot of stuff is missing, but I think the most common features (except NewDocumentEnvironment) are there, including specifiers and conditionals.

sophicshift avatar May 13 '23 19:05 sophicshift

This feature would be great, so seconding this! I write my mathematics semantically, so that for example f \tin \continuous{\opensz[D]}{\opens} expands to whatever notation I want to use to denote that f is a continuous function from a subspace D of a space Z to another space. These macros have to be written using \NewDocumentCommand, or otherwise there are numerous problems with robust commands. \NewDocumentCommand is the modern, robust, way to write Latex macros. There is no reason to use \newcommand anymore.

kaba2 avatar Mar 16 '24 14:03 kaba2