Copy link to clipboard
Copied
Hi everyone,
So I've finally achieved 90% of what I'm trying to do - put a background on all my code snippets using Paragraph Shading on my "code" paragraph style. However, I can't seem to figure out how to keep it within the page margin when it's the first thing on the page. I learned about right click > Text Frame Options but this is a 400+ page book and I can't go in and adjust each code snippet manually. HELP! Please tell me there's a non-manual way... thank you!!
You can get the look you want with a combination of paragraph shading and a rule above. In this screen shot they are the same color:
In this one I changed the rule above to pink so that you can see it:
~Barb
Copy link to clipboard
Copied
Hi Superhi:
Enabling the Clip to Frame checkbox for the paragraph style doesn't work?
If not, can you re-share the screen shot with hidden characters showing?
~Barb
Copy link to clipboard
Copied
Hi Superhi,
As BarbBinder mentioned "Clip to frame" should work. If this is just for the first paragraph(i can't quite guess if this problem is with other paragraphs as well, since they are preceded with white spaces). But it would be worthwhile to check if the "Top Offset" is set to anything other than 0 and also if the "Top Edge" is set to "Leading", this could also cause the shading to extend.
However in any of these cases i have found "Clip to frame" work irrespective.
-Manan
Copy link to clipboard
Copied
Hi all, thanks for your replies. Unfortunately, "Clip to Frame" doesn't give the code snippets the space above the text that I'm looking to keep. See screenshot:
So I'm wondering if there is way to keep it within page margins while still maintaining that space above the code text so it's not touching the top of the yellow box.
Copy link to clipboard
Copied
The only way I know of is to use the clip to frame to stop the spill out.
But in your code paragraph style, try setting a negative baseline shift. Screen shot is done in something else as I don't have a current subscription.
You could also maybe use a rule above using Paper color, but you would need two code paragraph styles, one for the first paragraph, another for the remainder and hook 'em together to be able to use Apply Next.
Mike
Copy link to clipboard
Copied
You can get the look you want with a combination of paragraph shading and a rule above. In this screen shot they are the same color:
In this one I changed the rule above to pink so that you can see it:
~Barb
Copy link to clipboard
Copied
YES thank you so much for this clever solution Barb! I've been racking my brain over this. So happy to finally figure it out. Cheers!
Copy link to clipboard
Copied
Always happy to help, superhi .
~Barb
Copy link to clipboard
Copied
Barb, as always, you come up with the most creative solutions to InDesign's most annoying problems! Thanks for another one! -- C. Sinclaire
Copy link to clipboard
Copied
Thanks so much, Barb!
This is a solution for the top of a text frame.
In case of the bottom I currently see no way for an automated way.
The manual solution would be a text frame inset.
Issue at the bottom of the text frame:
Manual solution using an indent on the text frame at the bottom:
Regards,
Uwe Laubender
( Adobe Community Expert )
Find more inspiration, events, and resources on the new Adobe Community
Explore Now