I'd like to highlight paragraphs such that the highlight color appears as one whole rectangle underlying the entire paragraph. I have looked around but nothing gives me the desired effect so far.
For example \fcolorbox{}
from xcolor
cannot highlight an entire paragraph; \hl{}
from soul
leaves out spacings between lines uncolored.
I am wondering how I can do this?
Best Answer
Here's a list of other possible solutions
A solution that admits page breaks using
mdframed
:The environments provided by the
mdframed
package are highly customizable so, for example, using the(inner)leftmargin
,(inner)rightmargin
options, you can produce this (the textwidth remains unaltered and the frame extends a little into the margins):Here's now a solution using the
framed
package and itsshaded
environment; this solution also admits page breaks:Now a solution using the
tcolorbox
package; this solution admits page breaks insidetcolorbox
if you load thebreakable
library and use thebreakable
key:A solution using the adjustbox package (no page breaks allowed):
And finally, one solution using the
fancypar
package (this solution won't accept page breaks either):