作者字段脚注中的标签导致“xfootnotemark 与其定义不匹配”

作者字段脚注中的标签导致“xfootnotemark 与其定义不匹配”

我正在尝试使用以下代码在作者字段的脚注\label()中插入\thanks

\author{Gopal \thanks{XYZ university\label{auth1}}}

但是,LaTeX 仍然给出错误\@xfootnotemark doesn't match its definition

如果我删除标签,则不会出现错误。

我为什么要尝试使用标签?两个作者有相同的隶属关系,我想引用第二位作者的现有隶属关系。我也在hyperref为 pdf 使用启用的标签。

我尝试在网上查找此解决方案,但找不到。任何帮助都将不胜感激。

答案1

您可以保存footnote计数器并通过以下方式将其用于第二作者:

\documentclass{article}
\newcounter{savecntr}% Save footnote counter
\newcounter{restorecntr}% Restore footnote counter
\author{Gopal \setcounter{savecntr}{\value{footnote}}\thanks{XYZ University} ,
Someone else \thanks{ABC University} ,
Another \setcounter{restorecntr}{\value{footnote}}%
  \setcounter{footnote}{\value{savecntr}}\footnotemark% Print footnotemark
  \setcounter{footnote}{\value{restorecntr}} ,
Last author \thanks{IJK College}}
\title{My title}
\begin{document}

\maketitle

Here is some text.
\end{document}

两位不同的作者,同一所属机构

这里的想法是footnote在重新使用隶属关系之前存储计数器,然后在使用后恢复它,以便后续作者收到不同的(唯一的)\footnotemark

由于您正在使用hyperref\footnotes因此也使用并希望引用它们很棘手。一方面,常规标题命令\author执行以下两项操作之一,而这两项操作都对脚注没有帮助:它将内容排版为tabular-一个已知问题,导致脚注被困住- 并暂时重新定义工作方式\footnote(通过执行\let\footnote\thanks)。除此之外,hyperref自述\footnotemark暗示了“重新使用无序/无序列”的缺点:

脚注支持相当有限。它超出了使用范围 \footnotemark,并且\footnotetext乱序或重复使用 \footnotemark。在这里,您可以hyperref通过禁用脚注支持hyperfootnotes=false或摆弄内部宏,令人讨厌的例子......

下面的示例可以修改传统footnote计数器以及hyperref的内部Hfootnote计数器。这个“糟糕的示例”使事情正常进行,但它仍然很“糟糕”:

\documentclass{article}
\usepackage[hyperfootnotes]{hyperref}% http://ctan.org/pkg/hyperref
\newcounter{savecntr}% Save footnote counter
\newcounter{restcntr}% Restore footnote counter
\newcounter{Hsavecntr}% Save Hfootnote counter
\newcounter{Hrestcntr}% Restore Hfootnote counter

\begin{document}

\makeatletter
\begingroup
  \let\footnotesize\small \let\footnoterule\relax% Set footnote parameters
  \renewcommand\thefootnote{\@fnsymbol\c@footnote}% Style of footnotes: symbols
  \vskip 60\p@
  \begin{center}%
    {\LARGE My title \par}%
    \vskip 3em%
    {\large
      \lineskip .75em%
      \setcounter{savecntr}{\value{footnote}} \setcounter{Hsavecntr}{\value{Hfootnote}}% Save counters
      Gopal \footnote{XYZ University} ,% First author
      Someone else \footnote{ABC University} ,% Second author
      \setcounter{restcntr}{\value{footnote}} \setcounter{Hrestcntr}{\value{Hfootnote}}% Save restore counters
      \setcounter{footnote}{\value{savecntr}} \setcounter{Hfootnote}{\value{Hsavecntr}}% Restore similar counter
      Another \footnotemark ,% Print footnotemark with third author
      \setcounter{footnote}{\value{restcntr}} \setcounter{Hfootnote}{\value{Hrestcntr}}% Restore original counters
      Last author \footnote{IJK College}% Last author
    \par}%
  \vskip 1.5em%
  {\large \@date \par}%       % Set date in \large size.
  \end{center}\par
\endgroup
\setcounter{footnote}{0}%
\makeatother

Here is some text.\footnote{Here's a footnote.}
\end{document}

标题、作者和日期的定义取自article.cls

更正作者到脚注/附属机构的超链接

答案2

正如其他答案,LaTeX 不仅使用符号而不是数字在标题区域(即标题、作者和日期)生成脚注标记,而且在生成脚注时还会“吞噬”一些相关信息。这使得软件包无法hyperref从脚注标记创建到相应脚注的超链接。

如果您有几位合著者,而您只想避免重复使用脚注来表明两位或更多合著者的同一从属关系,那么不值得(在我看来)费尽心思编写 LaTeX 的脚注标记。相反,类似以下 MWE 的东西应该可以满足几乎所有需求。该示例利用了这样一个事实:在 LaTeX 中,第一个符号脚注标记是凸起的星号 ( *),第二个是\dagger

MWE 还演示了\footnote\thanks命令都在标题区域生成符号脚注。一旦您越过标题区域,脚注编号就会使用阿拉伯数字,正如预期的那样。祝您 TeXing 愉快!

在此处输入图片描述

\documentclass{article}
\usepackage[colorlinks=true]{hyperref}
\setlength\textheight{5.5cm} % just for this example

\title{Some Title}
\author{AuthOne\footnote{University A.} % note use of "\footnote"
  \and AuthTwo\thanks{University B.} 
  \and AuthThree$^*$ 
  \and AuthFour$^\dagger$}
\date{} % suppress 'date'

\begin{document}
\maketitle   
Hello World.\footnote{More random text.}
\end{document}

答案3

首先假设我们没有启用。只需使用 定义包含括号hyperref外标签的脚注,然后使用 ,您可以通过将其带入 内来添加它。当然,还有一些事情需要关注,例如脚注的索引在整数和符号之间更改以及它们的计数器。我在下面提供了一个示例,我想它明确解释了它的所有技术细节。\author{}\footnotetext\footnoteref\newcommand\author

\documentclass[10pt,a4paper]{article}

% LaTeX will use symbols instead of integers to index the footnotes in author section.
% We are going to have a manual footnote for the author section but defining it outside of \author{}. Then LaTeX will use integers and not symbols for indexing it.
% To keep things consistent, we use the following line to ask LaTeX to use symbols for indexing footnotes even outside of the author section. Later we will turn it back to the integers.
\renewcommand{\thefootnote}{\fnsymbol{footnote}}

% Defining a foornoteref command to refer to the labels we define for footnotes.
\makeatletter
\newcommand\footnoteref[1]{\protected@xdef\@thefnmark{\ref{#1}}\@footnotemark}
\makeatother

% Let us assume that there are two authors with the same affiliation and we do not like to have two lines of footnotes which are exact copy of each other. So we will define this footnote outside manually once using footnotetext and then by footnoteref we put it in author section for both authors.
\footnotetext[1]{\label{foot:affiliation}Royal Persian Society of Science, Isfahan, Kingdom of Persia}

% Put the last index number of the above footnotetexts below. Otherwise the index of the footnotes in the author section will start from beginning again.
\setcounter{footnote}{1}

\author{
    AmirHosein Sadeghimanesh\footnoteref{foot:affiliation} \footnote{[email protected].??}
    and
    My Collaborator\footnoteref{foot:affiliation} \footnote{[email protected].??}
}

\title{How to have labels in footnotes in author section of a paper in \LaTeX without using a package}

\date{Mehr 28, 2581}

% Telling LaTeX that now it can start indexing footnotes with integers instead of symbols.
\renewcommand{\thefootnote}{\arabic{footnote}}

\begin{document}
    \maketitle
    
    Here we just write a sentence and give it a footnote to see that the index of footnotes are back to integers.\footnote{Just a footnote.}
    
\end{document}

输出结果如下。

在此处输入图片描述

现在让我们启用hyperref。您可能会收到以下错误(至少我遇到了)。

Argument of \Hy@setref@link has an extra }.

为了解决这个问题,我们需要移动footnotetext后面的内容\begin{document}(感谢@UlrikeFischer)。新代码如下所示。

\documentclass[10pt,a4paper]{article}
\usepackage{hyperref}

% LaTeX will use symbols instead of integers to index the footnotes in author section.
% We are going to have a manual footnote for the author section but defined outside of \author{}. So LaTeX will use integers and not symbols for indexing those.
% To keep things consistent, we use the following line to ask LaTeX to use symbols for indexing footnotes even if they are defined outside of the author's braces. Later we will turn the indexing back to the integers.
\renewcommand{\thefootnote}{\fnsymbol{footnote}}

% Defining a foornoteref command to refer to the labels we define for footnotes.
\makeatletter
\newcommand\footnoteref[1]{\protected@xdef\@thefnmark{\ref{#1}}\@footnotemark}
\makeatother

\author{
    AmirHosein Sadeghimanesh%
    \footnoteref{foot:affiliation} \footnote{[email protected].??}
    and
    My Collaborator%
    \footnoteref{foot:affiliation} \footnote{[email protected].??}
}

\title{How to have labels in footnotes in author section of a paper in \LaTeX without using a package}

\date{Mehr 28, 2581}

\begin{document}
    
    % Let us assume that there are two authors with the same affiliation and we do not like to have two lines of footnotes which are exact copy of each other. So we will define this footnote outside manually once using footnotetext and then by footnoteref we put it in author section for both authors.
    \footnotetext[1]{\label{foot:affiliation}Royal Persian Society of Science, Isfahan, Kingdom of Persia}
    
    % Put the last index number of the above footnotetexts below. Otherwise the index of the footnotes in the author section will start from beginning again.
    \setcounter{footnote}{1}
    
    
    %\begin{NoHyper}
        \maketitle
    %\end{NoHyper}
    
    % Telling LaTeX that now it can start indexing footnotes with integers instead of symbols.
    \renewcommand{\thefootnote}{\arabic{footnote}}
    
    Here we just write a sentence and give it a footnote to see that the index of footnotes are back to integers.\footnote{Just a footnote.}
    
\end{document}

这是输出的 pdf。

在此处输入图片描述

输出与之前类似,但现在星号可点击并链接到所属脚注。

相关内容