0

Basically want to mimic highlight function of Word or pdf.

  • Need to highlight
  • Need to be multi-line
  • able to cite

Not properly working MWE (taken from here and modified):

\documentclass[5p,hidelinks]{elsarticle}

\usepackage{xcolor}

\newcommand\hlbreakable[1]{\colorbox{yellow}{\textcolor{black}{#1}}}

\begin{document}

I want to write a normal paragraph. \hlbreakable{Additionally, want to highlight a multi-line text which also includes citation~\cite{rockafellar1997convex,rudin1992nonlinear}.} The highlight will not cover full paragraph, just few lines as mentioned.

\begin{thebibliography}{10}
\bibitem{rockafellar1997convex}
  R.T. Rockafellar.
  \newblock {\em Convex analysis}.
  \newblock Number~28. Princeton university press, 1997.
\bibitem{rudin1992nonlinear}
  L.~Rudin, S.~Osher, and E.~Fatemi.
  \newblock Nonlinear total variation based noise removal algorithms.
  \newblock {\em Physica D: Nonlinear Phenomena}, 60(1):259--268, 1992.
\end{thebibliography}
\end{document}

Wanted output like:

enter image description here

  • 2
    Highlight like underlining is incredibly difficult in LaTeX. You could try \usepackage{xcolor} \usepackage{soul} \soulregister\cite7 \newcommand\hlbreakable[1]{\hl{#1}}, which should almost tick all the boxes, but would make the \cite unbreakable (which may be an OK-ish drawback). – moewe Feb 16 at 11:20

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.