2

What I have:

I have the following code

\newtcolorbox{DefinitionBlue}{
enhanced,
fonttitle=\sffamily\bfseries,
coltitle=my-blue-2,
boxrule=0pt,frame hidden,
borderline west={5pt}{0pt}{my-blue-2},
opacityback=0
}

and in the document

\begin{DefinitionBlue}
This is a test
\end{DefinitionBlue}

which produces the following output

enter image description here

(note that I have set the background to be like this in the whole document; it is not a result of the colorbox)

What I want to do:

I want to create a highlighter effect (as if I have highlighted before the text), that is, I want the border to have lower opacity and I want to be able to change the height of the border. I have tried using the highlighter command, however, it is not flexible enough for me.

Can someone help me change the opacity and height of the border?

Thank you in advance.

enter image description here

2
  • a hand sketch of the desired output would help perhaps
    – js bibra
    Sep 4, 2021 at 23:36
  • @jsbibra thank you for the suggestion. I have added a sketch now. Sep 5, 2021 at 8:28

1 Answer 1

1

The first argument is the border width, the second one is a shift and the third one is a list of options.

borderline west={10pt}{5pt}{blue, opacity=0.5}

To reduce the height we need an other approach:

\documentclass{article}

\usepackage[most]{tcolorbox}

\newtcolorbox{DefinitionBlue}{
enhanced,
fonttitle=\sffamily\bfseries,
coltitle=blue,
boxrule=0pt,frame hidden,
left=5mm,
%borderline west={10pt}{5pt}{blue,opacity=0.5},
overlay={
      \draw[line width=10pt,blue,opacity=0.5]
          ([shift={(3mm,-2mm)}]interior.north west)
          --([shift={(3mm,2mm)}]interior.south west);
        }
}


\begin{document}
\noindent
zrzer rzerz 
\begin{DefinitionBlue}
This is a test\\
Thid is as test\\
This is as test

\end{DefinitionBlue}
\noindent
dzaez zzrze
\end{document}
2
  • Hi thank you for the comment! I wanted to also ask, do you know how one can also change the height? The one I have right now goes above and below my text too much. I would like to make it a bit shorter. Do you know how I could do that? Sep 5, 2021 at 9:35
  • @MathsWizzard aswer updated Sep 5, 2021 at 10:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .