{\color } can do that, but only for the color of text. I would want the same for the background. I have looked across many solutions, but they either can not go across environments (e.g. colorbox) or create new paragraphs (e.g. framed).

I just want to highlight arbitrary regions of text, without any other modification to them.

EDIT: An example for gigi:



text \hl{
        \item text
} text


It produces:

$ pdflatex a.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/Debian) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
LaTeX2e <2017-04-15>
Babel <3.18> and hyphenation patterns for 84 language(s) loaded.
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/soul/soul.sty) (./a.aux)
[Loading MPS to PDF converter (version 2006.09.02).]

! LaTeX Error: Environment {itemize} undefined.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.

l.12 }

1 Answer 1


The soul package can do this:



text \hl{text} text

  • Wrapping itemize with hl caused LaTeX Error: Environment {itemize} undefined.
    – arataj
    Jun 21, 2019 at 14:30
  • @arataj Can you add a document to your question that shows the problem?
    – gigi
    Jun 21, 2019 at 14:31
  • I added an example.
    – arataj
    Jun 24, 2019 at 8:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.