Skip to content
TheChatArchiveThe Chat Archive
Metallama-4-maverick-03-26-experimental· MetaHugging Face LMArena Human Preference 140K

add 4 footnotes inside table which is inside section in latex. I currently use…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Claudeclaude-sonnet-4-20250514’s answer.
  1. User

    add 4 footnotes inside table which is inside section in latex.

    I currently use \footnotemark and then \footnotetext but footnotetexts are all labeled as latest, and only latest footnotemark is clickable

  2. Meta Assistant

    A classic LaTeX issue!

    You're correct that using \footnotemark and \footnotetext in this setup can lead to problems with footnote numbering and hyperlinking (if you're using hyperref). Here's why:

    1. \footnotemark increments the footnote counter and creates a mark in the text.
    2. \footnotetext sets the footnote text, but it doesn't know which footnote mark it belongs to. By default, it assumes the current value of the footnote counter, which is the latest one.

    To solve this, you need to tell LaTeX which footnote mark each \footnotetext belongs to. You can do this by using the optional argument of \footnotetext: \footnotetext[<number>]{<text>}.

    Here's the corrected code:

    \documentclass{article}
    \usepackage{hyperref} % for hyperlinking footnotes
    
    \begin{document}
    
    \section{My Section}
    
    \begin{table}[h]
      \centering
      \begin{tabular}{|c|c|}
        \hline
        Column 1 & Column 2 \\
        \hline
        Cell 1   & Cell 2\footnotemark[1] \\
        \hline
        Cell 3   & Cell 4\footnotemark[2] \\
        \hline
        Cell 5   & Cell 6\footnotemark[3] \\
        \hline
        Cell 7   & Cell 8\footnotemark[4] \\
        \hline
      \end{tabular}
      \caption{My Table}
    \end{table}
    
    \footnotetext[1]{First footnote text.} % note the optional [1]
    \footnotetext[2]{Second footnote text.}
    \footnotetext[3]{Third footnote text.}
    \footnotetext[4]{Fourth footnote text.}
    
    \end{document}
    

    Explanation:

    • Inside the table, use \footnotemark[<number>] with an explicit number (1, 2, 3, ...). This sets the mark and doesn't increment the footnote counter.
    • After the table, use \footnotetext[<same number>]{<text>} with the same number as the corresponding \footnotemark. This sets the footnote text for that specific mark.

    By doing this, you're explicitly linking each \footnotetext to its corresponding \footnotemark, and LaTeX (with hyperref) will correctly:

    1. Number the footnote marks (1, 2, 3, 4).
    2. Create the footnote texts with the correct numbers.
    3. Make each footnote mark clickable, linking to its respective footnote text.

    Voilà! Your footnotes should now work as expected.

    As a side note, if you have many footnotes, you might want to define a new command to simplify the process:

    \newcommand{\tablefootnote}[2]{%
      \footnotemark[#1]%
      \addtocounter{footnote}{-1}% reset counter (not strictly necessary here)
      \footnotetext[#1]{#2}%
    }
    

    Then, inside the table, use: Cell 2\tablefootnote{1}{First footnote text.}, and remove the \footnotetext commands after the table. This is more concise, but for just 4 footnotes, the original solution is clear enough. Choose your poison!

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.