Tuesday, March 30, 2010

Indesign dates

I want to ensure that every time that I write a date in the style ''9th June'' (for example) that the letters ''th'' (or ''st'', ''nd'', ''rd'' etc) appear in superscript. I know I can do this by hand but how can I do this automatically in Indesign?

Indesign dates

Use a GREP style in the paragraph styles where you want this (CS4 only). It's just a case of looking for

\d(st|nd|rd|th)\%26gt;

and applying superscript with a character style. Note that will also pick up malformed text such as ''10nd'', but I suspect the only way to avoid this will need a long, long list of GREPs.

For CS3, you need to search and replace manually; the procedure has been described in detail here: http://forums.adobe.com/message/2150663

For even older IDs, you cannot use GREP replacing. In that case I think a script could work.

Indesign dates

Thanks for the GREP - its nearly there but for the ''9th'' it puts the 9 in superscript and for the 26th the 2 stays ''normal'' while the 6th goes superscript

You can do this with GREP styles

Make or modify a character style using superscript (under basic character formats, position). Make another without superscript (position normal).

Now make or modify a paragraph style. Go to GREP style. Apply the new character style with superscript to text \d+st. Make additional GREP styles using nd, rd, th.

Finally add one last GREP style with the normal, to \d+. This way the numbers won't get superscripted.

Five GREP styles total, within the paragraph style.

When this paragraph style is applied to the text, the st, nd, rd, and th following numbers will automatically be superscripted.

Hey, jongware, shouldn't that expression have a positive look behind to format only the ordinals without touching the digits?

Jongware beat me to it, his GREP is more concise. It make take two GREP styles total, one to keep the numbers normal, the other to superscript the letters.

Thanks Printer_Rick

In fact using [Jongware]'s compound GREP solution (rather than doing all 4) with your ''normal'' solution as the next expression seems to work just right.

Hi,

in Find what : (?%26lt;=\d)(st|nd|rd|th)

in Change by : apply your style

Laurent


[Jongware] wrote:

Note that will also pick up malformed text such as ''10nd'', but I suspect the only way to avoid this will need a long, long list of GREPs.

Oof! Yes, a ''lookbehind'' for the number ... (How on earth did I miss that!?)

[Jongware] wrote:

Oof! Yes, a ''lookbehind'' for the number ... (How on earth did I miss that!?)

No comments:

Post a Comment