可以更改 csquotes 使用的字体吗?

可以更改 csquotes 使用的字体吗?

我有一个 XeLaTeX 文档,它使用 Palatino Linotype 作为主要字体,看起来非常漂亮,并且我使用该csquotes包来实现正确的引用,这是可行的;然而,同时由于 Palatino 在字形方面的“独特”选择,这看起来很糟糕。

有没有办法使用csquotes不同的字体来替换引号?我查看了手册,但没有发现任何明显的问题(如果它需要覆盖环境或编写纯 TeX,这是我十多年来从未做过的事情,我也不知道会涉及什么)

简化示例:

\documentclass[11pt, lettersize, oneside]{book}
\usepackage{tocloft}
\usepackage{relsize}
\usepackage{fancyhdr}

\usepackage{csquotes}
\MakeOuterQuote{"}

\pagestyle{plain}
\usepackage{xltxtra}
\setmainfont{Palatino Linotype}
\usepackage[b5paper, bindingoffset=0mm, inner=23mm, outer=23mm, top=21mm, bottom=24mm]{geometry}
\usepackage[xetex, pdfborder=0 0 0]{hyperref}

\begin{document}

    The first words were: "these glyphs are not particularly good looking.",
  and one had to agree. They looked all angular and terrible.

\end{document}

以及对应的截图:

在此处输入图片描述

抛开个人的美学观念,对于本特定文档的目的而言,Palatino 的引用相当差,我正在寻找一种专门针对这些引用字形使用不同字体的方法。

答案1

中的代码csquotes基于语言相关的引号样式映射到引号的逻辑标记(参见csquotes.def)。特别是,对于英语,标准映射是使用\textquotedblleft\textquotedblright作为引号符号。因此,可以重新定义它们以使用一些字体/符号组合。可以做更多的改进,但例如

\documentclass{article}

\usepackage{csquotes}
\MakeOuterQuote{"}
\usepackage{fontspec}
\setmainfont{texgyrepagella-regular.otf}
\DeclareTextCommand{\textquotedblleft}{TU}{%
  {\fontfamily{ptm}\selectfont ``}%
}
\DeclareTextCommand{\textquotedblright}{TU}{%
  {\fontfamily{ptm}\selectfont ''}%
}
\begin{document}
    The first words were: "these glyphs are not particularly good looking.",
  and one had to agree. They looked all angular and terrible.

\end{document}

会工作。

(请注意,这实际上与没有什么关系csquotes,它故意使用从较低级别获取的引号符号的逻辑标记。)

答案2

市面上有多种“Palatino”字体。您似乎选择的字体——“Palatino Linotype”——在各种 Palatino 候选字体中,它的双引号确实是“最矮”和“最粗”(短,几乎不弯曲)。不仅如此,它还是我所熟悉的所有 Palatino 变体中看起来最拥挤的字体。

在你通过混合和错配其他字体系列的引号而陷入字体犯罪狂潮之前,我认为你应该考虑其他属于 Palatino 家族或在某种程度上可识别为亲属的字体。以下屏幕截图显示了六个候选字体,首先是 Palatino Linotype(你目前最喜欢的字体);所有字体样本都经过缩放,以便它们具有完全相同的 x 高度。

在此处输入图片描述

正如此屏幕截图所示(我希望如此...),字体的双引号之间存在相当大的差异。如果您真的无法忍受 Palatino Linotype 的双引号,您可能需要考虑改用 Palatino nova 或 Aldus,或者,如果您真的觉得大胆的话,可以改用 Dante。

% !TeX program = xelatex
\documentclass{article}
\usepackage{fontspec,csquotes}
\newcommand\hello{\enquote{Hello World}}

\begin{document}
\setmainfont{Palatino Linotype}
\hello --- Palatino Linotype (Zapf)

\setmainfont[Scale=MatchLowercase]{Palatino}
\hello --- Palatino (Zapf)

\setmainfont[Scale=MatchLowercase]{TeX Gyre Pagella}
\hello --- Pagella (Palatino clone)

\setmainfont[Scale=MatchLowercase]{Palatino nova Regular}
\hello --- Palatino nova (Zapf \& Kobayashi)

\setmainfont[Scale=MatchLowercase]{Aldus LT Std}
\hello --- Aldus (Zapf)

\setmainfont[Scale=MatchLowercase]{Dante MT Std}
\hello --- Dante (Mardersteig)
\end{document}

答案3

作为特定于 XeLaTeX 的解决方案,这可以通过依靠 XeTeX 在特定字符类的字符之间注入活动标记的能力来实现,并对这些标记进行宏替换:

\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{SomeFont}
\newfontfamily{\QuoteFont}{SomeOverrideFont}[Ligatures=TeX]

\usepackage{csquotes}
\MakeOuterQuote{"}

% enable inter-character token insertion and token triggers
\XeTeXinterchartokenstate=1

% A collection of active glyphs for this purpose. Assigning a class
% for characters that already belong to a class simply reassigns them.
\newXeTeXintercharclass\Quotes
\XeTeXcharclass`'=\Quotes
\XeTeXcharclass`"=\Quotes
\XeTeXcharclass`,=\Quotes
\XeTeXcharclass`’=\Quotes
\XeTeXcharclass`’=\Quotes
\XeTeXcharclass`“=\Quotes
\XeTeXcharclass`”=\Quotes

% transitions from/to Basic Latin
\XeTeXinterchartoks 0 \Quotes = {\begingroup\selectfont\QuoteFont}
\XeTeXinterchartoks \Quotes 0 = {\endgroup}

% transitions from/to word boundaries
\XeTeXinterchartoks 4095 \Quotes = {\begingroup\selectfont\QuoteFont}
\XeTeXinterchartoks \Quotes 4095 = {\endgroup}

将其放在序言中(或者保存为某些内容quotestyle.tex然后\input{quotestyle.tex}在序言中使用)会导致使用主字体排版的文本,并通过 csquotes 使用智能引号替换进行格式化,但使用辅助字体来表示引号字形。

(另请注意,对于旧版本的 XeTeX,边界类是255而不是4095

对我来说,这比 Joseph Wright 的答案更有效,因为这允许我覆盖不仅仅是双引号,但如果你需要一个通用的双引号 LaTeX 答案,他的建议非常有效。

答案4

作为 Palatino 引号问题的另一种解决方案,我修改了 Tex Gyre Pagella X 以使用来自 Tex Gyre Termes X 的引文(即最终结果与带有 Times New Roman 引号的 Palatino 相同),并加入了一些来自 Domitian 的额外的希腊语和西里尔语内容。 最终成果 Tex Gyre Parliamentary(之所以这样命名,是因为其与用于起草英国立法的“Book Antiqua Parliamentary”字体相同)可以从我的 Github 中下载。

它产生以下结果:

\documentclass{standalone}
\usepackage{fontspec}
\setmainfont{TeX Gyre Parliamentary}
\begin{document}
    ``Hello world.'' --- \TeX\ Gyre Parliamentary
\end{document}

输入 TGP

相关内容