2

This question already has an answer here:

Here I faced challenge in highlighted text using soul package, when highlighting white space occurs in between lines. It should be closed up, please suggest any option for fixing this issue:

Note: Problem area marked in red colorenter image description here

MWE:

\documentclass{book}

\RequirePackage{xcolor,soul}

\definecolor{bluelight}{cmyk}{0.15,0.01,0.01,0.0}
\definecolor{pinklight}{cmyk}{0.12,0.15,0.0,0.0}
\definecolor{greenlight}{cmyk}{0.10,0.01,0.29,0.0}

\def\bluehighlight#1{\protect\sethlcolor{bluelight}\hl{#1}}
\def\greenhighlight#1{\protect\sethlcolor{greenlight}\hl{#1}}
\def\pinkhighlight#1{\protect\sethlcolor{pinklight}\hl{#1}}


\begin{document}
\section{Overview}
Numerous videos
and interactivities are embedded just
where you need them, at the point of

\subsection{Links with our times}
When a new suburb is established today, roads and footpaths are built,
services such as water and electricity are connected, and underground
pipes are installed to take away sewage and
stormwater. All these facilities are
usually in place before any homes are built,
and even the construction of the
houses is governed by strict building regulations.
The situation was very
different two hundred years ago.

\bluehighlight{The biomedical model relies heavily on technology and trained
professionals to treat illnesses such as cardiovascular disease.}$^1$
\greenhighlight{These resources are expensive to establish and maintain.}$^2$ \pinkhighlight{The
biomedical model does not focus on people without cardiovascular
disease so healthy groups are not the health system making it dif
difficult to decrease Medicare benefits paid to treat these diseases.}$^3$
\bluehighlight{The social model of health aims to reduce the differences in
factors that result in higher rates of cardiovascular disease among
particular groups.}$^4$ This can be achieved by empowering individuals
and communities with the onset of cardiovascular disease, such
as tobacco smoking and obesity. \greenhighlight{This can reduce the prevalence
of cardiovascular disease, which in turn reduces the amount of
Medicare funding required to treat it.}$^5$

\end{document}

marked as duplicate by Peter Grill, David Purton, dexteritas, Skillmon, TeXnician Sep 25 '18 at 7:46

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3

An ulem based solution (because I think it's easier to customize it, it breaks automatic hyphenation though):

\documentclass{book}

\usepackage{xcolor}
\usepackage[normalem]{ulem}

\definecolor{bluelight}{cmyk}{0.15,0.01,0.01,0.0}
\definecolor{pinklight}{cmyk}{0.12,0.15,0.0,0.0}
\definecolor{greenlight}{cmyk}{0.10,0.01,0.29,0.0}

\newcommand*\highlightht{2.8ex}
\newcommand*\highlightdp{-.8ex}
\newcommand*\highlightwd{0.2ex}
\def\bluehighlight{\highlightcommon{bluelight}}
\def\greenhighlight{\highlightcommon{greenlight}}
\def\pinkhighlight{\highlightcommon{pinklight}}
\newcommand\highlightcommon[1]
  {%
    \bgroup
    \markoverwith
      {\textcolor{#1}{\smash{\rule[\highlightdp]{\highlightwd}{\highlightht}}}}%
    \ULon
  }


\begin{document}
\section{Overview}
Numerous videos
and interactivities are embedded just
where you need them, at the point of

\subsection{Links with our times}
When a new suburb is established today, roads and footpaths are built,
services such as water and electricity are connected, and underground
pipes are installed to take away sewage and
stormwater. All these facilities are
usually in place before any homes are built,
and even the construction of the
houses is governed by strict building regulations.
The situation was very
different two hundred years ago.

\bluehighlight{The biomedical model relies heavily on technology and trained
professionals to treat illnesses such as cardiovascular disease.}$^1$
\greenhighlight{These resources are expensive to establish and maintain.}$^2$ \pinkhighlight{The
biomedical model does not focus on people without cardiovascular
disease so healthy groups are not the health system making it dif
difficult to decrease Medicare benefits paid to treat these diseases.}$^3$
\bluehighlight{The social model of health aims to reduce the differences in
factors that result in higher rates of cardiovascular disease among
particular groups.}$^4$ This can be achieved by empowering individuals
and communities with the onset of cardiovascular disease, such
as tobacco smoking and obesity. \greenhighlight{This can reduce the prevalence
of cardiovascular disease, which in turn reduces the amount of
Medicare funding required to treat it.}$^5$

\end{document}

enter image description here

  • Thank you very much Skillmon!! It has really helpful for me and fulfill my requriement. – Rajesh Kumar Sep 25 '18 at 9:57

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