[XeTeX] How may I get colored background on text?

Ron Aaron ron at ronware.org
Tue Feb 21 11:58:29 CET 2012

> See the dvipdfm documentation: texdoc dvipdfm.

That's not actually helpful.

There is no direct way to accomplish this; however, it is possible to
create a "rule" as big as an enclosing box, and position a text box over
it.  Example code:

\def\pdfliteral#1{\special{pdf: literal #1}}

    \setbox1\hbox to \hsize{#1}
        \pdfliteral{0.8 0.8 0.8 rg}
        \hrule width \hsize height \ht0 depth \dp0
        \pdfliteral{0 0 0 rg}

More information about the XeTeX mailing list