我的表格内部footnote
似乎受限于第一个表格部分的宽度,我正在寻找一种方法来扩展它以占据整个表格的宽度。
我的文档采用样式格式two-column
,我已使用环境table*
将表格扩展到整个页面宽度。在此结构中,我将两个表格部分并排排列以形成两个不同的表格。此外,我还使用该threeparttable
包来添加表格注释。
提供的代码生成下图中的输出。我想增强脚注以涵盖所有以红色突出显示的空白区域。
\documentclass[twocolumn]{article}
\usepackage{graphicx} % Required for inserting images
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{threeparttable}
\usepackage{makecell}
\usepackage{colortbl}
\usepackage{amsmath}
\usepackage{lipsum} % For dummy text; you can remove this in your actual document
\usepackage{geometry} %margins of the document
\geometry{
a4paper,
total={170mm,257mm},
left=20mm,
top=20mm,
}
\usepackage{showframe} % to show page margins
\title{two_colums_two_columns}
\author{alexyshr }
\date{January 2024}
\begin{document}
\definecolor{light-gray}{gray}{0.95}
\section{Introduction}
\lipsum[1-2]
\addtolength{\tabcolsep}{-5pt} %reduce default column separation
\begin{table*}[hbt!] %table* will expand the table to all the space available
\caption{SOF Metrics. All providers. Florida Power Grid - PG}
\centering
\fontsize{7}{9}\selectfont
\begin{threeparttable}
\begin{tabular}[t]{>{}clcccccc}
\toprule
& \textbf{County} & \textbf{\makecell[c]{SOF\\MERS$^\dagger$}} & \textbf{\makecell[c]{SOF\\MERA$^\ast$}} & \textbf{$\beta_0^\ddagger$} & \textbf{$\beta_1^\S$} & \textbf{$\#^\P$} & \vphantom{1} \textbf{\makecell[c]{Risk\\Ratio}}\\
\midrule
\em{1} & OSCEOLA & 46.0 & 0.511 & -7.176 & 0.156 & 10 & 0.720\\
\em{2} & HILLSBOROUGH & 45.0 & 0.500 & -7.003 & 0.156 & 10 & 0.736\\
\em{3} & SUMTER & 44.7 & 0.497 & -8.823 & 0.197 & 10 & 0.740\\
\em{4} & PALM BEACH & 43.9 & 0.488 & -10.656 & 0.243 & 10 & 0.754\\
\em{5} & MIAMI-DADE & 43.6 & 0.484 & -9.377 & 0.215 & 10 & 0.760\\
\bottomrule
\end{tabular}
\begin{tablenotes}[para]
\item[$\ast$] \text{$\equiv$ SOF-MERS: Multi-Event median Robustness wind Speed; }
\item[$\dagger$] \text{$\equiv$ SOF-MERA: Multi-Event Robustness Area.}
\item[$\ddagger$] \text{$\equiv$ Intercept; }
\item[$\S$] \text{$\equiv$ Slope; }
\item[$\P$] \text{$\equiv$ Number of Hurricane Events.}
\end{tablenotes}
\end{threeparttable}
\centering
\begin{tabular}[t]{clcccccc}
\toprule
\em{ } & \textbf{County} & \textbf{\makecell[c]{SOF\\MERS$^\dagger$}} & \textbf{\makecell[c]{SOF\\MERA$^\ast$}} & \textbf{$\beta_0^\ddagger$} & \textbf{$\beta_1^\S$} & \textbf{$\#^\P$} & \textbf{\makecell[c]{Risk\\Ratio}}\\
\midrule
\em{35} & HAMILTON & 32.3 & 0.359 & -7.244 & 0.224 & 10 & 1.024\\
\em{36} & DIXIE & 32.2 & 0.358 & -10.633 & 0.330 & 10 & 1.027\\
\em{37} & PUTNAM & 32.2 & 0.357 & -9.266 & 0.288 & 10 & 1.030\\
\em{38} & FLAGLER & 32.0 & 0.356 & -9.695 & 0.303 & 10 & 1.033\\
\em{\cellcolor{light-gray}{\textbf{$>>$}}} & \cellcolor{light-gray}{\textbf{ALL}} & \cellcolor{light-gray}{\textbf{33.1}} & \cellcolor{light-gray}{\textbf{0.368}} & \cellcolor{light-gray}{\textbf{-7.776}} & \cellcolor{light-gray}{\textbf{0.235}} & \cellcolor{light-gray}{\textbf{683}} & \cellcolor{light-gray}{\textbf{1.000}}\\
\bottomrule
\end{tabular}
\end{table*}
\lipsum[3-15]
%return to normal column separation
\addtolength{\tabcolsep}{1pt}
\end{document}
答案1
我建议您将两个较小的tabular
环境都包裹在“外部”两列tabular
环境中,并让“外部”表格环境跨越文本块的整个宽度。然后,确保threeparttable
环境包裹这个“外部”表格环境。
我还将加载siunitx
包并将其S
列类型用于$\beta_0$
两个内部tabular
环境中的列,以对齐小数标记上的数字并获得正确的数学减号。
顺便说一句,没有必要粗体标题行中的单元格。
\documentclass[twocolumn]{article}
\usepackage{graphicx} % Required for inserting images
\usepackage{booktabs}
\usepackage[para]{threeparttable}
\usepackage{makecell}
\usepackage{colortbl,xcolor}
\definecolor{light-gray}{gray}{0.9}
\usepackage{amsmath}
\usepackage{lipsum} % For dummy text; you can remove this in your actual document
\usepackage{geometry} %margins of the document
\geometry{a4paper, total={170mm,257mm}, margin=20mm}
\usepackage{siunitx} % for 'S' column type
%\usepackage{showframe} % to show page margins
\begin{document}
\section{Introduction}
\lipsum[1-2]
\begin{table*}
\setlength{\tabcolsep}{3pt} % default: 6pt
\footnotesize
\caption{SOF Metrics. All providers. Florida Power Grid -- PG}
\smallskip
\begin{threeparttable}
% "outer" table
\begin{tabular}{@{}cc@{}}
% first "inner" table
\begin{tabular}{@{} >{\em}l l cc S[table-format=-1.3] ccc @{}}
\toprule
& County
& \makecell{SOF\\MERS\tnote{\textdagger}}
& \makecell{SOF\\MERA\tnote{\textasteriskcentered}}
& {$\beta_0$\tnote{$\ddagger$}}
& $\beta_1$\tnote{\S}
& \#\tnote{\P}
& \makecell{Risk\\Ratio}\\
\midrule
1 & OSCEOLA & 46.0 & 0.511 & -7.176 & 0.156 & 10 & 0.720\\
2 & HILLSBOROUGH & 45.0 & 0.500 & -7.003 & 0.156 & 10 & 0.736\\
3 & SUMTER & 44.7 & 0.497 & -8.823 & 0.197 & 10 & 0.740\\
4 & PALM BEACH. & 43.9 & 0.488 & -10.656 & 0.243 & 10 & 0.754\\
5 & MIAMI-DADE & 43.6 & 0.484 & -9.377 & 0.215 & 10 & 0.760\\
\bottomrule
\end{tabular} % end of first "inner" table
\hspace{5pt}
% second "inner" table
\begin{tabular}{@{\hspace{2pt}} >{\em}l l cc S[table-format=-1.3] ccc @{\hspace{2pt}}}
\toprule
& County
& \makecell{SOF\\MERS\tnote{\textdagger}}
& \makecell{SOF\\MERA\tnote{\textasteriskcentered}}
& {$\beta_0$\tnote{$\ddagger$}}
& $\beta_1$\tnote{\S}
& \#\tnote{\P}
& \makecell{Risk\\Ratio}\\
\midrule
35 & HAMILTON & 32.3 & 0.359 & -7.244 & 0.224 & 10 & 1.024\\
36 & DIXIE & 32.2 & 0.358 & -10.633 & 0.330 & 10 & 1.027\\
37 & PUTNAM & 32.2 & 0.357 & -9.266 & 0.288 & 10 & 1.030\\
38 & FLAGLER & 32.0 & 0.356 & -9.695 & 0.303 & 10 & 1.033\\
\rowcolor{light-gray}
& ALL & 33.1 & 0.368 & -7.776 & 0.235 & 683 & 1.000\\
\bottomrule
\end{tabular}\null
\end{tabular} % end of "outer" tabular
\smallskip
\begin{tablenotes}
\item[\textdagger] SOF-MERS: Multi-Event median Robustness wind Speed;
\item[\textasteriskcentered] SOF-MERA: Multi-Event Robustness Area;
\item[$\ddagger$] Intercept;
\item[\S] Slope;
\item[\P] Number of Hurricane Events.
\end{tablenotes}
\end{threeparttable}
\end{table*}
\lipsum[3-15]
\end{document}