
我想用黑線在彩色文字下劃線,並保留換行符。到目前為止,我最好的解決方案是\uline
從ulem
包中使用。但是,我無法得到我想要的結果。我的嘗試是:
\documentclass{article}
\usepackage{ulem}
\usepackage{color}
\begin{document}
This is a long text. This is a long text.
\color{red}\uline{This is underlined text.
This is underlined text. This is underlined text.}\color{black}
This is a long text. This is a long text.
This is a long text. This is a long text.
\uline{\color{red}This is underlined text.
This is underlined text. \color{black}}
This is a long text. This is a long text.
This is a long text. This is a long text.
\textcolor{red}{\uline{This is underlined text.
This is underlined text. }}
This is a long text. This is a long text.
This is a long text. This is a long text.
\uline{\textcolor{red}{This is underlined text.
This is underlined text. }}
This is a long text. This is a long text.
\end{document}
正如您所看到的,每一次嘗試都有一個缺陷。
有針對這個的解決方法嗎?非常感謝!
編輯:
我現在正在使用該cloze
軟體包,它沒有上述缺點,也沒有讓我失望。對於每個可以切換到 LuaLaTeX 的人來說,這絕對是一個選擇。
答案1
如果它只是一個命令,給出帶有黑線下劃線的紅色文本,那麼這可能會起作用
\newcommand\reduline{\bgroup\color{red}\markoverwith
{\textcolor{black}{\rule[-0.5ex]{2pt}{0.4pt}}}\ULon}
如果沒有,請不要抱太大希望,當您按照這種方式解析時,事情會變得複雜\ulem
。
順便一提:現在誰還在使用底線?