突出显示行内方程

突出显示行内方程

我使用 \hl 来突出显示行内方程式,但在某些情况下它无法正常工作。请参见以下示例。

在此处输入图片描述

\documentclass{article}

\usepackage{color,soul}
\soulregister\cite7
\soulregister\ref7
\soulregister\pageref7

\begin{document}

\hl{For example, {$TW_{ij}$} where {$j=\alpha$} (stopping the use of a staff member after doing task {$i$}) is determined based on the difference of {$ES_s+mO$} and {$ET_i+ST_i$}. Whatever this difference is smaller, the transition from task {$i$} to {$j$} becomes more desirable (a higher probability).}

\end{document}

答案1

只要你不需要在数学中换行,你就可以把它放在一个框里

在此处输入图片描述

\documentclass{article}

\usepackage{color,soul}
\soulregister\cite7
\soulregister\ref7
\soulregister\pageref7

\begin{document}

\hl{For example, \mbox{$TW_{ij}$} where \mbox{$j=\alpha$} (stopping the use of a
  staff member after doing task \mbox{$i$}) is determined based on the
  difference of \mbox{$ES_s+mO$} and \mbox{$ET_i+ST_i$}. Whatever this
  difference is smaller, the transition from task \mbox{$i$} to \mbox{$j$}
  becomes more desirable (a higher probability).}

\end{document}

答案2

无需将数学内容包装到组中。只需按原样设置即可:

在此处输入图片描述

\documentclass{article}

\usepackage{color,soul}
\soulregister\cite7
\soulregister\ref7
\soulregister\pageref7

\begin{document}

\hl{For example, $TW_{ij}$ where $j = \alpha$ (stopping the use of a staff member after doing task $i$) 
is determined based on the difference of $ES_s + mO$ and $ET_i + ST_i$. Whatever this difference is 
smaller, the transition from task $i$ to $j$ becomes more desirable (a higher probability).}

\end{document}

相关内容