1

I'm looking for a possibility to visually highlight entire portions of a document. It could be a paragraph or entire pages. Ideally by changing the background color, but it could also be a colored bar along the margin.

It's important that the portion may contain anything: figures, tables, listings (!), etc. If there are floats contained, it's not important that they stay inside that environment, but they should also be highlighted somehow. So it should look something like this:

\begin{myhighlighter}{red}
foo
\url{test.com/a%20path.html}
\includegraphics{image}
\begin{lstlisting}
 !@#$%^&*(
\end{lstlisting}
bar
\end{myhighlighter}

Aesthetics are secondary. Is that possible?

Edit: I'm using LuaLaTeX

5
  • 4
    "Aesthetics are secondary"? Pay attention to what you say here :)
    – CarLaTeX
    Aug 21, 2018 at 6:08
  • Maybe have a look at OCG and its associated packages. It allows you to create layers inside PDF documents that can be hidden and shown. It could be a solution. Aug 21, 2018 at 6:56
  • 2
    I think you should have a look at the tcolorbox package.
    – Max
    Aug 21, 2018 at 6:57
  • I think that the answers to these questions tex.stackexchange.com/questions/360461 and tex.stackexchange.com/questions/443156 could be a good stating point.
    – Jhor
    Aug 21, 2018 at 7:58
  • tcolorbox does not work with listings or URLs that contain a percent sign. Same with the bcolorbox solution from tex.stackexchange.com/questions/443156
    – Volker
    Aug 21, 2018 at 8:16

0

Your Answer

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

Browse other questions tagged or ask your own question.