1

I want to highlight some text in a block just as we are able to do so in latex beamer template or as we can see notes section in many books which has a box highlighted and perhaps have different background and fonts just like notes section in books.

I have already followed the answer for How to highlight an entire paragraph? but those are to just change background color which is not sufficient to me.

the text I want to make highlight may or may not contain math block / equation or inline equation but will definitely contain \begin{itemize}...\end{itemize} block

3

Following @Zarko suggestion, here is a very small overview of what we could do with the tcolorbox package.

Update to use draftwatermark package

\documentclass {article}
\usepackage{draftwatermark}
\usepackage {tcolorbox}
\tcbuselibrary{theorems}
\usepackage{lipsum} % for dummy text 
\tcbset{standard jigsaw,opacityback=0.5}
\SetWatermarkColor{red}
\begin {document}
\lipsum[1]
\begin{tcolorbox}[colback=purple,coltext=blue]
\lipsum[2]
\end{tcolorbox}

some normal text \tcbox[nobeforeafter,tcbox raise base,colback=blue!30]{very important text} more normal text

\begin{tcolorbox}[ams equation]
a=b=\tcbhighmath{c}
\end{tcolorbox}

\end {document}

enter image description here

  • after applying this solution I just realized that it is also hiding watermark too. Is there any way to preserve watermark text I use with \usepackage{draftwatermark} using \SetWatermarkText? – Gahan Jan 6 at 13:54
  • @Gahan, this is expected because drawftmark is behind a text and it is covered by any nontransparent element. to see it through tcolorbox you need to make it semi or similar transparent. see tcolorbox documentation how to do this. – Zarko Jan 6 at 14:05
  • @Zarko I tried to add exact block of documentation \begin{tcolorbox}[standard jigsaw,colframe=red, opacityframe=0.5, opacityback=0.5] This is a \textbf{tcolorbox}. \end{tcolorbox} but transperency is not appearing – Gahan Jan 6 at 14:23
  • @Gahan, hm, i didn't check a documentation, so i can't say anything particular now. the best would be to ask new question where with some mwe demonstrate your problem. so more people will see your problem and will be able to help you. – Zarko Jan 6 at 15:15
  • @Gahan Answer updated – Hafid Boukhoulda Jan 6 at 16:06

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.