About
Shop
LaTeX
Software
Books
Gallery
News
Contact
Blog
Settings
Account
Latest news 2024-12-13: Ebook sale (12th December 2024 – 1st January 2025): cybercrime fiction short stories Unsocial Media and Smile for the Camera free; crime fiction short story The Briefcase free; short story noir crime fiction I’ve Heard the Mermaid Sing free; crime fiction novel The Private Enemy US$1.99; illustrated children’s story The Foolish Hedgehog US$0.99.

List of Names

\documentclass{scrartcl}

\usepackage{etoolbox}

% set up defaults so we don't get an error
% when we try to redefine these commands
\newcommand*{\surnamesep}{}%
\newcommand*{\lastsurname}{}%
\newcommand*{\prelastsurname}{}%

% define the handler macro:
\newcommand*{\dodisplayname}[1]{%
  \surnamesep
  \lastsurname
  \renewcommand{\lastsurname}{%
    \renewcommand{\surnamesep}{, }%
    \renewcommand{\prelastsurname}{ and }%
    #1%
  }}%

% define the new command to process a list of names:
\newcommand*{\displaynames}[1]{%
  % initialise:
  \renewcommand*{\surnamesep}{}%
  \renewcommand*{\lastsurname}{}%
  \renewcommand*{\prelastsurname}{}%
  % Iterate through list
  \forcsvlist{\dodisplayname}{#1}%
  % Finish off:
  \prelastsurname \lastsurname
}

\begin{document}

\displaynames{Parrot,Canary,Zebra,Arara,Duck}

\end{document}

Download namelist.tex or namelist.pdf.

© 2015 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Cookies Site Map FAQs