A user on Chemistry SE mentioned a very nice shortcut to use in implementing a command for partial derivatives (see comments section of question: https://chemistry.stackexchange.com/questions/126955/proving-a-thermodynamic-relation-between-partial-h-partial-t-p-and-part):
Suppose you want to create the following partial derivative:
\left(\frac{\partial U}{\partial p}\right)_{\!T}
using this command:
\newcommand{\pd}[3]{\left(\frac{\partial #1}{\partial #2}\right)_{\!#3}}
The standard use of the command would be:
\pd {U}{p}{T}
However, since each argument is only a single character, this is sufficient:
\pd UpT
If one needs to typeset numerous partial derivatives, this is a great time-saver.
Indeed, you can even use a hybrid approach, where braces are eschewed for single-character arguments, but used for multi-character arguments. For example, to implement this:
\left(\frac{\partial U}{\partial p}\right)_{\!T, n_i}
One would write this:
\pd Up{T, n_i}
This seems to leverage what is a standard shortcut in LaTeX for single-argument commands (e.g., we drop the braces when the argument of a superscript or subscript command has only one character). But, for this usage (multi-argument user-defined commands) are there cases in which this (seemingly non-standard) approach would create a problem?
\frac12for a half for example but it is poor style and eventually makes the source harder to read. It may also fail with various latex-to-xxx convertors which may not be expecting this, – David Carlisle Jan 25 '20 at 20:11