\footnotetext 和 \footnotemark 在表格环境中不起作用

\footnotetext 和 \footnotemark 在表格环境中不起作用

我在表格中使用时遇到了一些问题\footnote。我的代码如下,其中我使用了包\usepackage{footnote}\usepackage{tabularx}。但脚注的文本没有显示在表格下方,只有上标“1”和“2”出现在相关项目旁边。我需要上标显示为“a”、“b”、“c”……

\documentclass[12pt,a4paper,twoside]{report}
\usepackage[latin1]{inputenc}
\usepackage{multirow}
\usepackage{geometry}\geometry{top=3cm,bottom=3cm,left=3.7cm,right=2.5cm}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\setlength{\headheight}{15pt}

\setcounter{secnumdepth}{4}

\usepackage{titlesec}
\titleformat{\chapter}[display]{\normalfont\Huge\bfseries}{\chaptertitlename 
\ \thechapter}{15pt}{\Huge}
\titlespacing*{\chapter}{0pt}{-3\baselineskip}{20pt}[3.7cm]

\renewcommand{\figurename}{Figure}
\renewcommand{\bibname}{References}
\hyphenpenalty=10000
\tolerance=2500
\usepackage{longtable}
\raggedbottom

\usepackage{cite}
\usepackage{hyperref}

\usepackage{nomentbl}
\usepackage[toc,page]{appendix}
\usepackage{enumitem,calc}

\usepackage{booktabs}
\usepackage{bigstrut}
\usepackage{rotating}
\usepackage{multirow}

\usepackage{footnote}
\usepackage{tabularx}

\usepackage{lscape}
\usepackage{setspace}\linespread{1.6}
\setlength\parskip{3pt plus 1.5pt minus 1.5pt}%paragraph

\begin{document}
Some text here, as listed in Table~\ref{tab}.

\begin{table*}
  \centering
  \caption{Caption of the table}\label{tab}
  \begin{tabularx}{\textwidth}{lccc}
  \toprule
       x11            &x12 \footnotemark[1]   &x13 \footnotemark[2]    &x14 \footnotemark[2] \\
       \midrule
       x21            &x22                    &x23                     &x24                  \\
       x31            &x32 \footnotemark[1]   &x33 \footnotemark[1]    &x34                  \\
       \bottomrule
  \end{tabularx}
  \footnotetext[1]{This is the 1st footnote}%
  \footnotetext[2]{This is the 2nd footnote}%
\end{table*}

\end{document}

更新:我根据@Skillmon的评论修改了代码。

答案1

在此处输入图片描述

此外,threeparttable您还可以使用我在上面的评论中提到的“经典”方法:

\documentclass[12pt,a4paper,twoside]{report}
\usepackage[latin1]{inputenc}
\usepackage{multirow}
\usepackage{geometry}\geometry{top=3cm,bottom=3cm,left=3.7cm,right=2.5cm}
\usepackage{booktabs}
\usepackage{footnote}
\usepackage{tabularx}

\begin{document}
Some text here, as listed in Table~\ref{tab}.

\begin{table*}[ht]
    \begin{minipage}{\linewidth}
        \renewcommand\footnoterule{}
        \renewcommand{\thefootnote}{\alph{footnote}}
  \caption{Caption of the table}\label{tab}
  \begin{tabularx}{\textwidth}{Xccc}
  \toprule
       x11            &x12 \footnotemark[1]   &x13 \footnotemark[2]    &x14 \footnotemark[2] \\
       \midrule
       x21            &x22                    &x23                     &x24                  \\
       x31            &x32 \footnotemark[1]   &x33 \footnotemark[1]    &x34                  \\
       \bottomrule
  \end{tabularx}
      \vspace{-1.5ex}% <-- added
  \footnotetext[1]{This is the 1st footnote}%
  \footnotetext[2]{This is the 2nd footnote}%
    \end{minipage}
\end{table*}

\end{document}

注意:如果您使用tabularx环境作为表,则至少有一列必须是X类型。

答案2

浮动环境 ( table, figure) 不支持脚注。有几种解决方法,例如将 包装tabular在 中minipage。包 提供了另一种选择threeparttable

\documentclass[12pt,a4paper,twoside]{report}
\usepackage{booktabs}
\usepackage{threeparttable}

\begin{document}
\begin{table*}
  \centering
  \begin{threeparttable}[b]
    \caption{Caption of the table}\label{tab}
    \begin{tabular}{lccc}
      \toprule
      header11 &x12\tnote{a} &x13\tnote{b} &x14\tnote{b} \\
      \midrule
      dummy21 &x22          &x23          &x24 \\
      hello31 &x32\tnote{a} &x33\tnote{a} &x34 \\
      \bottomrule
    \end{tabular}
    \begin{tablenotes}
      \footnotesize
      \item[a] This is the 1st footnote.
      \item[b] This is the 2nd footnote.
    \end{tablenotes}
  \end{threeparttable}
\end{table*}
\end{document}

结果

相关内容