is now part of CreativePro.com!

Highlighting an Entire Paragraph with Color

30

Recently someone asked me with help highlighting an entire paragraph. They were trying to use paragraph rules, but if the paragraph was not always the exact same number of lines, the colored background would break. The solution envelopes a combination of a custom underline and paragraph rules.

The first step is to create a paragraph style with a custom underline. I made the underline tall enough to cover the height of the leading.

Next a created a paragraph rule above and below with the same color settings as the underline.

Now, no matter what the length of the paragraph, the entire block of text will be highlighted with the same color. The only downside with this trick, is the fact that your text will have to be justified for it too look clean. Otherwise you will see a ragged edge since underlines are only the width of the text.

James Fritz is a Principal Program Manager: Content Tools and Workflows at LinkedIn.
  • I love this trick, but you need to watch out for two things that really mess up the straight lines on each side: Optical Margin Alignment and a postive Right Indent, as shown here.

  • F vd Geest says:

    I would use a table with one cell… must easier ;-)

  • Mike Perry says:

    We shouldn’t have to do this, meaning using a custom underline to tint a paragraph. If the paragraph’s size changes, all these efforts are for naught.

    There’s much that I dislike about Word, but its Borders and Shading is infinitely better than this work around. Even the UI is excellent. Adobe should copy Word, but make it better. We need the ability to set how far shading extends beyond a paragraph. As best I can tell, Word can’t do that.

    I format books and am always looking for ways to make them more visually attractive, meaning more like magazines. Most books today look little different from how they did in the days of Charles Dickens. I have been able to do a little. No less a writer than Martin Gilbert, Churchill’s authorized biographer, praised some of the tweaks I applied to Chesterton on War and Peace. But I’d like to do more, and that means borders and tints. I’m working on a book now where I have comments inside a reconstructed, bestselling 1880s novel. I’d like to use tints or borders to set off commentary, but that’s too much trouble in ID CS4. Instead I use a less than ideal solution, a different font style and margins. I’ve done it before, but never liked it.

    Recently that’s gotten even more important. In my little just-me business, I use print-on-demand publishing through Ingram’s Lightning Source, which is also used by major commercial and university presses. Recently, the greyscale abilities of their presses have gotten predictable enough, I’d like use boxes and shaded text. But again I’m held back by the limits of InDesign. Techniques that can be used with a 32-page magazine take too much time for a 400-page book. Tints and boxes need to be a paragraph style functions and they need to be smart enough to automatically merge multiple paragraphs with the same settings. And they need to be able to deal intelligently with page breaks. I can’t fiddle with giant underlines that probably won’t span page breaks.

    The future of high-end, print-on-demand publishing offers even more potential. The current presses use laser printer technology for the interiors, with just the covers being done with professional, four-color ink jet printers. That limits interiors to black and white.

    But I’m told that high-end ink-jet technology is improving to the point where it may soon replace laser printing for interiors. The result won’t be photo quality, but it should work fine for shading, colored text, charts, graphs and the like. Gutenberg’s movable-type printing made publishing much easier and cheaper, but for most books it took away from us the colorful beauty of medieval illustration. This could bring the color back, at least in a small way.

    But InDesign needs to support those changes with features that haven’t been traditional in the publishing of the past. That means borders, shading and the ability to change the number of columns inside a text frame. Workarounds that get these results with magazines don’t work with books, either printed or digital.

    –Michael W. Perry, Inkling Books, Seattle

  • Lenny says:

    Hi,

    I know this is off topic but anyone every had to export text from indesign based on paragraph styles…I am doing things in the reverse..I need to transfer photo captions to metadata templates. This way I will be able to do whatever I want with the captions…

    Can this be done?

    Thank you.

  • Peter says:

    @Mike: I think I remember that once I had the case where I imported a Word document into InDesign and it actually somehow brought the text border with it. It was ages ago, and I might be totally wrong on this, but if I’m not, InDesign might already have that feature buried deep down. Maybe they are just not exposing it via the interface, but have it there for Word compatibility, kind of like the new middle east paragraph composer in CS4.
    I can’t check right now, but I wonder what would happen if you placed some .doc file with a text border assigned in Word and then used that text to define a paragraph style based on it.

  • Fred Goldman says:

    I made script to calculate the amount of lines and set the paragraph rules accordingly. There is a free version here:

    https://mysite.verizon.net/zevt/index_files/BoxMaker.htm

  • Klaus Nordby says:

    If we only got the ability to specify also the “em” as a unit of measurement — like we can in CSS — many clever tricks with underlines, overlines and strikethroughs and insets and whatnots could be made vastly easier and more flexible.

  • Geo says:

    Another solution might be placing the text that needs to have colored background in an inline or above-line anchored text frame. There are, of course, advantages and disadvantages to this method. A major advantage is the ability to define most of the things Michael (above) wants to control: text insets, number of columns, and even some very fancy borders or transparency effects, like a drop shadow (and all of it can be saved as an object style and reapplied when needed). On the downside, anchored text frames (just like table cells suggested as yet another alternative above by F vd Geest) don’t break between columns or frames, so if a lot of text is placed in an anchored frame, and it gets “bumped” to the next column or frame, it will create a strange-looking gap… Still, this might be a good solution for a very long document, and then, as a final step (when text does not change any more), the problematic “bumped” frames can be released and repositioned manually… Just thinking out loud…

  • Jochen Uebel says:

    @ Fritz:
    Why do underlines for highligthing need paragraph rule above? If the underlines are big enough they do the trick without. I see only one advantage: “Keep in Frame”. So that the color stays in the frame (at least above).

  • Eugene says:

    I need this sometimes too and rather than mess around with paragraph rules and underlines and other things I simply draw a box behind the text. Not anchored or anything.

    This is fine to do as long as the text is set and won’t move again. So it’s usually one of the last things I do.

    Besides I like rounded corners on my highlighted text and that’s the easiest way to do it – for me.

  • liviu says:

    @Jochen: if you have a first line setting different from 0, underline wont be enough. That’s one reason…

  • Weller says:

    DTP programs should have implemented CSS-like options for styling years ago

    … right click the style in the palette and chose ‘Style Options’. In the ‘CSS’ section check ‘enable’, type:

    highlitedParagraph {
    border: '0pt',
    color: [0,0,100,0],
    padding: "5mm"
    }

    into the CSS window and Bob’s your uncle.

    (excerpt from InDesign 7.0 manual)

  • Fritz says:

    @ Jochen – You are right, I guess I don’t need the rule above. Maybe my rule below was lonely and needed a friend.

    On another note, I can’t believe how this little post touched a nerve. This just goes to show how much more InDesign could do. Hopefully the Adobe engineers read our posts.

  • F vd Geest says:

    Again, I would use a table with one cell?

    • 彰化一整天: 你好。冒昧寫電郵給你。因爲我真是需要高人指點。 學校舉行口試,一共有24班,每班都有10位以上,20位以下的老師為主考官。出來了一大堆資料。 過去兩個星期,除了公務的時間外,我確實努力看書和找資料,但是還是沒有辦法整合這些資料。 如果你願意,我是否可以寄上我的部分資料,請你看看指點? 不勝感激。 某一位老師上

  • Weller says:

    >>> Again, I would use a table with one cell?
    And so would I, but only for one page document.

    Using one cell (or anchored text frame) is not very flexible.
    The text inside the cell is not in the natural Story text flow. As a concequence
    1. you cannot access the text just by pressing the arrow keys
    2. you cannot edit the text in story editor (CS3 & lower)
    3. anchored object doesn’t reflect changes to parent frame size (without Rorohiko APID & scripting, that is)
    4. things like “Select All”, “Copy” & “Paste” somewhere else do not behave as expected.
    5. It’s sooooooooooo Quark like

    Besides what we want is to assign paragraph style and move on.

  • Jeremy says:

    Could Jochen and/or Fritz please explain to me why you don’t need the rule above? If the paragraph has a first line indent, isn’t it the only way of getting rid of the corresponding “step” in the highlighting?

    What am I doing wrong? — No matter how thick I make my underline, the “step” is still there, and I can’t see how it would ever go away!

  • Fritz says:

    I mentioned in an earlier reponse that I made a mistake, you don’t need the rule above. Although you might want to use it if you want the area above your paragraph to have more color than the rest of it.

  • I’ve been trying to use the rules above and below to make a head that is reversed out of a solid color. I’ve used the Text Width setting and a negative left and right indent to set the width of the rule. When it is larger than the text and offset a bit, I can center the heading inside a colored bar that travels with the head.

    Let me know if there is another way to have a head with a color bar attached.

    Or if I didn’t explain it correctly.

  • Hi buddy,
    your method looks good but luckily I managed to achieve the same result without the second step you mentioned. for a font size of 12pt I used the offset value of -3.5 and underline weight of 23pt. Give some space before and after and bingo. you can use the rule on any number of lines in a paragraph.

    Regards

  • yidu says:

    yes,use “rule above” can do any other Effect.

  • Jeremy says:

    Weller wrote: “DTP programs should have implemented CSS-like options for styling years ago”

    I wonder if anyone here knows anything about “Prince XML”? Apparently it produces PDFs from HTML+CSS (and from XML+XSL+CSS), but that’s as much as I know. Oh yeah — and some consider it a replacement for LaTeX. But really, I’m in the dark here. Any more info from people who use InDesign?

  • Lukas Engqvist says:

    Have any of you added this using adobes official feature request? Asking politeley is the first step to recieving ;p
    https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform

  • Gunnar says:

    I’ve encountered this problem so many times, and yet I’ve never thought of using a table cell. Thanks for that, F vd Geest! The disadvantages mentioned by Weller don’t really apply to me, or rather, they don’t impose any problem.

  • hadi says:

    Hi.
    I have any paragraph that used auto numbering. When I used paragraph rules, is not work. numbers color not changed.
    i used from underline option but not work.
    For one line it work, but for two or higher lines not work. like this picture.
    https://uupload.ir/files/n94x_untitled.png

  • ?????? says:

    3D????????”??”?????,?????????????????????????????????,?????????????????,????????????? ????,??,?????????,????????????????????????????????????????,????????????????,?????????????,????????????,???????????????????

  • >