0

I am trying to implement the partialderivative macro from the Physics package in MathJax. Based on the response at How to define custom macros in MathJax, I defined pdv: ["{\\frac{\\partial^{#1}{ #2 }}{\\partial{ #3 }^{#1}}}", 3,""], so that \pdv[2]{u}{x} gives the second partial derivative of u with respect to y. However, I am not sure on how to define the macro to get mixed partial derivatives; e.g. in LaTeX \pdv[2]{u}{x}{y} gives the mixed partial derivative of u with respect to x and y. Any help to implement this is appreciated.

user1031565
  • 107
  • 6
  • What have you tried? Add a snippet so people can help you fix the code. – Peter Krautzberger Nov 28 '18 at 16:19
  • I can get mixed partial derivatives by defining a different macro `mpdv: ["{\\frac{\\partial^{#1}{ #2 }}{\\partial{ #3 }\\partial{#4}}}", 4,""]`, but in this case the 4-th parameter is no longer optional (and does not reduce in any case to the desired form). I would prefer not to have to redo my documents to use a different macro for mixed partials. I am not sure if there is a way to use macro "overloading", where a different form is called depending on the number of arguments. – user1031565 Nov 28 '18 at 17:07
  • It's not possible in this simple format. You'd have to write an extension so that you can write a custom function around this. But that's a question that doesn't fit on SO. There's the documentation https://docs.mathjax.org/en/latest/advanced/extension-writing.html and you can ask on the MathJax User Group https://groups.google.com/forum/#!forum/mathjax-users. – Peter Krautzberger Nov 30 '18 at 09:08

0 Answers0