# Mixing uppercase, lowercase, and small caps?

The problem

I want to follow The Economist's example for annoyingly mixed-case words: letterspace them, capitalize the first letter according to normal rules, and set all other capitals as small capitals. And I'd like it to be as transparent as possible – one command, \ac, in the normal case and another, \Ac, when capitalized.

My attempt

In XeLaTeX, \ac can be implemented with a simple font change. But \Ac needs to apply that font change to all but the first letter. I found something similar (the \Upeach command) in a 2007 TUGboat article by Peter Wilson and modified it a little.

\documentclass[12pt]{standalone}
\usepackage{fontspec}

% Define \ac
\newfontface\acface[Letters=UppercaseSmallCaps,LetterSpace=6]{Minion Pro}
\newcommand{\ac}[1]{{\acface #1}}

% Define \Ac
%%% Non-working code removed; see the TUGboat article for the original
%%% Or egreg's answer for a much better solution

The actual questions

1. Is there a simpler way to do this than butchering \Upeach?
2. Can the butchered \Upeach be modified to stop it from eating spaces?
-
What about using the glossaries package with the smallcaps option? It provides \gls which does what your \ac does (with the added bonus of providing the definition upon first use) and \Gls which does what your \Ac does (also provides \glspl for plurals etc.). I assume this is too translucent for you, but just wanted to mention it if you have not considered it. –  mforbes Dec 23 '11 at 5:19
@mforbes With the smallcaps option, \gls makes lowercase small caps. If I \let\acronymfont\ac then \gls makes uppercase small caps. But then \Gls just sets the entire acronym as small caps (i.e., no lowercase or uppercase), which is emphatically not what I want. –  rdhs Dec 23 '11 at 6:03
I was suggesting the other way round: Set the main font \setmainfont[SmallCapsFeatures={LetterSpace=6}]{Minion Pro}, then use the glossaries commands \let\ac\gls, and \let\Ac\Gls. I see that it is somewhat difficult to redefine \acronymfont to select a specific font and to get the capitalization working because of the grouping required to contain the font selection. –  mforbes Dec 23 '11 at 23:41

I'd go with

\makeatletter
\def\Ac#1{\@Ac#1\@Ac}
\def\@Ac#1#2\@Ac{#1\kern.05em{\acface#2}}
\makeatother

Adjust the \kern to match the letterspacing in the second part.

The first letter is typeset "as is", while the rest is subject to \acface.

-
Thanks, I knew there had to be a simpler way. If it's not too much trouble, do you know of any good, basic resources on doing these sorts of manipulations? Right now I'm pretty much hopelessly lost once I see \makeatletter. –  rdhs Nov 29 '11 at 17:17
@rdhs This doesn't work correctly if called as \Ac{P}, but it shouldn't be a problem. I'm afraid that one has to read the TeXbook or TeX by Topic to master this kind of things. –  egreg Nov 29 '11 at 17:26