This sounds like some basic stuff, and yet I cannot manage to find a solution, packaged or native.
I have documents with people who have from 2 to 4 names (typical Danish name could be Søren Jens Sørensen Hjortshøj).
Can someone suggest a command that would extract the initials (first letter) of each of those words ? I know of the package xstring to extract the first letter. The trouble is looping on the words, as I don't know the number in advance.
So the command \initials would act like this :
\NewDocumentCommand{\initials}{m} {
Some code
}
...
\ingenior{Søren Jens Sørensen Hjortshøj}
....
\initials{\ingenior} is SJSH.

\initials{\author}will never work, unless you completely redefine\author. – campa Mar 07 '24 at 08:28(I tend to define \ingenior{Søren Sørensen}, I can use that \ingenior everywhere and then later I assign \author{\ingenior})
– 22decembre Mar 07 '24 at 08:31\authoris the command to set the author (usually by redefining the internal\@author).\authornever returns the author. So\initials{\author}does not make sense. – cabohah Mar 07 '24 at 09:00\authorcommand doesn't contain the author name but set the variable\@author. You should rewrite your example with\initials{\ingenior}. – jlab Mar 07 '24 at 09:02\authorbeen defined. Try\ShowCommand\authorand check the log file, the result is> \author =macro: #1->\gdef \@author {#1}.– Tom Mar 07 '24 at 09:06