在以下 MWE 中,依靠csquotes
,"
用作打印外部引号的引号,并使用法语 guillemets 作为输出。
\documentclass[french]{article}
\usepackage[T1]{fontenc}
\usepackage[french=guillemets*]{csquotes}
\usepackage{babel}
\usepackage{hyperref}
\MakeOuterQuote{"}
\begin{document}
\begin{itemize}
\item Proper French guillemets: "Foo", \textbf{"Foo"}.
\item (Un)Proper French guillemets: \href{https://foo.org}{"Foo"}.
\end{itemize}
\end{document}
当用 处理时xelatex
,它会给出预期的结果:
— 正确的法语 guillemets :“Foo”,“Foo”。
— (不)正确的法语 guillemets :“Foo”。
但是,当用pdflatex
或处理时lualatex
,它会产生意想不到的结果:
— 正确的法语 guillemets :“Foo”,“Foo”。
— (不)正确的法语 guillemets:“Foo”。
你明白发生了什么事吗?
(更新 TeX Live 2023 时遇到此问题:
*File List*
article.cls 2023/05/17 v1.4n Standard LaTeX document class
size10.clo 2023/05/17 v1.4n Standard LaTeX file (size option)
fontenc.sty 2021/04/29 v2.0v Standard LaTeX package
csquotes.sty 2022-09-14 v5.2n context-sensitive quotations (JAW)
etoolbox.sty 2020/10/05 v2.5k e-TeX tools for LaTeX (JAW)
keyval.sty 2022/05/29 v1.15 key=value parser (DPC)
csquotes.def 2022-09-14 v5.2n csquotes generic definitions (JAW)
csquotes.cfg
babel.sty 2023/10/25 v3.96 The Babel package
french.ldf 2023/03/08 v3.5q French support from the babel system
babel-french.tex
scalefnt.sty
hyperref.sty 2023-10-21 v7.01c Hypertext links for LaTeX
ltxcmds.sty 2020-05-10 v1.25 LaTeX kernel commands for general use (HO)
iftex.sty 2022/02/03 v1.0f TeX engine tests
pdftexcmds.sty 2020-06-27 v0.33 Utility functions of pdfTeX for LuaTeX (HO)
infwarerr.sty 2019/12/03 v1.5 Providing info/warning/error messages (HO)
kvsetkeys.sty 2022-10-05 v1.19 Key value parser (HO)
kvdefinekeys.sty 2019-12-19 v1.6 Define keys (HO)
pdfescape.sty 2019/12/09 v1.15 Implements pdfTeX's escape features (HO)
hycolor.sty 2020-01-27 v1.10 Color options for hyperref/bookmark (HO)
letltxmacro.sty 2019/12/03 v1.6 Let assignment for LaTeX macros (HO)
auxhook.sty 2019-12-17 v1.6 Hooks for auxiliary files (HO)
nameref.sty 2023-10-05 v2.54 Cross-referencing by name of section
refcount.sty 2019/12/15 v3.6 Data extraction from label references (HO)
gettitlestring.sty 2019/12/15 v1.6 Cleanup title references (HO)
kvoptions.sty 2022-06-15 v3.15 Key value format for package options (HO)
pd1enc.def 2023-10-21 v7.01c Hyperref: PDFDocEncoding definition (HO)
intcalc.sty 2019/12/15 v1.3 Expandable calculations with integers (HO)
puenc.def 2023-10-21 v7.01c Hyperref: PDF Unicode definition (HO)
url.sty 2013/09/16 ver 3.4 Verb mode for urls, etc.
bitset.sty 2019/12/09 v1.3 Handle bit-vector datatype (HO)
bigintcalc.sty 2019/12/15 v1.5 Expandable calculations on big integers (HO)
atbegshi-ltx.sty 2021/01/10 v1.0c Emulation of the original atbegshi
package with kernel methods
hpdftex.def 2023-10-21 v7.01c Hyperref driver for pdfTeX
atveryend-ltx.sty 2020/08/19 v1.0a Emulation of the original atveryend packa
ge
with kernel methods
rerunfilecheck.sty 2022-07-10 v1.10 Rerun checks for auxiliary files (HO)
uniquecounter.sty 2019/12/15 v1.4 Provide unlimited unique counter (HO)
l3backend-pdftex.def 2023-10-23 L3 backend support: PDF output (pdfTeX)
test.out
test.out
***********
)
答案1
那么你可以尝试\Hy@safe@activestrue
从 中删除\hyper@chars
。由于现在几乎所有活跃角色都受到保护,所以可能不需要这样做。
但请注意,您无法在书签中获得正确的引号。我个人不会使用"
引号(例如,它会与德语简写冲突)。另请参阅https://tex.stackexchange.com/a/472729/2388
\documentclass[french]{article}
\usepackage[T1]{fontenc}
\usepackage[french=guillemets*]{csquotes}
\usepackage{babel}
\usepackage{hyperref}
\MakeOuterQuote{"}
\makeatletter
\renewcommand*\hyper@chars{%
\let\#\hyper@hash
\let\%\@percentchar
% \Hy@safe@activestrue
}
\makeatother
\begin{document}
\section{"Foo"}
\begin{itemize}
\item Proper French guillemets: "Foo", \textbf{"Foo"}.
\item (Un)Proper French guillemets: \href{https://foo.org}{"Foo"}.
\end{itemize}
\end{document}