I want to use \dss[\Sigma][P][Q][R]
or \dss[\Sigma]{P,Q,R}
or \dss{\Sigma,P,Q,R}
to generate
\[
\iint_{\Sigma} P\mathrm{d}y\mathrm{d}z+Q\mathrm{d}z\mathrm{d}x+R\mathrm{d}x\mathrm{d}y
\]
\documentclass{article}
%\usepackage{xparse,expl3}
\usepackage{amsmath}
%\ExplSyntaxOn
\NewDocumentCommand{\dss}{O{\Sigma}ooo}{\iint_{#1}%
\IfValueT{#2}{#2\,\mathrm{d}y\mathrm{d}z}%
\IfValueT{#3}{+#3\,\mathrm{d}z\mathrm{d}x}%
\IfValueT{#4}{+#4\,\mathrm{d}x\mathrm{d}y}%
}
%\ExplSyntaxOff
\begin{document}
$\dss[D][(x+y+z)][xy][(x-y-z)]$
$\dss[D][][xy][(x-y-z)]$
$\dss[D][][][x-y-z]$
$\dss[D][(x+y+z)][][]$
%or $\dss{D,x+y+z,xy,x-y-z}$.
\end{document}
But if we only have Q and R, then there is no + sign with Q. However, there are many situations and I don't know how to deal with it.
\dss[D][][][x-y-z]
indicates P and Q empty but actually those are T
under the test of \IfValueTF
. But I can't use \dss[D][x-y-z]
since x-y-z will presents P instead of R.
ooo
would be for the syntax\dss[P][Q][R]
but it's usually not a good idea to have adjacento
arguments as it means the first two are not really optional if you want to use the third.\IfBooleanTF{#2}{ if true }{ if false }
would only print #3 and #4 if there had been no previous arguments. Do you want them to show up if they're given?P\mathrm{d}y\mathrm{d}z +Q\mathrm{d}z\mathrm{d}x +R\mathrm{d}x\mathrm{d}y
be encased in a pair of parentheses?