Even without
\vphantom, you're in trouble here because you haven't used custom made commands correctly. What I mean is that
{\anniu{k}
}^2 is just wrong for the purpose because it is not the same as
u_k^2 but actually
{u_k}^2.
So, when you're using custom made commands which may have a second argument too, you may define them with two arguments and a default value for times when only one argument is specified (but which is ignored when you actually do specify both arguments), something like this:
Code: Select all
\documentclass{book}
\newcommand{\creau}[1]{u_{#1}^*}
\newcommand{\anniu}[2][\vphantom{*}]{u_{#2}^{#1}}% Inside the second square brackets set comes a default value
\begin{document}
$\creau{k}-u_k^2-{u_k}^2-\anniu{k}-\anniu[2]{k}$
\end{document}
So, in the example,
\anniu{k} will result in
u_k^{\vphantom{*}} (since only one argument is specified so the default value is in effect), while
\anniu[2]{k} will give
u_k^2, ignoring
\vphantom{*} completely because both arguments are explicitly given.