How to Add a Rule Around a Paragraph
At the InDesign Conference in Denver, I showed attendees how to add an automatic rule around a paragraph using an admittedly strange, but effective technique. The details are pretty non-obvious, so I promised this detailed follow-up post.
It is a multi-step procedure to set up this trick, but once you’ve created it and saved it in a paragraph style, it is effortless to use.
For this example, I’m going to create a 2-point black rule around a paragraph. But this technique works with rules of any weight and color.
Using Paragraph Rules and Shading to Add a Box Around a Paragraph
1. Create a paragraph style named “Body text, boxed” that has paragraph rules above and below. Use Left Indent, Right Indent, Space Before, and Space After to “inset” the paragraph text away from where the rules are going to be.
2. Measure the width of your column. My column is 225 points wide.
3. Divide the weight of your rule by the width of your column, and multiply by 100. So in my case: 2 / 225 * 100 = .89
4. Choose New Gradient Swatch from the Swatches Panel menu
5. Create a new linear gradient swatch called “Rules” that has 6 “stops” on the Gradient Ramp. To create a new gradient stop, just click below the gradient ramp. These stops, from left to right, should be black, black, white, white, black, black (or substitute your stroke color for black, and whatever color you want for the box background for white). The location of the gradient stops is not important at this point, only the order from left to right.
6. Now, working from left to right, select the first gradient stop, and enter 0% for the location
7. Select the second gradient stop, and enter your value from step 3 (.89 in my case)
8. Select the third gradient stop, and enter the value from step 3 for this stop also
9.Select the sixth gradient stop (the one furthest to the right, and enter 100% for the location
10. Select the fifth gradient stop and enter (100 – your value from step 3) (99.11 in my case)
11. Repeat for the fourth gradient stop
12. Click the OK button. So now we have a gradient that goes from black to black, and then goes immediately to white with no transition, and then returns to black the same way.
13. Edit your “Body text, boxed” paragraph style to use the “Rules” gradient swatch for the Paragraph Shading color. You will probably need to adjust the Top and Bottom Offsets so that the vertical rules line up with the rule above and rule below.
Of course, the whole point of this is that now you have a paragraph style that can be applied to paragraphs of any length, and they will be boxed automatically. The box will grow and shrink as the paragraph is edited.
I’ve noticed that at as I zoom in and out that sometimes the right side rule appears slightly thinner than the left side rule. But this seems to just be a display issue. If I zoom all the way in on a corner of the box, the rule weights match perfectly.
In terms of output, the effect will look great in print, PDF, or Fixed-Layout EPUB. But don’t use it for a reflowable EPUB unless you’re OK with rasterizing the entire text frame to preserve its appearance. Also note that if you resize the width of the column, you’ll need to go back and recalculate the position of the gradient stops, and edit the gradient swatch accordingly.
Wow, that’s cool but wouldn’t be simpler to place your copy inside of a table with borders?
This is an unbelievably amazing tip. Got huge applause at The InDesign Conference last week!
Greg: the single-celled table trick is good, but there are a number of benefits of doing it this way, including:
a) it can be a paragraph style
b) it can span more than one column (or page)
and c) it doesn’t break footnotes.
Very cool! I wonder if anyone has worked out a way to combine this with underline to create a hacked shaded box.
@Prescott: You can add “shading” to this box by just substituting whatever color or tint you want for the box shading for white in the instructions. Or are you referring to something else?
I agree with Greg. A table with a border is a much simpler solution than that convoluted process.
A table with a border may be simpler for a single use, but for updating existing styles, this trick is AMAZING! I have a 400 page book, filled with a bunch pf paragraphs that I’ve always wanted a border around (but didn’t want to create dozens and dozens of tables to do so). So I made myself a new gradient, using the method Keith outlines above, then updated the paragraph style, synchronized the book, and voila! Dozens and dozens of my paragraphs now have borders around them, just as I’ve always wished they had. Saved me HOURS of work! Thanks Keith!
I’m glad to hear someone used this for a “real world” project. Thanks for letting me know, Kelly!
I dont seem to have an option for paragraph shading menu. Which InDesign version is this?
ID CC 2015.1 (11.1)
Hi Keith,
This would be a great solution to the issue of not being able to insert footnotes into a table. is there any way to do is in cS6? There is no paragraph shading option as far as i can tell in CS6.
Thanks!!!
This is very cool Keith :D
This is so clever. It’s one of those tricks I wish I had thought of myself. A word of caution–it won’t work epubs. For ebooks stick to the single-cell table trick.
Thank you Keith!
I have a question: if the paragraph is at the end of a page and at the top of a next page, it is possible to have the paragraph rule at the end of the page and at the top of the next page? Now I have at the first page a box without the rule below and at the second page a box without the rule above. Thank you!
I’m sorry, because this is using the automatic paragraph shading feature of InDesign, there isn’t a good way to do this. Paragraph shading is set up to “span” page breaks if a single paragraph spans 2 pages. So this paragraph rule trick does the same thing.
thanks for your answer
I have “paragraph rules” applied to the heads in my ID document, however when I export to reflowable ePub they disappear. Is there a workaround for this? Thanks a bunch.
I publish 2 small monthly newspapers, both with a classified ads section. The advertisers have an option to “box” their ad for an additional charge. What a PITA this used to be! With this technique, i no longer have to copy/paste and drag boxes to fit around ads. This has saved me countless clicks and LOTS of time. Thanks so much for sharing this trick!