# Reassignment macro doesn't work inside title, if protected “works” but not styled

A handy macro egreg made works famously, but not so well in titles. \protecting it prevents TeX from dying, but then it seems to be hidden from \spacedallcaps.

\documentclass{article}
\usepackage{xspace}
\usepackage[nochapters,beramono]{classicthesis}

%% from https://tex.stackexchange.com/a/71094/31523
\newcommand{\species}[3]{%
\newcommand{#1}{\gdef#1{\textit{#3}\xspace}\textit{#2}\xspace}}

\species{\ecoli}{Escherichia coli}{E.~coli}
\species{\celegans}{Caenorhabditis elegans}{C.~elegans}
%%

\title{\spacedallcaps{Studying \protect\celegans eating \protect\ecoli.}}

\begin{document}

\maketitle

\ecoli is an example of a model species.  People study \ecoli because
people have studied \ecoli. But \celegans is better.

\end{document}

With \title{\spacedallcaps{Studying \textit{Caenorhabiditis Elegans} eating \protect\ecoli.}} replacing the other \title, it looks more as-intended

• The species names should always be in italics. What do you think the output should be like? – egreg Nov 14 '14 at 23:48
• In any case, the species' name appearing in the title shouldn't be considered the first appearance, so you should simply use the full name in a title. – egreg Nov 14 '14 at 23:56
• You get letter spacing by adding \lsstyle: Studying \textit{\lsstyle Caenor...}} – egreg Nov 15 '14 at 0:20
• another reason for not using any author-defined macro in a title is that, if the paper is to be published in a journal, many publishers provide copies of the contents (and often abstracts and bibliographies) to indexing services, and an unrecognized macro would compromise the usefulness of doing that. – barbara beeton Nov 15 '14 at 16:01

You shouldn't be using the species' name macro in the title, because it surely mustn't be considered the first appearance.

Having a macro in the title is to be avoided because publishers may want to use \title for automatically producing a Web page. In my opinion you shouldn't be using \spacedallcaps in the title, too.

If the paper is for personal use (probably it is, as no publisher would accept classicthesis), use \lsstyle and manually insert the species' names.

\title{%
\lsstyle
STUDYING \textit{CAENORHABIDITIS ELEGANS}
EATING \textit{ESCHERICHIA COLI}%
}

or use \MakeUppercase:

\documentclass{article}
\usepackage{xspace}
\usepackage[nochapters,beramono]{classicthesis}

%% from http://tex.stackexchange.com/a/71094/31523
\newcommand{\species}[3]{%
\newcommand{#1}{\gdef#1{\textit{#3}\xspace}\textit{#2}\xspace}}

\species{\ecoli}{Escherichia coli}{E.~coli}
\species{\celegans}{Caenorhabditis elegans}{C.~elegans}
%%

\title{\lsstyle\MakeUppercase{%
Studying \textit{Caenorhabditis elegans}
eating \textit{Escherichia coli}}%
}

\begin{document}

\maketitle

\ecoli is an example of a model species.  People study \ecoli because
people have studied \ecoli. But \celegans is better.

\end{document}

Beware also of using the macros in section titles. The problem is the same: an appearance there must never be considered the first one. If you have a table of contents you'd have some surprises.