Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
It all depends on how authors' names are input. –  egreg Jun 14 '12 at 8:32
1  
You can find other solutions in a similar question: How to choose singular or plural form from presence of \and in argument –  Ignasi Jun 14 '12 at 9:12
add comment

1 Answer 1

up vote 4 down vote accepted

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.