如何让表格适合一个页面

如何让表格适合一个页面

我是 Latex 的新手,看到很多其他关于此问题的问题,但我找不到将 5 列表格放入一页的方法。

\begin{table}[h]
\centering
\begin{tabularx}{\textwidth}{|c|c|c|c|c|}
    \hline
    Area of Interest & Pearson Correlation and p-value & Spearman correlation and p-value & Mean squared error (MSE) & $R^2$ Value\\
    \hline
    Buoy 44097 and satellite $H_s$ (0.25 dd) & (0.9872, 0.05$<$)  & (0.9663, 0.05$<$) & 0.1268 & 0.9683\\
    \hline
    Buoy 44097 and satellite $H_s$ (0.25- 0.5 dd) & (0.9795, 0.05$<$)  & (0.9641, 0.05$<$) & 0.1605 & 0.9586\\
    \hline
\end{tabularx}
\caption{Correlation, $R^2$ Value, and MSE values between buoy 44097 and Saral/AltiKa Hs measurements.}
\end{table}

我懂了: 在此处输入图片描述

答案1

这是一个简单的错误修复,没有使用 X 列tabularx(顺便说一句,\centering如果宽度为 则没有意义),以及使用和\textwidth的替代格式,同时还进行了一些其他设计更改:tabularybooktabs

姆韦

\documentclass{article}
\usepackage{booktabs,tabularx,tabulary}
\begin{document}

\begin{table}[h]
\begin{tabularx}{\textwidth}{|p{7em}|X|X|X|X|}
  \hline
    Area of Interest & Pearson Correlation and p-value & Spearman correlation and p-value & Mean squared error (MSE) & $R^2$ Value\\
    \hline
    Buoy 44097 and satellite $H_s$ (0.25 dd) & (0.9872, 0.05$<$)  & (0.9663, 0.05$<$) & 0.1268 & 0.9683\\
    \hline
    Buoy 44097 and satellite $H_s$ (0.25- 0.5 dd) & (0.9795, 0.05$<$)  & (0.9641, 0.05$<$) & 0.1605 & 0.9586\\
    \hline
\end{tabularx}

\caption{Correlation, $R^2$ Value, and MSE values between buoy 44097 and Saral/AltiKa Hs measurements.}
\end{table}


\begin{table}[h]
\tymin0pt\tymax145pt\sffamily\small
\caption{Correlations, $R^2$ Value, and Mean Square Error (MSE) values 
between buoy 44097 and Saral/AltiKa Hs measurements.}
\begin{tabulary}{\textwidth}{LCCCC}\toprule 
Area of Interest & \mbox{Pearson's $r$} (p-value) & \mbox{Spearman's $\rho$} (p-value) & MSE & $R^2$ \\\midrule
Buoy 44097 and satellite $H_s$ (0.25 dd) & 0.9872 ($<$0.05)  & 0.9663 ($<$0.05) & 0.1268 & 0.9683\\\addlinespace
Buoy 44097 and satellite $H_s$ (0.25--0.5 dd) & 0.9795 ($<$0.05) & 0.9641 ($<$0.05) & 0.1605 & 0.9586\\\bottomrule
\end{tabulary}
\end{table}

\end{document}

相关内容