如何在表格中添加脚注?

如何在表格中添加脚注?

我想为 AAAAAAAAA 添加脚注

\documentclass[review]{elsarticle}
\usepackage{geometry}
\usepackage{epsfig}
\usepackage{latexsym}
\usepackage[font={normalsize}]{caption}
\usepackage[para,flushleft]{threeparttable}
\renewcommand{\TPTtagStyle}{\textit}
\usepackage{booktabs}
%\usepackage{nicematrix}
\usepackage{amsmath}
\usepackage{fullpage}
\usepackage{setspace}
\usepackage{mathtools}
\usepackage{fancyhdr}
\usepackage{sectsty}
\usepackage{siunitx}
\usepackage{tabularx}
\usepackage{float}
\usepackage{indentfirst}
\usepackage{changepage}
\usepackage{adjustbox}
\usepackage{tabularx}
\usepackage{rotating}
\usepackage{makecell}
\usepackage{subcaption}
\usepackage{rotating}
%\usepackage{subfigure}
\linespread{1}
\usepackage[hidelinks]{hyperref}

% packages for tables
\usepackage{multirow}
\usepackage[table,xcdraw]{xcolor}
\usepackage{graphicx}
\usepackage{graphics}
\usepackage{caption}
\usepackage{color,soul}
\usepackage{fullpage} 
\usepackage[skip=1ex, 
            font=small, labelfont=bf]{caption}
% packages for tables
\usepackage[table,xcdraw]{xcolor}
\usepackage{multirow, tabularx}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx, varwidth}
\usepackage{tablefootnote}

\usepackage{enumitem}
\usepackage{lineno,hyperref}
\modulolinenumbers[5]
\begin{document}
\renewcommand{\arraystretch}{2}
\begin{table}[H]
\centering
\caption{Grid search leaderboard}
\begin{tabular}{ccccccc}
\hline
 Test No.& type&SeASDues & $R^2$ & PrAcessing& ML moADls& MeSDFaASFdel \\ \hline
1 & Stacked  & 12 & 0.96 & PCA & PolyFASres, EADR, DTR, GSDFR & LassoLarsCV\\
2 & Stacked &  14 & 0ASD3& ZeroSDnt, MinMaSDFDaler& DT, ETR, RiSFe&XGB\\
3 & Stacked &  17 & 0.96 &  ZeroCASDunt,RobASDScaler&RiSDgeCV&XBG\\
\textbf{4} & \textbf{Stacked} & \textbf{18}& \textbf{0SDF8}& \textbf{MinMADScaler, RobustScaler}& \textbf{GBR, PolyFeADres, LassoLarsCV} & \textbf{RSFgeCV} \\
\textbf{5} &  \textbf{Stacked} & \ASDA& \ASDASD9 & \textbf{TTT} & \textbf{GBR, PSDFADes, SGD, DTR} & \textbf{LassoLarsCV}\\
6 & Stacked &20 & 0SDF5 &-& RF,  AAAAAAAAAA    , PolyFeatSDFres  &LassoLarsCV\\
7 & Stacked & 75 & 0.SD6 & -&F\_regression, XGB & XGB\\
 8& Stacked & 100 & 0.95 &ZeroCount, RobustScaler, MaxAbsScaler & XGB, Ridge & GBR\\
\textbf{9} &  \textbf{ANN} & \textbf{12}&\textbf{0.80} &\textbf{MinMaxScaler} &\textbf{[13,32,32,1]}  &\textbf{-}\\
10 &ANN &16  & 0.53 & MinMaxScaler  & [13,512,128,1]& - \\
 11& ANN & 22 & 0.71 &MinMaxScaler& [13,64,512,1] &-\\
 12& ANN & 100 & 0.77 & MinMaxScaler & [13,128,1024,16,1] &-\\ \hline

\end{tabular}
\end{table}

\end{document}

答案1

太期待评论了...

  • 不幸的是,您的文档示例不起作用。此外,您的编辑仍然使用了一些未定义的命令。
  • 它不包含任何脚注。请将其添加到您想要的位置\footnotemark
  • 你真的需要所有这些包吗?有些包已经被其他包加载了,有些包被加载了两次... 清理你的前言!
  • hyperref应该最后加载。

对于起点,您可以为表格xtabularx使用并定义第四列和第五列作为L类型​​,在序言中定义\newcolumntype{L}{>{\raggedright\arraybackslash}X}

\begin{table}[ht]
\centering
\caption{Grid search leaderboard}
\setlength\tabcolsep{4pt}
\small
\begin{tabularx}{\linewidth}{@{} cccl LL l @{}}
\hline
\makecell{Test\\ No.} & type & \makecell{SeAS\\Dues} & $R^2$ & PrAcessing& ML moADls& \makecell{MeSD-\\ FaASFdel} \\ \hline

通过此更改,您的表格将适合文本块:

在此处输入图片描述

要插入脚注,请先考虑上述内容再次编辑您的问题。然后我们就可以简单地添加所需的脚注。

答案2

由于您的代码加载了该threeparttable包,因此您也可以利用它来生成所需的脚注。请参阅下面的代码,了解如何使用\tnote指令和tablenotes环境的示例。

为了使表格适合文本块的宽度,我建议您使用环境tabularx并使用X第 5 列和第 6 列的类型。

在此处输入图片描述

\documentclass[review]{elsarticle}
\usepackage{geometry}
%%\usepackage{epsfig}
%%\usepackage{latexsym} % latexsym was superseded by amssymb in 1994
\usepackage{amssymb}
%%\usepackage[font=normalsize]{caption}

\usepackage[para,flushleft]{threeparttable}
\renewcommand{\TPTtagStyle}{\textit}

\usepackage{booktabs}
%\usepackage{nicematrix}
\usepackage{amsmath}
\usepackage{fullpage}
\usepackage{setspace}
\usepackage{mathtools}
\usepackage{fancyhdr}
\usepackage{sectsty}
\usepackage{siunitx}
\usepackage{tabularx}
\usepackage{float}
\usepackage{indentfirst}
\usepackage{changepage}
\usepackage{adjustbox}
%%\usepackage{tabularx}
\usepackage{rotating}
\usepackage{makecell}
\usepackage{caption,subcaption}
\captionsetup{skip=1ex, font=small, labelfont=bf} % are you sure about "font=small"?
\usepackage{rotating}
%\usepackage{subfigure}
\linespread{1}
\usepackage[hidelinks]{hyperref}

% packages for tables
\usepackage{multirow}
\usepackage[table,xcdraw]{xcolor}
\usepackage{graphicx}
%%%\usepackage{graphics}
%%%\usepackage{caption}
\usepackage{color,soul}
%%\usepackage{fullpage}

% packages for tables
\usepackage[table,xcdraw]{xcolor}
\usepackage{multirow} %%%, tabularx}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx, varwidth}
%%\usepackage{tablefootnote}

\usepackage{enumitem}
\usepackage{lineno}  %%,hyperref}
\modulolinenumbers[5]

%% new code:
\usepackage{lipsum}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}

\begin{document}
%\renewcommand{\arraystretch}{2} % seems excessive
\begin{table}[ht]
%%\centering % not needed
\begin{threeparttable}
\caption{Grid search leaderboard}
\label{GridASDASDh}
% Allow automatic line breaks in columns 5 and 6:
\begin{tabularx}{\textwidth}{@{} l ccc LL l @{}}
\toprule %\hline
 Test No.& type & SeASDues & $R^2$ & PrAcessing & ML moADls & MeSDFaASFdel \\
\midrule %\hline
1 & Stacked & 12 & 0.96 & PCA & PolyFASres, EADR, DTR, GSDFR & LassoLarsCV\\
\addlinespace
2 & Stacked & 14 & 0ASD3& ZeroSDnt, MinMaSDFDaler& DT, ETR, RiSFe&XGB\\
\addlinespace
3 & Stacked & 17 & 0.96 &  ZeroCASDunt, RobASDScaler & RiSDgeCV & XBG\\
\addlinespace
\textbf{4} & \textbf{Stacked} & \textbf{18} & \textbf{0SDF8} & \textbf{MinMADScaler, RobustScaler}& \textbf{GBR, PolyFeADres, LassoLarsCV} & \textbf{RSFgeCV} \\
\addlinespace
\textbf{5} & \textbf{Stacked} & ASDA & ASDASD9 & \textbf{TTT} & \textbf{GBR, PSDFADes, SGD, DTR} & \textbf{LassoLarsCV}\\
\addlinespace
6 & Stacked & 20 & 0SDF5 & -- & RF, AAAAAAAAAA,\tnote{a} PolyFeatSDFres  &LassoLarsCV\\
\addlinespace
7 & Stacked & 75 & 0.SD6 & -- & F\_regression, XGB & XGB\\
\addlinespace
8 & Stacked & 100& 0.95 & ZeroCount, RobustScaler, MaxAbsScaler & XGB, Ridge & GBR\\
\addlinespace
\textbf{9} & \textbf{ANN} & \textbf{12} & \textbf{0.80}     & \textbf{MinMaxScaler} & \textbf{[13,32,32,1]} & \textbf{--}\\
\addlinespace
10& ANN     & 16 & 0.53 & MinMaxScaler & [13,512,128,1]     & -- \\
\addlinespace
11& ANN     & 22 & 0.71 & MinMaxScaler & [13,64,512,1]      & -- \\
\addlinespace
12& ANN     & 100& 0.77 & MinMaxScaler & [13,128,1024,16,1] & -- \\
\bottomrule %\hline
\end{tabularx}

\smallskip\footnotesize
\begin{tablenotes}
\item[a] Some footnote text.
\end{tablenotes}
\end{threeparttable}

\end{table}

\lipsum[1-5] % filler text

\end{document} 

相关内容