我遇到一个问题,我猜测它可能是 polyglossia 中的冲突或错误。在 MWE 中,当\usepackage{polyglossia}
被注释掉时,运行pdflatex
或xelatex
会产生相同的.ent
(endnote) 文件。(PNTest.ent-pdflatex
, PNTest.ent-xelatex1
)
当强制运行时,xelatex
会生成\usepackage{polyglossia}
一个不同的文件( ),这会导致在处理该文件时出现错误消息。.ent
PNTest.ent-xelatex2
MWE 中的代码是一个更大包的一部分,但就我遇到的错误而言,它归结为这一点。
有哪位仁慈的大师能在黑暗中带来一丝光明吗?
平均能量损失
文件PNTest.tex
\documentclass[fontsize=12pt]{scrbook}
\usepackage{polyglossia}
\usepackage{ifthen}
\usepackage{expl3}
\usepackage{xparse}
\usepackage{needspace}
\usepackage{xspace}
\usepackage[page,continuous]{pagenote}%
\renewcommand{\textinnotes}[1]{% % remove [ ] in the marking text
#1\quad% % and use an own format
}%
\renewcommand{\notenumintext}[1]{}% skip the notemark in the text
\renewcommand*{\pagenotesubhead}[2]{}%get rid of subhead in notelist
\makeatletter
\renewcommand*{\notedivision}{\chapter*{\vspace*{-2em}\Large\Dyn@Notesname}}
\def\Dyn@Notes@Cnt{\thechapter}
\newcommand{\Dyn@Notesname}{Annotations}
\newcommand{\Dyn@Explanation}{for explanation}
\newcommand{\Dyn@NoteName}{Annotation}
\newcommand{\Dyn@NoteText}{see \Dyn@NoteName~\thepagenote\ on \Dyn@PageName}
\newcommand{\Dyn@PageName}{page}
%
\NewDocumentCommand\DynNote{smO{\Dyn@Explanation}m}{%
% DynNote*{item}[expl]{description}
% #1 #2 #3 #4
% 1) Typesets \footnote{expl}. If no <expl> is given, get it from the
% default by calling \Dyn@Explanation.
% 2) Typesets a page- chap- or endnote with item\\description.
% Starred version
% 3) Adds (item,expl) to the wordlist with bold pageno. Note that it is
% impossible to give a 'language' here. If no association exists, then
% the association is made now.
%
%\typeout{DEBUG: \#1= #1,\#2= #2, \#3= #3, \#4= #4}
\IfBooleanTF#1{% Star
\ifthenelse{\equal{#3}{\Dyn@Explanation}}%
{\AddToList{#2}[\csname dynnotes@#2\endcsname|textbf]}%
{\AddToList{#2}[#3|textbf]%
\Associate{#2}{#3}}%
}{}% [No]Star
%\typeout{DEBUG: pagenote 1}
\pagenote[% Layout setup at customizing package pagenote
\protect\needspace{3\baselineskip}%
\hspace*{-1em}%
\textbf{\protect\small\sffamily\Dyn@NoteName~\thepagenote}\\
\textbf{\protect\footnotesize\sffamily#2}%
]{%
\\% insert a newline
\protect\label{en:\Dyn@Notes@Cnt:\expandafter\thepagenote}%
\sffamily%
#4%
}%
%\typeout{DEBUG: pagenote 2}
\footnote{#3, \Dyn@NoteText~\pageref{en:\Dyn@Notes@Cnt:\thepagenote}}%
%
%\par DEBUG: note:\Dyn@Notes@Cnt:\theendnote, en:\Dyn@Notes@Cnt:\theendnote
\xspace}% DynNote
\makeatother
\makepagenote
\begin{document}
Testin pagenotes
The .ent file is different when run pdflatex or xelatex
DynNote1\DynNote{DynExample1}[DynExplanation1]{DynText1}
\printnotes
\end{document}
文件PNTest.ent-pdflatex
/PNTest.ent-xelatex1
\noteentry{1}{\needspace {3\baselineskip }\hspace *{-1em}\textbf {\small \sffamily Annotation\nobreakspace {}1}\\ \textbf {\footnotesize \sffamily DynExample1}}{\\\label {en:0:1}\sffamily DynText1}{1}
文件PNTest.ent-xelatex2
\noteentry{1}{\needspace {3\baselineskip }\hspace *{-1em}\textbf {\small \sffamily \def rm{sf}Annotation\nobreakspace {}1}\\ \textbf {\footnotesize \sffamily \def rm{sf}DynExample1}}{\\\label {en:0:1}\sffamily \def rm{sf}DynText1}{1}
答案1
它看上去像是一个漏洞,polyglossia
让它变得\sffamily
脆弱。
如果您将测试文件更改为如下所示,它就会起作用:
\usepackage{polyglossia}
\typeout{\meaning\sffamily}
\protected\edef\sffamily{\expandafter\unexpanded\expandafter{\sffamily}}
\typeout{\meaning\sffamily}