我在图形环境的标题中有一个尾注。编译时,尾注被打印了两次。
但是,如果删除 b5paper 选项,或者从 endnote 命令前面的标题中删除一两个单词,则编号是正确的。
\documentclass[11pt,b5paper,draft]{book}
\usepackage{geometry}
\usepackage[split=chapter,reset=true]{enotez}
\usepackage{graphicx}
\begin{document}
\chapter{title}
More generally, `it is to this source we must look for the increase of property of every description\endnote{Some text.}
\begin{figure}
\begin{center}
\caption{for five British manufacturing sectors, 1730–1820. 1780 = 100.\endnote{Data from R. V. Jackson, ‘Rates of Industrial Growth during the Industrial Revolution,’ EHR 45 (1992), 18.}}
\end{center}
\label{figure31}
\end{figure}
\printendnotes
\end{document}
答案1
手动解决方案(请参阅下文以了解此方法的自动化)
一个丑陋的解决方法...我使用在标题内设置尾注编号,然后在标题外面的一个临时框中\textsuperscript
设置。\endnote
\documentclass[11pt,b5paper,draft]{book}
\usepackage{geometry}
\usepackage[split=chapter,reset=true]{enotez}
\usepackage{graphicx}
\begin{document}
\chapter{title}
More generally, `it is to this source we must look for the increase of property of every description\endnote{Some text.}
\begin{figure}
\begin{center}
\caption{for five British manufacturing sectors, 1730–1820. 1780 = 100.%
\textsuperscript{\the\numexpr\theendnote+1\relax}}
\setbox0=\hbox{\endnote{Data from R. V. Jackson, ‘Rates of Industrial Growth during the Industrial Revolution,’ EHR 45 (1992), 18.}}
\end{center}
\label{figure31}
\end{figure}
\printendnotes
\end{document}
自动解决方案(如果每个标题只有一个尾注)
这里我介绍了\encaption[<toc-caption-text>]{<caption-text>}{<endnote-text>}
只包含一个尾注的标题。在 内caption-text
,应使用 来\entag
表示尾注标签应放置在何处。
这样设置是为了让尾注标签不会出现在图表列表中,符合 OP 对 egreg 的评论。
\documentclass[11pt,b5paper,draft]{book}
\usepackage{geometry}
\usepackage[split=chapter,reset=true]{enotez}
\usepackage{graphicx}
\usepackage{xpatch}
\newcommand\encaption[3][\relax]{%
\ifx\relax#1\relax\caption{#2}\setbox0=\hbox{\endnote{#3}}\else%
\caption[#1]{#2}\setbox0=\hbox{\endnote{#3}}\fi
}
\def\entag{\protect\entaghelp}
\def\setentag{\def\entaghelp{\textsuperscript{\the\numexpr\theendnote+1\relax}}}
\let\entaghelp\relax
\apptocmd{\listoffigures}{\setentag}{}{}
\begin{document}
\listoffigures
\chapter{title}
More generally, `it is to this source we must look for the increase of property of every description\endnote{Some text.}
\begin{figure}
\centering
\encaption{for five British manufacturing sectors, 1730–1820. 1780 = 100.%
\entag}{%
Data from R. V. Jackson, ‘Rates of Industrial Growth during the Industrial Revolution,’ EHR 45 (1992), 18.}
\label{figure31}
\end{figure}
\printendnotes
\end{document}
答案2
这是一个难题; 的标准工作\caption
是排版以获取其大小。这已将尾注文本存储在内存中;如果标题比文本宽度宽,它是排版的再次这会再次存储尾注。这就是您的情况。
一个解决方案是避免标题文本的双重排版。
无论如何,如果您编译图表列表,则必须使用可选参数,否则尾注也会出现在那里。
对于这种情况,包应该实现\endnotemark
和\endnotetext
。根据文档,作者认为它们不需要:他错了。用于存储当前尾注编号的计数器也应该公开。
\documentclass[11pt,b5paper,draft]{book}
\usepackage{geometry}
\usepackage[split=chapter,reset=true]{enotez}
\usepackage{graphicx}
\makeatletter
%%% ugly hack for not typesetting twice the endnote
\long\def\@makecaption#1#2{%
\vskip\abovecaptionskip
\begingroup
\def\endnote##1{%
\textsuperscript{\the\numexpr\csname g__enotez_endnote_id_int\endcsname+1}%
}%
\sbox\@tempboxa{#1: #2}%
\ifdim \wd\@tempboxa >\hsize
\endgroup
#1: #2\par
\else
\endgroup
\global \@minipagefalse
\hb@xt@\hsize{\hfil#1: #2\hfil}%
\fi
\vskip\belowcaptionskip}
\makeatother
\begin{document}
\chapter{title}
More generally, `it is to this source we must look
for the increase of property of every description\endnote{Some text.}
\begin{figure}
\centering
\caption[for five British manufacturing sectors, 1730--1820. 1780 = 100.]%
{for five British manufacturing sectors, 1730--1820. 1780 = 100.%
\endnote{Data from R. V. Jackson, ‘Rates of Industrial Growth
during the Industrial Revolution,’ EHR 45 (1992), 18.}}
\label{figure31}
\end{figure}
\printendnotes
\end{document}
顺便说一句,不要center
在figure
环境中使用;如果你喜欢它的扩大间距,那很好,但不要在环境之外设置标签center
:它必须与处于同一组级别\caption
。