csquotes 自动输入德语“Guillemets”的字距

csquotes 自动输入德语“Guillemets”的字距

请考虑这个 MWE:

%!TeX program  = lualatex
\documentclass{article}

\usepackage[shorthands=off,main=ngerman,english]{babel}
\usepackage{cochineal}

\usepackage[german = guillemets]{csquotes}  
    \MakeOuterQuote{"}

% Show positive (green) and negative (red) kerning. Requires LuaLaTeX.
\usepackage{showkerning}    
\usepackage{spacekern}

\usepackage{newunicodechar}
    \newunicodechar{»}{»\kern .5pt}
    \newunicodechar{«}{\kern .5pt«}

\begin{document}
How to say “Hello, world!” in German:\medskip

"Hallo, Welt!" (\texttt{csquotes})

»Hallo, Welt!« (\texttt{manual})

\end{document}

我有一篇英文和德文的文本。引号由 自动处理csquotes。这很有效,但与手动添加的引号不同,我可以通过 轻松定义额外的字距调整newunicodechar,而当它们由 自动添加时,这不起作用csquotes

我怎样才能为csquotes' guillemets 添加字距调整?

在此处输入图片描述

答案1

如果你可以使用 fontspec,一种方法是在字体级别更改 guillemets 的字距(请参阅如何调整LuaTeX 中的字体功能?了解详情)


%!TeX program  = lualatex
\documentclass{article}

\usepackage[shorthands=off,main=ngerman,english]{babel}

\usepackage[german = guillemets]{csquotes}  
    \MakeOuterQuote{"}

\directlua{
    fonts.handlers.otf.addfeature
    {
    name = "gui", 
    type = "single", 
    data = {
      ["»"] = {0, 0, 20, 0}, % kerning after, expressed in thousandths of an em
      ["«"] = {20, 0, 0, 0}, % kerning before, expressed in thousandths of an em
    },
}
}

\usepackage{fontspec}
\setmainfont[RawFeature=+gui]{EB Garamond}

\begin{document}
How to say “Hello, world!” in German:\medskip

"Hallo, Welt!" (\texttt{csquotes})

»Hallo, Welt!« (\texttt{manual})

\end{document}

相关内容