3

I encounter a problem of which I speculate it might be a clash or bug in polyglossia. In the MWE when \usepackage{polyglossia} is commented out, running pdflatex or xelatex yields the same .ent (endnote)file. (PNTest.ent-pdflatex, PNTest.ent-xelatex1)

When running xelatex with \usepackage{polyglossia} in force a different .ent file is generated (PNTest.ent-xelatex2), which leads to error messages when this file is processed.

The code in the MWE is part of a larger package, but it boils down to this with respect to the error I encounter.

Could some kind guru shed some light in the darkness?

MWE

File 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}

File 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}

File 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}
3

It looks like a bug in polyglossia It makes \sffamily fragile.

It works if you change your test file to look like:

\usepackage{polyglossia}
\typeout{\meaning\sffamily}
\protected\edef\sffamily{\expandafter\unexpanded\expandafter{\sffamily}}
\typeout{\meaning\sffamily}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.