[Tex/LaTex] Mixing uppercase, lowercase, and small caps

acronymssmall-capsxetex

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?

Best Answer

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.