I try to highlight large paragraph of text, where there are various other macros such as \cite, \SI, \ref, etc. in between.

If I do something like the following:

\hl{the duration is \SI{4}{\second} as shown in Figure~\ref{fig:fig1} \citep{Doe2015}}

The text would truncate at "is", or even cannot compile sometimes.

Is there a way to write a macro like this:


Thank you so much!


1 Answer 1


Protect the offending commands in \mbox. On the other hand, underlining should be avoided as much as possible.




\hl{the duration is \mbox{\SI{4}{\second}} as shown in
Figure~\mbox{\ref{fig:fig1}} \mbox{\citep{Doe2015}}}



\bibitem[Doe(2015)]{Doe2015} A paper



enter image description here


You must log in to answer this question.

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