pdflatex + soulutf8 + 德语简写 = 占用 ASCII 字符

pdflatex + soulutf8 + 德语简写 = 占用 ASCII 字符

喂食

\documentclass{article}
\pagestyle{empty}
\usepackage[ngerman]{babel}
\usepackage[x11names]{xcolor}
\usepackage{soulutf8}
%%% See http://tex.stackexchange.com/a/426036
\usepackage{letltxmacro}
\LetLtxMacro\hlBAK\hl
\begingroup
\makeatletter
\catcode`.=4% changing catcode so the dot is never matched by ordinary text
\def\zz%
  {\endgroup
    \renewcommand\hl[1]
      {%
        \hl@grab@A##1\(.\endhl@grab
      }%
    \long\def\hl@grab##1\(##2\)##3\endhl@grab%
      {%
        \hl@grab@ifdot{##2}
          {\hlBAK{##1}}
          {\hl@grab##1$##2$##3\endhl@grab}%
      }%
    \long\def\hl@grab@A##1\(##2\endhl@grab%\)
      {%
        \hl@grab@ifdot{##2}
          {\hl@grab@B##1\).\endhl@grab}
          {\hl@grab@A##1$##2\endhl@grab}%
      }%
    \long\def\hl@grab@B##1\)##2\endhl@grab%
      {%
        \hl@grab@ifdot{##2}
          {\hlBAK{##1}}
          {\hl@grab@B##1$##2\endhl@grab}%
      }%
    \long\def\hl@grab@ifdot##1%
      {%
        \ifx.##1%
          \expandafter\@firstoftwo
        \else
          \expandafter\@secondoftwo
        \fi
      }%
  }%
\zz

%%% See http://tex.stackexchange.com/a/48502
\makeatletter
\newdimen\SOUL@dimen %new
\def\SOUL@ulunderline#1{{%
    \setbox\z@\hbox{#1}%
    \SOUL@dimen=\wd\z@ %new
    \dimen@i=\SOUL@uloverlap
    \advance\SOUL@dimen2\dimen@i %\dimen@ exchanged too
    \rlap{%
        \null
        \kern-\dimen@i
        \SOUL@ulcolor{\SOUL@ulleaders\hskip\SOUL@dimen}% new
    }%
    \unhcopy\z@
}}
\makeatother
\begin{document}\noindent
(Daten"~)""Ströme\\
\hl{(Daten"~)""Ströme}
\end{document}

导致pdflatex最后一个字符消失:

两行,第二行是错误的

\hl有没有关于如何改进序言的想法,以便即使存在德语简写,背景突出显示命令中的所有文本都会显示出来?在这个问题上,我们坚持使用pdflatex(没有其他引擎)。(是的,我知道解决方法\hl{(Daten"~)}""\hl{Ströme}。)

相关内容