5

I need to make a change to a Latex style (.sty) which contains the following line:

{\large {\boldCondensed\color{corporate3Color}\raggedright AUTHORS: \MakeUppercase \@author\par}}

The problem is that when there is a single author, the results prints "AUTHORS: JOHN DOE" with the "S" at the end of authors.

Hence, I would like to find a way to make sure that if there is a single author, the "S" is removed from the header.

How do I recover the number of authors that was provided in the document?

lockstep
  • 250,273
SRKX
  • 2,107

1 Answers1

5

If you delimit multiple authors with \and macro, you can try something like:

\documentclass{article}


\makeatletter
\newcommand\testauthors{%
        \expandafter\tst@au\@author\and\nil%
}
\def\tst@au#1\and#2\nil{%
        \edef\test{#2}%
        \ifx\test\@empty Author\else Authors\fi%
}
\newcommand\printauthors{%
        {%
        \protected\def\and{and }%
        \large {\testauthors: \MakeUppercase{\@author}\par}
        }
}
\makeatother
\begin{document}
  \author{John, Doe \and Corleone, Sonny}
  \printauthors\par
  \author{Doe, John}
  \printauthors
\end{document}

enter image description here

michal.h21
  • 50,697