# What's the difference between these kinds of redefinitions?

Trying to implement an own titlepage style I am encountering a few problems.

Specifically I am trying to show the authors in a different style (the show case below is not restricted to \author but works as an example). The idea is to provide a drop in replacement for the titlepage (\maketitle) by reusing the \author macro. I have it working but only for some use cases and I don't understand where the difference is.

The values from the cases A, B, C work with cases 1-3, but I can't get case 4 to work with case C (A & B work). Although it seems reasonable to say the case 3 and case 4 seem to be the same..

What is the magic difference I can't see?

\documentclass{article}

\usepackage{Tabbing}
\usepackage{ifthen}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter

\def\tst@au#1\and#2\nil{%
\edef\test{#2}%
\ifx\test\@empty One \else More\fi%
}%

\newcommand{\@testAuthor}{%
\expandafter\tst@au\@author\and\nil%
}

\newcommand{\@prettyPrintAuthor}{%
\ifthenelse{\equal{\@author}{}}%
{}%
{%
\@printAuthor%
}%
}%

\newcommand{\@printAuthor}[0]{%
\protected\def\and{\\ \> \>}%
\begin{tabbing}%
XXXX \= XXXX:XX \= XXXXXXXXXXXXXXX \= \kill%
\> \@testAuthor: \> \@author%
\end{tabbing}%
}%

\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% case A
%\author{Title First Name}

% case B
%\author{Title First Name \and Title2 First2 Name2}

% case C
\author{\emph{Title} First Name \and \emph{Title2} First2 Name2}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter

% case 1
\begin{tabbing}%
XXXX \= XXXX:XX \= XXXXXXXXXXXXXXX \= \kill%
\> More: \> \emph{Title} First Name \\ \> \> \emph{Title2} First2 Name2%
\end{tabbing}%

% case 2
\let\@temp@and\and
\renewcommand\and{\\ \> \>}
\begin{tabbing}%
XXXX \= XXXX:XX \= XXXXXXXXXXXXXXX \= \kill%
\> More: \> \emph{Title} First Name \and \emph{Title2} First2 Name2%
\end{tabbing}%
\let\and\@temp@and

% case 3
\protected\def\and{\\ \> \>}%
\begin{tabbing}%
XXXX \= XXXX:XX \= XXXXXXXXXXXXXXX \= \kill%
\> More: \> \emph{Title} First Name \and \emph{Title2} First2 Name2%
\end{tabbing}%

% case 4 - this does not work
%\@printAuthor

\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

-
Using \edef\test{#2} when #2 contains \emph is surely bound to give problems. Since you're redefining \author anyway, why not using it multiple times, each time adding to a container? Say \def\author#1{\g@addto@macro\@authors{\@doauthor{#1}}}, so that you can execute \@authors giving \@doauthor the meaning you prefer. –  egreg Mar 29 at 11:04
–  Claudio Fiandrino Mar 29 at 11:14

It is never safe to use \edef on unknown tokens in LaTeX use
\def\tst@au#1\and#2\nil{%

Great! I've been spnding hours to find the problem and got the answer within minutes. Thanks a lot! P.S.: The code with edef origins from: How to count the number of authors of a document? –  kromo Mar 29 at 11:53