I am using tcolorbox to highlight text. However, the color box starts from a new line even if I start highlight from the middle of a line.

\tcbset{enhanced jigsaw, boxrule=0pt,colback=yellow,arc=0pt,auto outer  arc,left=0pt,right=0pt,boxsep=0pt}


This is a text that
I want to highlight. This further continues to multiple lines and paragraphs.


I would like the highlight to start from the middle of line and then continue till the end of highlighted section of text which may span multiple lines and paragraphs, and may also end in the middle of a line.

I have also tried soul package with \hl command but it leaves a white space between the lines even if I change the height of highlight.

Thanks in advance for help.

  • You are welcome. For future reference, to produce a block of code, don't use the inline style of backticks at the beginning/end of code. Rather, highlight the block, and click the {} icon above the edit window. This will, to the editor, appear as if the code is indented 4 spaces. But to the reader, it will appear as a code block. – Steven B. Segletes Oct 31 '17 at 15:12
  • 1
    A tcolorbox always starts a new line while a tcbox cannot do it. But a tcbox can not do what you want. Try with solutions in tex.stackexchange.com/questions/5959/… – Ignasi Oct 31 '17 at 15:21

You can use the package soul and command \hl{•} to choose what sections of your text you want to highlight. (Just as you would do with bold fonts command \textbf{•}.) For instance, you can use it like this:


This is a text that:
I want to \hl{highlight}. This further continues to \hl{multiple lines and paragraphs}.

It would look like this: highlighting-sample

| improve this answer | |

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.