The routine \justfirst
needs its argument not in braces, but terminated by a known quantity. Thus, \firstinit
conspires with \justfirst
, unbeknownst to the user, to provide it just so, with a \relax
as the terminator, because it is unlikely to show up in user text.
\documentclass[]{article}
\def\firstinit#1{\justfirst#1\relax}
\def\justfirst#1#2\relax{#1}
\begin{document}
This prints \firstinit{just the first letter}.
My hero is \firstinit{John} \firstinit{Paul} Jones.
\end{document}

Of course, if you meant for multi-worded phrases to output the first letter of each word, that is slightly more difficult. REVISED to take advantage of recursion; RE-REVISED to eliminate use of packages. RE-RE-REVISED to prevent defeat by a "llama".
\documentclass[]{article}
\def\firstinit#1{\justfirst#1 \relax\relax}
\def\justfirst#1#2 #3\relax{#1\if\relax#3\else{} \justfirst#3\relax\fi}
\begin{document}
This prints \firstinit{just the first llama in the list}.
My hero is \firstinit{John} \firstinit{Paul} Jones.
\end{document}
