3

I work in a field with heavy use of acronyms. To make my documents visually more appealing, I like to use a moderate downscaling of the capital letters.

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage{tgtermes}
\usepackage{graphicx}

\newcommand{\acr}[1]{\protect\scalebox{.93}{#1}}        

\begin{document}

Just a few words to see the scaling of an acronym such as \acr{GEP}. With the scaling, the acronym obviously blends in better with the rest of the text.

\end{document}

For several reasons (e.g. exchange with coauthors), I would prefer the insertion of the command to happen automatically – e.g. just writing "of an acronym such as GEP". This would require (La?)TeX to automatically find successive capital letters and insert a previously defined macro.

Is that possible? If yes, how?

(Extra points if the scaling factor of \scalebox could depend on the number of successive capital letters.)

  • That sounds more like a problem for sed or awk (or Perl, etc.). There is also the LaTeX3 package l3regex, but I haven't looked at it yet, so I don't really know how relevant it might be.... – jon Aug 9 '13 at 14:18
  • 6
    No, it's not possible to make LaTeX recognize clusters of letters as acronyms. Using a macro is necessary and also better, because you're marking exactly what you want. – egreg Aug 9 '13 at 15:36
  • 1
    Aside: shrinking capital letters is a poor substitute for a real small caps shape. – Joseph Wright Aug 9 '13 at 17:56
  • @JosephWright: I guess he don’t wants small caps but smaller caps ;-) They should be recognized as real caps but a little (0.93 times) smaller than the normal caps, because otherwise they stand out on the page. And it’s not that uncommon do do it … – Tobi Aug 9 '13 at 20:57
  • @Tobi Yes, but that's a decision for the font designer :-) – Joseph Wright Aug 9 '13 at 21:02
1

No, it's not possible to do what you ask for, unless you completely change TeX's way of parsing input, examining token by token the text. However I'm afraid this would break infinitely many constructions of LaTeX. It might be possible with LuaTeX, but some expert's advice would be needed.

Marking the input with a macro is the really practical way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.