- How to Bookmark and Tag a PDF Using Adobe Creative Suite
- Tips for Blogging from Microsoft Word
- Prepare Your Game Manuscript to Send to Layout Pt. 1
- Prepare Your Game Manuscript to Send to Layout Pt. 2
- Prepare Your Game Manuscript to Send to Layout Pt. 3
- How to Import a Manuscript to InDesign CS6
- The Secret to Simple Manuscript Import with InDesign CS6
- How to Apply GREP Quickly with InDesign Scripts
- Making Magic Happen with GREP
- Keeping Your Text Flow Flowing: Removing Text Dams
- So What Does an Accessible PDF Look Like?
- Layering Your PDFs Using Adobe InDesign CS6
- Why Accommodating Others is Your Best Investment
- Uploading Unwatermarked PDFs to DTRPG
- Accessible PDFs with InDesign Alternatives
- Prepare Your PDF for Print
- Accessible Guide to RPG Layout Now Available
Last week I showed you how to import a manuscript to InDesign CS6 using the standard import dialog. You created Paragraph and Character Styles and mapped them to the styles from the imported document.
It was pretty simple, but it doesn’t always get things right. You may have to do some additional tweaking afterward, and that can take quite a lot of time.
If you’ve followed the past few Tutorial Tuesdays, I’ve been hinting at a way to import a manuscript and apply styles that is quick, easy, and largely automated. It does require some forethought and set-up, but once you’ve figured out the basics it’s hard to want to do it any other way.
Create Your Paragraph Styles and Document Markup
Before you begin importing your manuscript, you’ll want to create your Paragraph and Character Styles. See last week’s post on how to do that.
You’ll also need a document that has been written to include markup. See “Prepare Your Game Manuscript to Send to Layout Pt. 3” for tips on how to properly markup a document using HTML-like tags.
If you’d like to follow along, you can download this excerpted manuscript for Monster Kart Mayhem: Circus Craziness.
This document is pretty simple because it’s a sourcebook for an existing game. I’ve created the following paragraph styles which match the names of the tags used in the document: H1, H2, H3, H4, and Term.
Import the Document
1. Here’s the easy part. Open the document, press CTRL + A to Select All, then press CTRL + C to Copy. Or use whichever method of Select All and Copy you may already be familiar with. (These shortcuts are almost universal in Windows programs and aren’t specific to Microsoft Word. If you’re using a Mac, well, I’m sure there’s some way to do the same thing.)
2. Switch to your InDesign document and press T to select the Type Tool from the toolbar. Place your cursor inside a text frame.
3. Press CTRL + V to Paste the text, or use whichever paste method works best for you.
The text of the manuscript is copied into InDesign.
Note: If the manuscript is pasted with the document’s original formatting intact, you can also right-click and select Paste Without Formatting. You can do the same by press SHIFT + CTRL + V or selecting Edit -> Paste Without Formatting. The key is to import all of the text without any of the original styles.
Apply Styles Using GREP
Finally, here’s the secret sauce I’ve been hinting about for so long. Once you learn how to use and master GREP, your InDesign work days will be much shorter.
What the Heck is GREP?
Wiki tells us:
“Grep is a command-line utility for searching plain-text data sets for lines matching a regular expression. Grep was originally developed for the Unix operating system, but is available today for all Unix-like systems. Its name comes from the ed command g/re/p (globally search a regular expression and print), which has the same effect: doing a global search with the regular expression and printing all matching lines.”
In layman’s terms, GREP is method for manipulating text by using special commands to first search for and then replace text. InDesign implemented GREP back in CS3, so chances are pretty good you’ll be able to use it regardless of your software version.
Applying Styles from the Find / Change Dialog
If you read or watch other InDesign tutorials on the Internet, you will generally find tips on how to apply Character Styles from a Paragraph Styles dialog box using GREP. That’s useful, but GREP is far more powerful. It can be used from the Find / Change dialog to apply Paragraph Styles as well.
It took me a long time to piece together this exact method from the tutorials I consumed, so pay close attention to the following steps.
1. Press CTRL + F or select Edit -> Find / Change. The Find / Change Dialog appears.
2. Click the tab labeled GREP. It’s just to the right of the Text tab.
3. In the Find What field, enter the following GREP expression. It’s important to note the use of parentheses here, and I’ll explain why in a moment:
Test this expression. Press the Find button. InDesign should highlight the first H1 header it finds.
4. In the Change To field, enter the following:
Then click the big empty box beneath the Change Format: heading.
The Change Format Settings Dialog appears.
5.On the Style Options tab, under the Paragraph Style heading, select the H1 style you set up earlier. Then press OK.
6. Click Change.
The selected text changes to apply the Paragraph Style you set up earlier. But do you notice how the <h1> tag disappeared as well? That was the tricky part that took me hours to learn. You’d be surprised at how little this is talked about.
Explanation of the Results
Here’s the short explanation: when you surround a portion of your GREP expression with parentheses, you tell InDesign that it’s a sentence of its own. So in our expression…
…we told InDesign that “<h1>” is a sentence and “.+” is a sentence. “.+” is a wild card. In GREP-speak, it means “search for any type of character – letter, number, symbol, or anything else – (the period) and search for one or more of those characters (the plus sign).
In the Change To field, we told InDesign to only output the second sentence (that’s what we mean by “$2”). When we pressed the Change button, InDesign removed the first sentence (<h1>) and left the second one (.+).
In the Change Format box, we told InDesign to apply the H1 Paragraph Style to the second sentence.
Voila! We just applied a style to a paragraph and automatically removed the HTML tag that went with it.
Now press Change All to apply the style to all <h1> tags in the document.
Lather, Rinse, Repeat
Repeat these steps, but switch <h1> for <h2> and Paragraph Style H1 with Paragraph Style H2. Then repeat for H3, H4, and Term.
Pretty soon, you’ll have a document that went from looking like HTML source code…
…to one that looks properly formatted.
Now you’ve seen how to use GREP to apply styles to markup, but this still seems like a slower way of doing things. This is just the basics, though. Next week, I’ll show you how to use a simple script to automate this entire process. With a little set-up and one double-click, you’ll be able to apply all of the styles at once.
Until then, let me know if you have any questions about this process. GREP is a very powerful tool, usable for far more than just applying Paragraph Styles to text. In the future, I’ll show you some of my favorite GREP tricks as well.
Do you enjoy these Accessible Games Tutorials? They’ll always be free to you, but if you’d like to leave a token of appreciation than please consider donating.
Did you know I’m also available for hire? Contact me if you have a layout project that you’re not ready to tackle yourself.