# Automatic letterspacing of capitals

I have a very large text corpus that I am fine-tuning for typography among other things. From what I know, abbreviations, such as ACAB, need to be letterspaced. I have found somewhat convincing settings, but! My current setup needs me to say \track{ACAB} around each abbreviation. I fear that I omit it somewhere and the text would look not consistent. Further, it's a hell lot of work to insert it where it is not inserted yet. As of now I have set my \track macro to do nothing and look for other options.

Is there a way to automatically letterspace a set of consequtive capital letters? It would be some kind of scaling the kerning pairs on capitals or something like that. I would rather not increase the inter-letter space around the capitals, as it works everywhere and not only is the next letter is a capital too.

I am not a fan of using small capitals for abbreviations – yeah, I know, but typography is also a matter of taste, and my taste in the particular application and font says no. So, the abberiations in question are merely typeset in capital letters in the text body font. If there were consequently a LaTeX macro around them, I would have handled it already.

Again: I am looking for a global kerning solution that does not require a macro around each abbreviation that needs to be adjusted. Is it possible at al in pdfLaTeX and microtype?

To give an example:

\documentclass{article}

\usepackage[activate={true,nocompatibility},kerning=true,spacing=true,tracking=true,final]{microtype}
\microtypecontext{spacing=nonfrench}

%% this is my font setting, can be disabled if the font is not there
\usepackage[garamond]{mathdesign}
\usepackage[full]{textcomp}
\usepackage[swashQ]{garamondx}
\usepackage[T1]{fontenc}
\usepackage[supstfm=NewG8-sups]{superiors}

%% the old solution
%% requires putting the \track macro around each abbreviation
%% this is too much work and also error-prone
%\DeclareRobustCommand{\track}[1]{\textls[20]{#1}}
\DeclareRobustCommand{\track}[1]{#1}

%%%%% fix protrusion on right margin for superscript
%%%%% http://www.khirevich.com/latex/microtype/
%%%%% a VERY minor font tuning, can be disabled
%%%%% I do not want to use a similar solution also for capitals,
%%%%% as it would increase the space for capitals everywhere,
%%%%% and not only in abbreviations
\SetProtrusion{encoding={*},family={zgmx},series={*},size={6,7,8,footnotesize,small,scriptsize}}
{+={ ,400},-={ ,550},
1={ ,750},2={ ,500},3={ ,500},4={ ,500},5={ ,500},
6={ ,500},7={ ,600},8={ ,500},9={ ,500},0={ ,500}}

\begin{document}

\thispagestyle{empty}

Thus, arteriolar endothelia were described to express Sca-1, but not
VEGFR3 or CD201, while sinus endothelia were positive for VEGFR3 and
CD201, but not for Sca-1. Tie-2 (CD202b) was preferentially detected
in arterial, but not in sinusoidal endothelial cells In humans, bone
marrow microvessels have up to now been primarily demonstrated in
small paraffin-embedded biopsies using monoclonal antibodies (mAbs) to
CD34. We have now used undecalcified serial sections of a
representative iliac crest specimen spanning about FOOBAR and a
combination of antibodies against CD34 and CD141 to analyse the 3D
arrangement of microvessel endothelium in human bone marrow.

\end{document}


Update: I am now in the re-evaluating session whether I need to letterspace at all. Admittedly, non-letterspaced acronyms look a bit ugly, but most other options are also not quite endearing. Here is a screenshot, my way of manual letterspacing and a hackish-ly ported version of tugboat's acronym rendering.

Full tracking is \textls from microtype, "my" tracking is \DeclareRobustCommand{\track}[1]{\textls[20]{#1}}. "Tracking" is not quite suitable, probably the better name is "kerning" or "caps letterspacing"...

%%%% tugboat abbrevs
%\def\smc{\sc}
\def\ninepoint{\small}
\DeclareRobustCommand{\tugSMC}{%
\ifx\@currsize\normalsize\small\else
\ifx\@currsize\small\footnotesize\else
\ifx\@currsize\footnotesize\scriptsize\else
\ifx\@currsize\large\normalsize\else
\ifx\@currsize\Large\large\else
\ifx\@currsize\LARGE\Large\else
\ifx\@currsize\scriptsize\tiny\else
\ifx\@currsize\tiny\tiny\else
\ifx\@currsize\huge\LARGE\else
\ifx\@currsize\Huge\huge\else
\small\tiny%% haaack!
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
}
% \newcommand{\SMC@unknown@warning}{\warning{\string\SMC: nonstandard
%     text font size command -- using \string\small}}
\newcommand{\textSMC}[1]{{\tugSMC #1}}
\newcommand{\acro}[1]{\textSMC{#1}\xspace}
% \newcommand{\track}[1]{\textls[20]{\acro{#1}}}


So, now I am not only pondering on "how to do it", but also on "whether should I do it at all". Sorry for the inconvenience, folks.

• I don't think that you can do it on-the-fly with pdflatex, you would have to manipulate the tfm-files to add the kerning -- possible but quite some work if a number of fonts are involved. With lualatex you can add more kerning pairs as described e.g. here tex.stackexchange.com/questions/312154/…. But I would use a semantic command -- not only for the tracking but as it also allows you to create the index and perhaps an abbreviation list. With suitable editor shortcuts it is not much work. – Ulrike Fischer Sep 6 '17 at 17:29
• Maybe this can help you: tex.stackexchange.com/questions/165218/… You would have to adapt the Lua code to check every word for being all upper case. If it is, return it wrapped into a macro. If your document is large, the performance hit may be noticeable though. – Michael Palmer Sep 6 '17 at 19:09
• the tugboat editors don't like regular small caps for acronyms and suchlike, but they don't like all caps either (too large and intrusive). so they defined a macro \acro that sets the argument as all caps "one size down". you are welcome to look at that definition (in ltugboat.cls) and adapt it if you find it useful. – barbara beeton Sep 6 '17 at 19:34
• @barbara beeton: thank you for the suggestion. I ported it back to my document. I am evaluating now if I should bother with a global semantic command, as other commenters here suggested. I will update the question with my results so far, but they are not encouraging. – Oleg Lobachev Sep 6 '17 at 20:28
• You shouldn't need to wrap every occurrence in a macro by hand. Just pre-process the document using a suitable find-and-replace regex (in your editor, sed or whatever). – cfr Sep 6 '17 at 22:12