I want to define a new macro that gets an optional argument X and a citation key Y. If only Y is present it prints
\cite{Y}
If, however, also X is present it prints
X, \cite{Y}
This should in principle be done with the simple syntax of \newcommand
which allows one optional argument with a default value which could be empty. But how do I get rid of the straying comma? Or maybe there is a way to do this with the citation command?
I've seen more general answers for the question of how to define a new command which behaves differently with and without an optional argument, but these answers seem to be quite more sophisticated than what I need here.
biblatex
's citation commands, the pre-note does something quite similar:\cite[Cf.][]{sigfridsson}
.