enotez – 单独打印单个尾注(或同步 enotez 和脚注计数器)

enotez – 单独打印单个尾注(或同步 enotez 和脚注计数器)

我的目标

我正在使用该enotez包将尾注放在页边距上。

但是插入超链接时,我想将 URL 设置为“标准” LaTeX 脚注。

尽管如此,脚注/尾注计数器应该是连续的(1,2, 3, ...) 而不是像 MWE 中断那样 (1,1, 2, ...), “标准”脚注是大胆的这里有一个。


平均能量损失

\documentclass[12pt, a4paper]{article}
\usepackage[a4paper,left=30mm,right=45mm]{geometry}


\usepackage[english]{babel}
\usepackage{blindtext}


\usepackage{calc}


\usepackage{enumitem}
    \setlist{%
        labelindent=0pt,
        font=\bfseries,
        labelwidth=1em,
        leftmargin=0pt,
        itemindent=2em,
        labelsep=1em,
    }


\usepackage{hyperref}
    \newcommand{\link}[3]{%
        \href{#1}{\underline{#2}}%
        \footnote{URL:\hspace{1em}\href{#1}{#1} #3}%
    }


\usepackage{marginnote}
    \newcommand{\minimarginnote}[1]{\marginnote{\footnotesize#1}}
    \setlength{\marginparsep}{5mm}
    \setlength{\marginparwidth}{30mm}


\usepackage{enotez}
    \setenotez{backref = true}
    % Formatting for endnotes in the 'list' style (option "sidenotes")
    \DeclareInstance{enotez-list}{sidenotes}{list}{%
        heading = {\footnotesize\textbf{#1:}},
        format = \footnotesize,
        list-type = enumerate
    }
    % 'Sidenotes' will get printed as margin notes
    \newcommand{\printsidenotes}{%
        \marginnote{%
            \printendnotes[sidenotes]
        }
    }


% -------------------------


\begin{document}

Here, I'm writing some lines about my problem and what I'm intending to do. I hope you get what I mean. This is a ``before'' endnote\endnote{This is an endnote.}.

In this paragraph, I'm using a \link{https://tex.stackexchange.com/}{hyperlink}{This footnote should be number \textbf{2}.} with a ``standard'' footnote in order to demonstrate my problem.

Now I just need to insert the ``after'' endnote\endnote{This is another endnote. But it should be number \textbf{3}.} in this paragraph.

\printsidenotes[-5\baselineskip]

\end{document}

结果

身体:

MWE 结果(正文)

脚注:

MWE 的结果(脚注)


问题

有什么办法吗

  • 单独打印单个尾注,即在单独的脚注之前输入的尾注将传递到下一个\printendnotes命令或
  • enotez同步和的计数器footnote,即引用数字的顺序是否正确?

答案1

教导 LaTeX 对脚注和尾注使用相同的计数器。

\documentclass[12pt, a4paper]{article}
\usepackage[a4paper,left=30mm,right=45mm]{geometry}

\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{enumitem}

\usepackage{marginnote}
\usepackage{enotez}

\usepackage{hyperref} % should be last

% enumitem
\setlist{%
    labelindent=0pt,
    font=\bfseries,
    labelwidth=1em,
    leftmargin=0pt,
    itemindent=2em,
    labelsep=1em,
}

% marginnote
\newcommand{\minimarginnote}[1]{\marginnote{\footnotesize#1}}
\setlength{\marginparsep}{5mm}
\setlength{\marginparwidth}{30mm}

% enotez
\setenotez{backref = true}
% Formatting for endnotes in the 'list' style (option "sidenotes")
\DeclareInstance{enotez-list}{sidenotes}{list}{%
    heading = {\footnotesize\textbf{#1:}},
    format = \footnotesize,
    list-type = enumerate
}
% 'Sidenotes' will get printed as margin notes
\newcommand{\printsidenotes}{%
    \marginnote{%
        \printendnotes[sidenotes]
    }%
}
\makeatletter % make \footnote use the same counter as \endnote
\let\c@footnote\c@endnote
\makeatother

% links
\newcommand{\link}[3]{%
    \href{#1}{\underline{#2}}%
    \footnote{URL:\hspace{1em}\href{#1}{#1} #3}%
}

%%%% just to make a smaller picture
\setlength{\textheight}{5cm}

\begin{document}

Here, I'm writing some lines about my problem and what I'm intending to do. I hope 
you get what I mean. This is a ``before'' endnote\endnote{This is an endnote.}.

In this paragraph, I'm using a 
\link{https://tex.stackexchange.com/}{hyperlink}{This footnote should be number \textbf{2}.} 
with a ``standard'' footnote in order to demonstrate my problem.

Now I just need to insert the ``after'' endnote\endnote{This is another endnote. 
But it should be number \textbf{3}.} in this paragraph.

\printsidenotes[-5\baselineskip]

\end{document}

您会注意到我重新整理了代码。在加载包后立即设置包似乎更实用,但这会使序言变得混乱。此外,设置可能会纠缠在一起并依赖于其他已加载的包。

在此处输入图片描述

相关内容