What is the correct way to alias a command to another one?
\newcommand*{\keyword}{\emph}
or:
\newcommand*{\keyword}[1]{\emph{#1}}
Apart from the fact that the second is more explicit, is there any real differences?
The difference will arise when the aliased command takes an optional argument.
\newcommand*\keyword{\othercommand}
will be able to handle any possible optional arguments. But
\newcommand*\keyword[1]{\othercommand{#1}}
will only be able to handle the situation where \othercommand is called without an optional argument.
In the case of \emph, this is not an issue as there is no optional argument to be taken there. So either approach should work fine.
When you are just strictly aliasing, my personal opinion would be to use the first
\newcommand*\keyword{\othercommand}
In a situation where I'm doing something more than just aliasing, I would use
\newcommand*\keyword[1]{\othercommand{#1}}
Purely for example's sake,
\newcommand*\keyword[1]{`\emph{#1}'}
(though others will most likely object that the quotes are unnecessary to \emph
I only mean this as an illustration of what "more than just aliasing" might mean.)
Letting
Since this has come up in the comments, I'll mention a few things about \letting a command.
Sometimes you want to change the default behavior of a LaTeX macro. For example, suppose there is a macro defined as
\newcommand*\somecommand[1]{\emph{#1}}
but you would like it to behave differently. Then you could simply rewrite it as follows:
\renewcommand*\somecommand[1]{\textbf{#1}}
But then you might run into a situation where you would really like to have the original definition. In that case, before renewing the command, you could do something like
\let\oldsomecommand\somecommand
\renewcommand*\somecommand[1]{\textbf{#1}}
Now \somecommand will behave as you wish, but you also have \oldsomecommand as an available command to give you the old behavior.
In a nut shell, by writing \newcommand\keyword{\emph}, \keyword will expand to \emph. By writing \let\keyword\emph, \keyword will expand, not to \emph, but to the definition of \emph.
However, \let is not always able to capture the full power of a command that's been blessed/cursed with optional arguments. There are many posts on this site about how to handle such situations so I'll point you to just a few here:
\letting working around issues involving options.\letting.)
\letting it? – percusse Mar 22 '14 at 15:58\letcommand does not always handle optional arguments correctly considering the different means of implementing optional arguments. – A.Ellett Mar 22 '14 at 15:59\letis not a documented command in the LaTeX manual. – egreg Mar 22 '14 at 16:01\letin his document at all? – Zii8roZi Mar 22 '14 at 16:08\LetLtxMacrothen? – percusse Mar 22 '14 at 16:22\newcommand, in my opinion. – egreg Mar 22 '14 at 16:25