Thanks for coming to InDesignSecrets.com, the world's #1 resource for all things InDesign!

Stand Autocorrect on its ear

While digging for something else entirely, I ran across Ann-Marie’s comprehensive post about the Autocorrect feature…and this got me thinking. I’ve always wondered if there is any way to make Autocorrect add special characters like em dashes, trademarks, or even tabs?

If you try to enter a special character into the Autocorrect dialog box, you’ll get an “Entry contains invalid character” message.

I took this into the Gilbert Consulting labs today, and came up with a solution. You can tweak the XML file that contains the Autocorrect list to contain virtually any characters you can imagine. I’ve only tested this in InDesign CS5, but I suspect it would work at least back to CS3 also. Here’s how:

1. Choose Preferences > Autocorrect, and add at least one autocorrect entry to the list entries that appear there. This will cause InDesign to create a copy of the XML file that contains autocorrect entries. This is the copy that we’re going to edit.

2. To locate the correct autocorrect xml file, find your Scripts panel in InDesign. In the panel you’ll see a “User” folder. Right-click or Control-click on this folder, and choose Reveal in Finder/Reveal in Explorer.

3. In the folder that appears, navigate up the folder tree 2 levels. You should see a folder named after your locale (mine is named “en_US”, as in English, United States). In this folder you’ll see a folder named Autocorrect, and in this folder is the XML file we need to edit, named something like “English USA.xml”.

4. Open this xml file in a text editor. Any text editor that can save a file as plain text will do. I use the Oxygen XML Editor, which makes the file easy to read, but any text editor will do.

5. Add whatever “word pair” entries that you wish to the file. Carefully follow the syntax of the existing entries. Notice that all the entries are alphabetic in the file. This isn’t important. You can put all your entries at the top of the file.

6. The “special characters” that we’re concerned about need to be entered as xml “entities”. These appear as an &# followed by a code and then a semicolon. But how do you know the code that needs to be entered for each special character?

Here are a few:

tab x9

em dash x2014

en dash x2013

trademark x2122

To locate other special characters, you can type the character in InDesign, select it, choose File > Export, choose Adobe InDesign Tagged Text, then Verbose and ASCII for the options. Open the text file that results, and you’ll see a code such as <0x00AE> right after the typeface name. You would then enter this code in the xml file as ® (this is the entity for a registered trademark, by the way).

7. Once you’ve made your entries in the xml file, save it as a plain text file. If InDesign is running, you’ll need to quit it and restart it. You may also need to go to Preferences > Autocorrect, and deselect and reselect the “Enable Autocorrect” option.

Now you should be able to use your new Autocorrect entries complete with the special characters you need! If you accidentally screw things up and butcher your .xml file, you can throw it away, and all that you’ll lose will be your custom entries. The word pairs built into InDesign live in a separate file.

Tags
Related Articles
Comments

6 Comments on “Stand Autocorrect on its ear

  1. It’s slightly easier to get the code for a special character than digging into an exported file :)
    Insert it ‘the usual way’ (using your keyboard or the Glyphs panel), then select just that character. The Info panel will show its Unicode value.
    If you are going to call up the Glyph panel anyway, you don’t even have to insert it first. Hover the mouse over the character and a little pop-up hint will show the code as well.

  2. Awesome. Absolutely!
    Is there opportunity to change the specified word not only for special symbols by means of autocorrect, but also for a specified picture file?

  3. Yes, it does work on CS3. The only differences I found were those below, and they’re really minor (even though the first one might confuse some.

    ? On step 3 I had to navigate up just one level; and
    ? On the same step, the name of the XML file was not abbreviated (mine was “Portuguese Brazilian.xml”).

  4. Thank you Jongware and Marc. Yes, the Glyphs panel and Marc’s quick reference are an easier way to get at the Unicode value of characters. Be sure to include the “x” before the value. So if you see 00A9 in the Glyphs panel or the quick reference chart, it would be entered in the xml file as “©” (without the quotes).

  5. Gah! WordPress changes character entities to their equivalent characters, of course. So the last sentence of my comment above should read “So if you see 00A9 in the Glyphs panel or the quick reference chart, it would be entered in the xml file as “&#x” followed by “00A9″ followed by “;” (without the quotes).

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>