使用符号作为尾注标记时出错

使用符号作为尾注标记时出错
\documentclass{memoir}

\usepackage{endnotes}

% These work just fine:
%   \renewcommand{\theendnote}{\alph{endnote}}
%   \renewcommand{\theendnote}{\arabic{endnote}}
%   \renewcommand{\theendnote}{\Roman{endnote}}

% But this does not:
    \renewcommand{\theendnote}{\fnsymbol{endnote}}

\begin{document}

This is some text.\endnote{This is an endnote.}

\theendnotes

\end{document}

我使用的是 Linux Mint 18,其中包含软件包“texworks”(0.5~svn1363-6build2)和“texlive-full”(2015.20160320-1)。在这些版本之前,我可以轻松将符号用作尾注标记。但是现在,它会出现一个错误:

TeX capacity exceeded, sorry [input stack size=5000].
\font@name ->
    \OMS/cmr/m/n/7
l.15 ...is some text.\endnote{This is an endnote.}

我尝试了上述 MWE,得到了相同的结果,所以我假设这不是我的代码。我需要同时使用尾注和脚注,但要以非传统的位置放置。后者不会给我带来任何麻烦,只有前者会。

新问题:

Egreg 的解决方案对我来说很管用。然而,我决定按照他在后续帖子中建议的那样尝试“enotez”包,现在我又遇到了同样的问题!

\documentclass[12pt]{article}

\pagestyle{empty}
    \usepackage[counter-format=roman]{enotez} % This works.
%   \usepackage[counter-format=symbols]{enotez} % This does not.

\begin{document}

This is my first sentence.\endnote{A notation placed arbitrarily.}

This is my second sentence.%
\footnote{A reference placed at the bottom of the page.}%
\footnote{Another reference.}%
\footnote{Yet another.}

\DeclareInstance{enotez-list}{custom}{paragraph}{heading=\bigskip}
\printendnotes[custom]

\end{document}

答案1

不幸的是,它的工作endnotes原理\write。您可以通过定义“更好保护”的版本来修复此问题\fnsymbol

\documentclass{article}% or memoir or any other class

\usepackage{endnotes}

\makeatletter
\newcommand{\pfnsymbol}[1]{%
  \expandafter\@pfnsymbol\expandafter{\the\csname c@#1\endcsname}%
}
\protected\def\@pfnsymbol#1{\@fnsymbol{#1}}
\makeatother

\renewcommand{\theendnote}{\pfnsymbol{endnote}}

\begin{document}

This is some text.\endnote{This is an endnote.}

\theendnotes

\end{document}

在此处输入图片描述

这是一个“概念上更好”的解决方案,它可以修补错误而endnotes.sty不是在文档级别添加一个层。

\documentclass{article}% or memoir or any other class

\usepackage{endnotes}
\usepackage{xpatch}

\makeatletter
% http://tex.stackexchange.com/a/192133/
% get a copy of `\protected@write
\let\protected@iwrite\protected@write
% patch the copy to add \immediate
\xpatchcmd{\protected@iwrite}{\write}{\immediate\write}{}{}

% patch endnotes to use \protected@iwrite instead of \immediate\write
\xpatchcmd{\@endnotetext}{\immediate\write\@enotes}{\protected@iwrite\@enotes{}}{}{}
\xpatchcmd{\@endnotetext}{\immediate\write\@enotes}{\protected@iwrite\@enotes{}}{}{}
\xpatchcmd{\@endnotetext}{\immediate\write\@enotes}{\protected@iwrite\@enotes{}}{}{}
% patch endnotes to use \protected@edef instead of \edef
\xpatchcmd{\theendnotes}{\edef\@currentlabel}{\protected@edef\@currentlabel}{}{\ddt}
\makeatother

\renewcommand{\theendnote}{\fnsymbol{endnote}}

\begin{document}

This is some text.\endnote{This is an endnote.}

\theendnotes

\end{document}

相关内容