How to add background color to printed text inside a paragraph

Modified on Mon, May 27, 2019 at 12:15 PM

Since the block mechanism does not support matchbox directly, a workaround was devised. This workaround has limitations (see below)

To use it start with a matchbox tag, then end it with <matchbox=end>.

Example :

This text is printed without a back color while <matchbox={fillcolor={cmyk 0 1 1 0} boxheight={fontsize descender}}>this has red backcolor<matchbox=end>


Font Color can be changed using the standard fillcolor attribute outside the matchbox. Default value for boxheight is {capheight none} other options are xheight, ascender and descender. Errors will print on the paragraph in white with red background color.


Limitation: IMPORTANT

  • With the exception of the initial block font name and size, no other block property is inherited. To change alignment, color, fitmethod, shrinklimit... the parameters must be contained within the paragraph or as an optlist (for global block changes). One of the most important ones is fitmethod=auto, add it as an optlist (unless a different method is preferred).
  • Matchbox tags are ignored if a shrink attribute was used (in status).




Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article