I currently fail at creating macros that are capable of simplifying some math notation. I'm using two separate macros. One
\usepackage{xargs}
\usepackage{xifthen}
\newcommandx\vecidx[3][2= , 3= ]{
\mathbf{#1}^{
\ifthenelse{\isempty{#2}}{}{\scriptscriptstyle (#2)}
}_{
\ifthenelse{\isempty{#3}}{}{\scriptscriptstyle #3}
}
}
helps me in writing vector notation.\vecidx{z}[1] gives
$\mathbf_{z}^{\scriptscriptstyle (1)}$, \vecidx{z}[1][ij] gives $\mathbf_{z}^{\scriptscriptstyle (1)}_{ij}$. The other macro is used in partial derivatives
\newcommandx\pd[2][1= ]{
\frac{\partial #1}{\partial #2}
}
Things work as expected as long as I don't pass \vecidx{z}[1] as an argument to \pd, like \pd[\vecidx{x}[1]]{\vecidx{z}[1]} which gives rise to an error Missing } inserted ....
I found that escaping \pd[{\vecidx{x}[1]}]{\vecidx{z}[1]} helps, but all those brackets make it hard to read. Is there anything I can do to simplify the syntax?