Microtype 和 Soul 在单词后创建细白线

Microtype 和 Soul 在单词后创建细白线

当使用microtype和 时soul,如果我突出显示下一行的文本,则第一行的单词后会出现细白线。以下是一些代码:

\documentclass[a4paper, 12pt, twoside]{article}
\usepackage{microtype}
\usepackage{xcolor, soul}

\begin{document}
\sethlcolor{red!50}
\hl{This is an example. This is an example. This is an example. This is an example. This is an example. This is an example. This is an example.}

\hl{This is an example.}
\end{document}

从图片中可以看出,当文本没有继续到下一行时,不会发生这种情况。有什么想法吗?

答案1

在我看来,你有两个选择。要么关闭扩展microtype

\usepackage[expansion=false]{microtype}

LuaLaTeX或者与以下一起使用lua-ul

\documentclass[a4paper, 12pt, twoside]{article}

\usepackage{microtype}

\usepackage{xcolor}
\usepackage{luacolor,lua-ul}

\LuaULSetHighLightColor{red!50}

\begin{document}

\highLight{This is an example. This is an example. This is an example. This is an example. This is an example. This is an example. This is an example.}

\highLight{This is an example.}
\end{document}

相关内容