Quantcast
Channel: Active questions tagged latex3 - TeX - LaTeX Stack Exchange
Viewing all articles
Browse latest Browse all 260

Highlight in yellow a list of citations

$
0
0

I'm using the soul package to highlight fragments of text, using the \hl command. However, this package has problems if you have a command within the \hl command. They can usually be solved by putting the command within \mbox{}, but the problem is that if what we want to protect is a \cite command then the text inside is not breakable in multiple lines if needed, which is a problem.

My minimum working example that fails:

\documentclass[preprint,12pt,authoryear]{elsarticle}\usepackage{color,soul}\begin{document}\hl{A statement \citep{ref1,ref2,ref3,ref4,ref5,ref6}}.\bibliographystyle{elsarticle-harv} \bibliography{references.bib}\end{document}

It can be partially solved by replacing \citep{...} with \mbox{\citep{...}}:

\documentclass[preprint,12pt,authoryear]{elsarticle}\usepackage{color,soul}\begin{document}\hl{A statement \mbox{\citep{ref1,ref2,ref3,ref4,ref5,ref6}}}.\bibliographystyle{elsarticle-harv} \bibliography{references.bib}\end{document}

But in that case the citation text is not breakable and therefore I get the text getting out of the margin.

Another approach that I tried was to put the \citep command within {...}:

\documentclass[preprint,12pt,authoryear]{elsarticle}\usepackage{color,soul}\begin{document}\hl{A statement {{\citep{ref1,ref2,ref3,ref4,ref5,ref6}}}.\bibliographystyle{elsarticle-harv} \bibliography{references.bib}\end{document}

This last one approach leads to the error "Package soul Error: Reconstruction failed".

Any idea about how to solve this? I'm really lost here...


Viewing all articles
Browse latest Browse all 260

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>