Tips for creating InDesign templates with automation in mind

InDesign is a powerful design and production tool with a myriad of advanced features. Many of these features are accessed through repetitive manual clicking and keyboard shortcuts. Wouldn’t it be great to automate this tedium? Well, the good news is that you can!

By using improved setups of styles and panels that enable scripting, and by applying GREP (Global Regular Expression Print), it’s possible to save yourself from these endless repetitions. You’ll still be able to produce the same results, but the amount of effort you’ll need to put forth will be greatly reduced.

Below are some techniques to help you on your path to doing more with your InDesign templates.

Learn GREP!

GREP is an advanced pattern-based method for manipulating and formatting text. It is essentially a search tool that you can use to find patterns in text, then apply styling on the fly or make changes to the text. Even a basic knowledge of GREP can save you a lot of time. It’s a great tool to up your InDesign skills and take the grunt work out of repetitive and tedious tasks.

You can also take it a step further by combining GREP with scripting – this will allow you to make multiple changes instantaneously. InDesign’s FindChangeList script (Script panel > Samples) is a powerful script that you can start using right now. This script enables you to string many “Find and Change” queries together and run them against your document in a single go.

To find out more about GREP, Peter Kahrel’s Getting a grip on GREP is a great primer. Peter explains how to formulate GREP search patterns that are much more powerful and useful than InDesign’s standard search-and-replace tools.

Use GREP styles, but with care

InDesign’s Paragraph Style GREP styles feature obviates the need for scripting in many circumstances, but this can come with performance penalties. That is because the GREP style is triggered every time a story is changed.

In InDesign, a “story” can be as small as a single text frame – but for long documents, this could be tens or hundreds of pages with vast numbers of linked text frames. Any time a story is “touched” (a change is made) either manually, by GREP styles in paragraph styles, or via scripting, InDesign re-composes the story. This could take quite a while for complex documents with long chains of linked story frames. For that reason, GREP styles are more suitable in short stories, e.g. figure captions that sit in separate text frames, tables of content and indexes.

For InDesign documents with long stories, applying formatting through a GREP search-and-replace or automating with a script is more efficient. With this method, the style or formatting is applied once, rather than re-applied via the paragraph style’s GREP styles every time there is a change to the story.

Base styles on other styles

This is not so much an automation tip but a technique to reduce complexity in InDesign documents. InDesign styles have seemingly endless options – paragraph styles alone have nearly 350 options! When a new style is created, without basing it on another style, InDesign copies all those hundreds of default options into the new style. However, when you create a style and base it on another style, only the options which are defined in the base style are copied to the new style.

Rather than setting all the various options (font family and style, point size, keep options, etc.) manually when creating a new style, it’s preferable to create a base style instead. Then, for each similar paragraph style you create, base it on the base style – this will carry over all the base style options to the new style, and prevent you from adding hundreds of default options you don’t need. That way, you won’t have to spend time updating every option for every similar style you create.

Another major advantage of using base styles is that if an element of the style needs to change, such as the font family, it will ripple through to all the other styles based on that style. That means you only need to change one style (your base style) rather than all the related styles.

To maximise your time savings, you might want to create base styles for different categories of styles, e.g. body text, lists, headings and tables. Then, you can use these as base styles when you create new styles for these elements. This will save you significant time versus creating all your styles individually every time you need a new one.

Use a system for naming styles

Using a systematic method for naming styles is closely tied to base styles. When items need to be selected, having a common prefix or suffix makes it easier for a human or a script to find them. This will also save you heaps of time when you need to apply a GREP style.

A common example is a figure made up of a grouped image and caption, each with their own frame. In a case like this, it’s helpful to use style names which reflect both the larger element (figure) and the sub elements (image and caption). So, the frames can have object styles called “figure_caption” and “figure_image”, and the caption paragraph style could also be called “figure_caption”. However, if you are planning on exporting to HTML or EPUB, you should consider expanding the naming so that the object style name related to the caption is not the same as the associated paragraph style. For example, using “figure_caption-frame” and “figure_caption-text” could make your CSS more semantic.

A more complex example would be a floating panel containing an icon, heading, body text, image, and caption. In this case, it’s preferable to use abbreviations – that way, the style names won’t become too long and unwieldly. For example, for the icon you could use “fp_icon”, then for body text use “fp_body”, and for the image use “fp_image”.

Name page items on the Layers panel or the Script Label panel

The InDesign Layers panel allows you to name page items, that way they are easier for scripts to find – but you can only set relatively short names of 100 or fewer characters in the Layers panel. If you need more complex identifiers, you can add a name to the page item in the Script Label panel (this allows for names of 2000+ characters).

Finding a page item using its name on the Layers panel is quicker but using the Script Label panel makes for more versatile handling as it allows you to give the label content some basic structure. For example, in the Script Label panel, you could apply a name like “type: side-bar; category: teacher-note”.

Avoid style groups as much as possible

Creating style groups within the various InDesign styles panels can make it easier for a human to locate specific styles. The concept is just like moving files into a sub-folder on your hard drive. It’s a handy technique to sort styles and reduce scrolling when you (a human) are working on projects with a lot of styles.

While style groups do make it easier for humans to manage extensive style libraries, they make scripting more complicated as scripts need to recursively drill down through each style group one at a time to find a style. In scripting terms, this is “expensive” and much less efficient than if the style structure was “flat” with no style groups.

In terms of scripting, using a system for naming styles as mentioned above is much better than using style groups to organise your styles. Your scripter will thank you!

Design with automation in mind and save time!

Adding some automation to your InDesign workflows will save you heaps of time and keep you from repeating the same steps over and over. Start by learning GREP and basic scripting and you’ll be well on your way to making InDesign work for you. Just remember to create your documents with automation in mind so you get the most out of these powerful capabilities.

Are you currently using any automation in your InDesign workflows? Do you have any InDesign automation tips to share? Let us know in the comments!

Damian Gibbs has been involved in the publishing industry for over 20 years, beginning as an apprentice typesetter. He now works as a Solutions Consultant at Typefi, where he specialises in developing and supporting automated workflows for standards publishers.