is now part of CreativePro.com!

Automating Small Cap Acronyms

23

[This article was written by a guest contributor Sandee Cohen, author of the wonderful InDesign CS5: Visual Quick Start Guide, now available at a store near you!]

Sandee writes…

As a computer graphics author, I type a lot of acronyms in my books and articles: PDF, PSD, CMYK, RGB, JPG, GIF, TIFF, INDD, and so on. Strictly speaking, all of these acronyms should be laid out in small caps as shown in the following illustration.

smallcaps1.png

Using the Small Caps styles, not OpenType All Small Caps

Now, it’s easy to apply the small caps attribute to text by highlighting and applying a character style. And as Anne-Marie wrote in her InDesign Secrets article, (https://creativepro.com/small-caps-vs-opentype-all-small-caps.php) you usually want to apply the Small Caps style, not the OpenType All Small Caps style. And she’s right because the Small Caps style works for both OpenType fonts that have true small caps as well as for fonts that use the electronic scaling to fake small caps.

But I need something more automatic than applying Small Caps to a few words. Almost all the acronyms I type start out as all uppercase letters in my documents. Or I type them myself in uppercase. So I need a way to continue to type the text in uppercase and then have them automatically convert to small caps. Keeping them uppercase becomes an electronic ‘tag’ that identifies them as acronyms.

I’ve basically decided that, in my work, any words that have two or more uppercase letters in a row should be set in small caps. That works for the acronyms in computer graphics as well as generals ones such as USA, IRS, UN, AM and PM.

Switching from Minion Pro to Myriad Pro

For years, when my book was laid out using the font Minion Pro, I used a GREP Find/Change to search for \u\u\u* which translated means find any two uppercase letters that may or may not have another upercase letter after them. Then I applied the OT All Small Caps character style to convert them to small caps.

When InDesign added GREP styles, it was even easier. I created a GREP style that automatically looked for \u\u\u* and applied the OpenType All Small Caps style. This style forces uppercase letters into small caps. It was thrilling as I typed a capital P and then added the capital D and capital F to watch the text automatically jump to small caps.

smallcaps2.png

But for my most recent book project, the body text is Myriad Pro which doesn’t have a true small cap font. So the OT All Small Caps style doesn’t work on the Myriad Pro text. The Small Caps style does work in Myriad Pro, but only on lowercase letters. This was a real problem. It would be far too much work for me to stop typing the acronyms as uppercase letters and switch to lowercase.

I needed a way to convert uppercase acronyms into electronic small caps.

So I thought about what other ways, beside electronic small caps, I could scale text. A smaller point size wouldn’t work as I needed something that would work at many different point sizes. Then I realized that the pedestrian Horizontal and Vertical Scale commands in Advanced Character formatting would do everything I needed. It would apply a scale to the uppercase letters so they resembled small caps. Of course, I know that simply scaling the text down wouldn’t look as elegant as real small caps.

Expanding the Horizontal scale

Then I remembered an old trick from my days of QuarkXPress 3.1 when OpenType didn’t exist. In those ancient times we changed the small caps scaling so that the horizontal scale for small caps was slightly wider than the vertical scale. This could be something as simple as 85% H and 80% V. That extra little scaling was all that was needed to make the fake electronic small caps look a little better.

So I created a character style called Small Caps Myriad. I set the horizontal scaling to 85% and the vertical scaling to 80%. The result is a much better approximation of a true small caps.

smallcaps3.png

smallcaps4.png

Applying the Character Style via a GREP style

I used the Small Caps Myriad character style as the GREP style for the same code as before: \u\u\u*. Once again it is thrilling to watch the uppercase letters magically change size as soon as the second uppercase letter is typed.

Overriding the GREP style

There have been a few times that I’ve had to manually fix this automatic style change. One obvious problem was typing the X and P in QuarkXPress. So I created a character style which consisted of 100% horizontal scale and 100% vertical scale. I could, when needed, apply this style manually to whatever text I didn’t want in small caps. But in the case of XPress, there were too many times I needed to fix the text. And I don’t like stopping as I type to fix the text.

So I created another GREP style for the name QuarkXPress and applied the 100% character style. This GREP style is then positioned below the GREP style for the small caps. InDesign applies the GREP styles in the bottom to top order. Whichever GREP style comes first from the bottom of the list gets applied to the text and doesn’t apply any new GREP styles. So this fixed the XPress text.

smallcaps5.png

Of course I could have created an individual GREP style for every acronym I use. But that list would be endless. There are just too many acronyms. That’s why I like the \u\u\u* code. I don’t have to worry if I have missed an acronym.

Working with this electronic scaling and GREP styles has saved my hours of work proofing to make sure I covered all the acronyms in my book.

David Blatner is the co-founder of the Creative Publishing Network, InDesign Magazine, CreativePro Magazine, and the author or co-author of 15 books, including Real World InDesign. His InDesign videos at LinkedIn Learning (Lynda.com) are among the most watched InDesign training in the world.
You can find more about David at 63p.com

Follow on LinkedIn here
  • Peter Kahrel says:

    Sandee,

    Nice post, thanks. Just tw small comments. “any two uppercase letters that may or may not have another upercase letter after them” is equivalent to “any uppercase letter followed by at least one uppercase letter”, which translates as \u\u+ This is more efficient.

    The other things is that you probably don’t need that second one to exclude “QuarkXpress” and similar words by stipulating that the capitals should be matched only from the beginning of a word: \b\u\u+

  • Igor Freiberger says:

    Scaling this way produces acceptable results. But the effect could be even better if you add a very thin stroke to the same style. This compensates for the reduction in glyph stems and curves.

    I use GREP to apply true small caps not only for two uppercase letters, but also for some situatios with just one. As I work with legal texts, sometimes there are things like 1-F or 2-A, which letter I want to be small caps. There are also rules ordered with Roman Numerals and the same applies. To achieve this I use multiple GREP styles in a paragraph style:

    1. \u\u+
    2. \
    3. (?

    The first style is the usual two-or-more-upercase-letters. The second addresses Roman Numerals equivalent to 1, 5, 10, 50, 100, 500 and 1,000. The third one applies small caps to a uppercase after an hyphen at the end of a word.

    BTW, the lack of true small caps in Myriad is one of the reasons I begun to develop my own fonts.

    • Lara Smith says:

      Hi Igor, I’d love to see the codes correctly, I also convert roman numerals and single uppercase letters (eg. B-52, K-9 250°F). Can you email your GREP searches to me? lara(a)figure1pub.com

  • Igor Freiberger says:

    Ops, the codes were truncated. How to post them correctly?

  • F vd Geest says:

    Or this one:

    \W\u\u+\W

  • F vd Geest says:

    \W\u\u+\W
    Leaves ‘QXPress’and ‘QuarkXPress’ both in tact

  • Peter Kahrel says:

    \W\u\u+\W matches spaces preceding and following acronyms, which could be a problem if you were to apply a character style which sets tracking as well.

  • Sandee Cohen says:

    Oh boy, you let the GREP kids into a discussion and all \Q(hell)\E, breaks loose.

    Seriously, I’m thrilled that others can come up with better GREP codes than me.

    But some of what I did in the article was to teach (Dammit, Jim, I’m a TEACHER, not a programmer!) two ways to override the GREP style. Once by highlighting and applying a character style. Second by using another GREP style below the first.

    Regarding the stroke for text.

    I agree with you Igor. My last book was created using a thin stroke around some text that didn’t have a true small cap. I used the same scaling technique as well as a .25 point stroke.

    It looked great in print. My problem was that most of the people who proof my books view them in Acrobat. And that thin stroke ended up thickening the text onscreen more than it would in print.

    I didn’t want to go down that road because it lead to hundreds of markups from my proofers who thought that a bold had been applied to the text.

    However, my latest project isn’t going to print at all. It is for online viewing as a PDF and eventually an SWF.

    This means that stroking text is going to not be viable at all.

  • F vd Geest says:

    Peter wrote:
    >\W\u\u+\W matches spaces preceding and following acronyms, which could be a problem if you were to apply a character style which sets tracking as well.

    Ah yes, true: tracking would be added to the spaces before/after. And some tracking (10) is many times needed, I agree. So \b\u\u+ is good if you do not need to write ‘QXPress’ and you texts LOL!

  • F vd Geest says:

    Ah, those typos! I wish there was a way to edit posts here… :-(

  • I am very sorry that we have not gotten the “edit your comment” functionality back yet. We are working on that for a future design rev of the site. If it is important, you can always email us at info at indesignsecrets.com and say “please make these changes to this post”.

  • Eugene Tyson says:

    Excellent, great idea – I have plenty of uses for this!

  • Jongware says:

    Anything wrong with \b\u{2,}\b? This ought to pick up any acronym of 2 or more uppercases, and consist only of uppercase.

    It would not work for something like “PDF1.0”, where you’d only want the “PDF” small-capped — then you’d need to bail out early, not on word breaks, but on anything except upper- or lowercase:

    \b\u{2,}(?![\u\l])

    or, using a fancy way of writing [\u\l],

    \b\u{2,}(?![[:alpha:]])

  • Jongware says:

    Slightly simpler (after a good night’s sleep):

    \b\u{2,}(?!\l)

    because, logically, there shouldn’t be an uppercase left to get ignored after a list of all uppercase :-)
    So this will pick up “PDF”, skip “QXPress”, and pick up “EPS-1.0” again.

  • Sandee Cohen says:

    Jong,

    You are amazing!

    I hope everyone realizes the value of this simple code.

  • F vd. Geest says:

    Ah yes, this ons is perfect!

  • F vd Geest says:

    Ah no. not perfect: It sees the first two characters in QXPress as weel.

    I came up with this, using a positive lookbehind/before:

    (?<=\W)\u\u+(?=\W)

    This somes to work, leaves QXPress and QuarkXPress alone AND will NOT apply any tracking to the wordspaces before/after.

  • John Kramer says:

    I have little tolerance for sticklers (purists, quibblers, etc.) unless of course I am the one doing the stickling. Isn’t it true that TIFF is an acronym but PDF is an initialism (that is, pronounced as letters, not sounded like a word)? Some traditional typesetting standards used to make a distinction between the two, using small caps only for acronyms. (I remember noticing it for the first time in a pre-Macintosh New Yorker magazine.)

    Anyway, perhaps we should abandon this practice altogether? Check out this well reasoned post.

  • R Thomas Berner says:

    A minor note, GREP is an acronym, but SWF is an abbrevation. Acronyms are abbreviations that form pronounceable “words” whereas abbreviations don’t.

  • F vd Geest says:

    This one works also (see my altenative GREP above) and catches underscores and numbers in case they are there in a acronym themselfs

    \<\u[\d\u_-]+\>

  • Andrej says:

    very nice.
    but what about if i have something like PDF with an footnote right after?

  • >