如何让 csquotes、polyglossia with german 和 hyperref 协同工作?

如何让 csquotes、polyglossia with german 和 hyperref 协同工作?

我发现了一个奇怪的问题,它似乎是polyglossiagerman语言以及csquotes和的结合所特有的hyperref

% XeLaTeX
\documentclass{article}

\usepackage{polyglossia}
    \setmainlanguage{german}

\usepackage{csquotes}
    \MakeOuterQuote{"}

\usepackage{hyperref}

\begin{document}
\section{Section with "quote"}
"Quote in Text"

\section{Section with \enquote{quote}}
\enquote{Quote in Text}
\end{document}

这两种方法\enquote"简写方法在普通文本中都可以正常工作,但在章节标题中会导致此错误(以及一些以下错误):

! Argument of " has an extra }.
<inserted text> 
                \par 
l.16 \section{Section with \enquote{quote}}

\setmainlanguage{english}使用 PDFLaTeX (和) 也没有问题,babel它也可以正常工作。

我的解决方法是直接使用„quotes“,但它会带走所提供的灵活性csquotes


更新

以下 MWE 与以下文件列表仍然会重现错误。

% XeLaTeX
\documentclass{article}

\usepackage{polyglossia}
    \setmainlanguage{german}

\usepackage{csquotes}
    \MakeOuterQuote{"}

\usepackage{hyperref}

\begin{document}
\section{Section with \enquote{quote}}
\enquote{Quote in Text}
\end{document}
*File List*
 article.cls    2007/10/19 v1.4h Standard LaTeX document class
  size10.clo    2007/10/19 v1.4h Standard LaTeX file (size option)
polyglossia.sty    2014/05/21 v1.33.5 Babel replacement for XeLaTeX and LuaTeX
etoolbox.sty    2011/01/03 v2.1 e-TeX tools for LaTeX
    etex.sty    1998/03/26 v2.0 eTeX basic definition package (PEB)
makecmds.sty    2009/09/03 v1.0a extra command making commands
 xkeyval.sty    2014/05/25 v2.7 package option processing (HA)
 xkeyval.tex    2014/05/25 v2.7 key=value parser (HA)
fontspec.sty    2014/06/21 v2.4a Font selection for XeLaTeX and LuaLaTeX
   expl3.sty    2014/09/15 v5423 L3 programming layer (loader) 
expl3-code.tex    2014/09/15 v5423 L3 programming layer 
l3unicode-data.def    2014/08/12 v5276 L3 Unicode data
l3xdvipdfmx.def    
  xparse.sty    2014/09/15 v5423 L3 Experimental document command parser
fontspec-patches.sty    2014/06/21 v2.4a Font selection for XeLaTeX and LuaLaTe
X
fontspec-xetex.sty    2014/06/21 v2.4a Font selection for XeLaTeX and LuaLaTeX
 fontenc.sty
  eu1enc.def    2010/05/27 v0.1h Experimental Unicode font encodings
  eu1lmr.fd    2009/10/30 v1.6 Font defs for Latin Modern
xunicode.sty    2011/09/09 v0.981 provides access to latin accents and many oth
er characters in Unicode lower plane
 eu1lmss.fd    2009/10/30 v1.6 Font defs for Latin Modern
graphicx.sty    2014/04/25 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty    2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg    2010/04/23 v1.9 graphics configuration of TeX Live
   xetex.def    2014/07/25 v4.03 LaTeX color/graphics driver for XeTeX (RRM/JK)

fontspec.cfg
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
 ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional
gloss-german.ldf    polyglossia: module for german
 babelsh.def    2013/04/30 Babel common definitions for shorthands
 Taken verbatim from babel.def (2013/04/15 v3.9e)
csquotes.sty    2011/10/22 v5.1d context-sensitive quotations
csquotes.def    2011/10/22 v5.1d csquotes generic definitions
csquotes.cfg    
hyperref.sty    2012/11/06 v6.83m Hypertext links for LaTeX
hobsub-hyperref.sty    2012/05/28 v1.13 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty    2012/05/28 v1.13 Bundle oberdiek, subset generic (HO)
  hobsub.sty    2012/05/28 v1.13 Construct package bundles (HO)
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)
 ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
  ifvtex.sty    2010/03/01 v1.5 Detect VTeX and its facilities (HO)
 intcalc.sty    2007/09/27 v1.1 Expandable calculations with integers (HO)
   ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
etexcmds.sty    2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
kvsetkeys.sty    2012/04/25 v1.16 Key value parser (HO)
kvdefinekeys.sty    2011/04/07 v1.3 Define keys (HO)
pdftexcmds.sty    2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
pdfescape.sty    2011/11/25 v1.13 Implements pdfTeX's escape features (HO)
bigintcalc.sty    2012/04/08 v1.3 Expandable calculations on big integers (HO)
  bitset.sty    2011/01/30 v1.1 Handle bit-vector datatype (HO)
uniquecounter.sty    2011/01/30 v1.2 Provide unlimited unique counter (HO)
letltxmacro.sty    2010/09/02 v1.4 Let assignment for LaTeX macros (HO)
 hopatch.sty    2012/05/28 v1.2 Wrapper for package hooks (HO)
xcolor-patch.sty    2011/01/30 xcolor patch
atveryend.sty    2011/06/30 v1.8 Hooks at the very end of document (HO)
atbegshi.sty    2011/10/05 v1.16 At begin shipout hook (HO)
refcount.sty    2011/10/16 v3.4 Data extraction from label references (HO)
 hycolor.sty    2011/01/30 v1.7 Color options for hyperref/bookmark (HO)
 auxhook.sty    2011/03/04 v1.3 Hooks for auxiliary files (HO)
kvoptions.sty    2011/06/30 v3.11 Key value format for package options (HO)
  pd1enc.def    2012/11/06 v6.83m Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg    2002/06/06 v1.2 hyperref configuration of TeXLive
     url.sty    2013/09/16  ver 3.4  Verb mode for urls, etc.
  hxetex.def    2012/11/06 v6.83m Hyperref driver for XeTeX
   puenc.def    2012/11/06 v6.83m Hyperref: PDF Unicode definition (HO)
stringenc.sty    2011/12/02 v1.10 Convert strings between diff. encodings (HO)
rerunfilecheck.sty    2011/04/15 v1.7 Rerun checks for auxiliary files (HO)
   t3cmr.fd    2001/12/31 TIPA font definitions
 nameref.sty    2012/10/27 v2.43 Cross-referencing by name of section
gettitlestring.sty    2010/12/03 v1.4 Cleanup title references (HO)
csquotes-section.out
csquotes-section.out
se-ascii-print.def    2011/12/02 v1.10 stringenc: Printable ASCII characters
 ***********

答案1

使用的引用机制与德国人设置的"Babel 简写相冲突。实际上,这也发生在和 上,其中用于引用的 会毫无警告地终止简写。polyglossiapdflatexbabel"babel

因此,不推荐使用babel或 来使用该方法polyglossia

如果你真的不需要简写,那就这样做

\usepackage{polyglossia}
\setmainlanguage{german}
\shorthandoff{"}
\usepackage{csquotes}
\MakeOuterQuote{"}

相关内容