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

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.

Screen Shot 2015-11-19 at 9.40.21 AM

Screen Shot 2015-11-19 at 9.41.15 AM

Screen Shot 2015-11-19 at 9.38.17 AM

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.

Screen Shot 2015-11-19 at 9.49.34 AM

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)

Screen Shot 2015-11-19 at 9.56.36 AM

8. Select the third gradient stop, and enter the value from step 3 for this stop also

Screen Shot 2015-11-19 at 9.57.59 AM

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

Screen Shot 2015-11-19 at 10.01.20 AM

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.

Screen Shot 2015-11-19 at 10.09.08 AM

Screen Shot 2015-11-19 at 10.11.06 AM

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.

Screen Shot 2015-11-19 at 10.15.45 AM

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.

Keith Gilbert

Keith Gilbert

Keith Gilbert is a digital publishing consultant and educator, Adobe Certified Instructor, Adobe Community Professional, conference speaker, lynda.com author, and contributing writer for various publications. His work has taken him throughout North America, Africa, Europe, and Asia. During his 30 years as a consultant, his clients have included Adobe, Apple, Target, the United Nations, Best Buy, General Mills, Lands' End, and Medtronic. Follow him on Twitter @gilbertconsult and at blog.gilbertconsulting.com.
Keith Gilbert

Latest posts by Keith Gilbert (see all)

  • - November 30, -0001
Tags
Related Articles
Comments

18 Comments on “How to Add a Rule Around a Paragraph

  1. 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)

  2. @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?

    • 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!

  3. 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.

  4. 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.

  5. 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.

  6. 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!

Leave a Reply

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