14

I am trying to figure out how it happens that \thanks in the standard LaTeX article class (with no options specified) is typeset with an asterisk for the footnote mark.

I got lost trying to trace the definitions and redefinitions of \@thanks and \footnotemark and \c@footnote through article.cls and latex.ltx. I also tried grepping all the LaTeX base files for \\ast, thinking that this must be used somewhere to redefine the footnote mark, but I couldn't find anything.

(This question came up because I would like to convert the \thanks footnote to an endnote for journal submission, but my question is about the mechanics of this command.)

MWE:

\documentclass{article}
\begin{document}
\title{Example}
\author{Name\thanks{Affiliation, e-mail}}
\maketitle
\end{document}

Here's what I have been able to figure out:

The definition of \maketitle in article.cls:

\newcommand\maketitle{\par                                                                     
  \begingroup                                                                                  
    \renewcommand\thefootnote{\@fnsymbol\c@footnote}%                                          
    \def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}%                        
    \long\def\@makefntext##1{\parindent 1em\noindent                                           
            \hb@xt@1.8em{%                                                                     
                \hss\@textsuperscript{\normalfont\@thefnmark}}##1}%                            
    \if@twocolumn                                                                              
      \ifnum \col@number=\@ne                                                                  
        \@maketitle                                                                            
      \else                                                                                    
        \twocolumn[\@maketitle]%                                                               
      \fi                                                                                      
    \else                                                                                      
      \newpage                                                                                 
      \global\@topnum\z@   % Prevents figures from going at top of page.                       
      \@maketitle                                                                              
    \fi                                                                                        
    \thispagestyle{plain}\@thanks                                                              
  \endgroup                                                                                    
  \setcounter{footnote}{0}%                                                                    
  \global\let\thanks\relax                                                                     
  \global\let\maketitle\relax                                                                  
  \global\let\@maketitle\relax                                                                 
  \global\let\@thanks\@empty                                                                   
  \global\let\@author\@empty                                                                   
  \global\let\@date\@empty                                                                     
  \global\let\@title\@empty                                                                    
  \global\let\title\relax                                                                      
  \global\let\author\relax                                                                     
  \global\let\date\relax                                                                       
  \global\let\and\relax                                                                        
}

I see that the footnotemark is redefined in some way, and that \@thanks is called at the end. But \thanks and \@thanks are not defined in this file.

Here are the definitions of \thanks and \@thanks in latex.ltx:

\def\thanks#1{\footnotemark                                                                    
    \protected@xdef\@thanks{\@thanks                                                           
        \protect\footnotetext[\the\c@footnote]{#1}}%                                           
}                                                                                              
\let\@thanks\@empty

It seems like \thanks redefines \@thanks to be \@thanks plus a footnote containing its argument. It looks like \thec@footnote would produce the value of a footnote counter and typeset a numeral, not an asterisk. The article class calls \@thefnmark in \maketitle but never redefines it to an asterisk (that I can tell).

  • In case anyone wants an MWE: \documentclass{article} \begin{document} \title{} \thanks{A star was born} \maketitle \end{document} – bers Jan 26 '16 at 18:47
  • This is the command: \thanks: macro:#1->\footnotemark \protected@xdef \@thanks {\@thanks \protect \footnotetext [\the \c@footnote ]{#1}} – Sigur Jan 26 '16 at 18:53
  • 2
    What you get with \protected@edef is a “cumulative” definition: \@thanks gets what it contained before along with the text of the new footnote. – egreg Jan 26 '16 at 19:10
13

Let's look at some definitions:

  • \thanks within article.cls:

    \def\thanks#1{\footnotemark
        \protected@xdef\@thanks{\@thanks
            \protect\footnotetext[\the\c@footnote]{#1}}%
    }
    

    This macro sets a footnote mark - \footnotemark. Then it adds the footnote text to \@thanks using \protected@xdef\@thanks{\@thanks <new footnote text>}.

  • \maketitle in article.cls:

    \newcommand\maketitle{\par
      \begingroup
        \renewcommand\thefootnote{\@fnsymbol\c@footnote}%
        \def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}%
        \long\def\@makefntext##1{\parindent 1em\noindent
                \hb@xt@1.8em{%
                    \hss\@textsuperscript{\normalfont\@thefnmark}}##1}%
        \if@twocolumn
          \ifnum \col@number=\@ne
            \@maketitle
          \else
            \twocolumn[\@maketitle]%
          \fi
        \else
          \newpage
          \global\@topnum\z@   % Prevents figures from going at top of page.
          \@maketitle
        \fi
        \thispagestyle{plain}\@thanks
      \endgroup
      \setcounter{footnote}{0}%
      \global\let\thanks\relax
      \global\let\maketitle\relax
      \global\let\@maketitle\relax
      \global\let\@thanks\@empty
      \global\let\@author\@empty
      \global\let\@date\@empty
      \global\let\@title\@empty
      \global\let\title\relax
      \global\let\author\relax
      \global\let\date\relax
      \global\let\and\relax
    }
    

    Inside \maketitle, a number of redefinitions of the footnote mechanism occurs within a group \begingroup...\endgroup.

    Firstly, the footnote numbering is changed to \@fnsymbol - the regular *, , , §, , , **, ††, ‡‡, (error) sequence:

    \def\@fnsymbol#1{\ensuremath{\ifcase#1\or *\or \dagger\or \ddagger\or
       \mathsection\or \mathparagraph\or \|\or **\or \dagger\dagger
       \or \ddagger\ddagger \else\@ctrerr\fi}}
    

    Secondly, an update is made to the way the footnote mark and text is set - that is, the macros \@makefnmark and \@makefntext are updated. These updates (redefinitions) are very minimal in the sense that they really are very similar to the original definitions outside the \maketitle usage (also taken from latex.ltx:

    % From latex.ltx
    \def\@makefnmark{\hbox{\@textsuperscript{\normalfont\@thefnmark}}}
    % From article.cls
    \newcommand\@makefntext[1]{%
        \parindent 1em%
        \noindent
        \hb@xt@1.8em{\hss\@makefnmark}#1}
    

    The only major difference is that the footnote mark is set using \rlap. This is because within the list of \authors, you'd typically separate with a ,, for which this redefinition allows the footnote mark to overlap with.

    Thirdly the actual title is set using \@maketitle:

    \def\@maketitle{%
      \newpage
      \null
      \vskip 2em%
      \begin{center}%
      \let \footnote \thanks
        {\LARGE \@title \par}%
        \vskip 1.5em%
        {\large
          \lineskip .5em%
          \begin{tabular}[t]{c}%
            \@author
          \end{tabular}\par}%
        \vskip 1em%
        {\large \@date}%
      \end{center}%
      \par
      \vskip 1.5em}
    

    The setting of the \thanks marks (footnote marks) as well as the collection into \@thanks occurs with the setting of \@author.

    Finally, at the end of \maketitle, \@thanks is called, which "releases" the accumulated footnote texts collected with \@author.

    Since \@thanks carries content globally (due to \protected@xdef), it's cleared at the end of \maketitle (outside the \begingroup...\endgroup scope), together with other macros.

Now let's look at an example:

enter image description here

\documentclass{article}
\usepackage[paperheight=20\baselineskip]{geometry}% Just for this example
\title{Some title}
\author{Author1\thanks{Abc}, Author2\thanks{Def} and Author3\thanks{Ghi}}
\begin{document}
\maketitle
\end{document}
  • Note how the overlapping occurs of the footnote marks with the punctuation after Author1.

  • With the addition of

    \usepackage{etoolbox}
    \makeatletter
    % \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
    \patchcmd{\@maketitle}{\@author}{\@author\show\@thanks}{}{}
    \makeatother
    

    to the preamble we can see the .log outputs the sequence of accumulate footnote texts stemming from the \thanks inside \@author:

    > \@thanks=macro:
    ->\protect \footnotetext [1]{Abc}\protect \footnotetext [2]{Def}\protect \footn
    otetext [3]{Ghi}.
    \@maketitle ...ular}[t]{c}\@author \show \@thanks 
                                                      \end {tabular}\par }\vskip...
    l.11     \maketitle
    

    These are set immediately at the end of \maketitle as mentioned above.

| improve this answer | |
  • This is beautiful: thank you! The key piece of information in your explanation for me was that \maketitle redefines \thefootnote to include \@fnsymbol, thus typesetting one of a series of symbols starting with * instead of a numeral. – musarithmia Jan 26 '16 at 19:56

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.