latex 中无法识别 tophline/multirow

latex 中无法识别 tophline/multirow

我不知道为什么这不起作用

\begin{table*}
    \caption{Pearson correlation between daily data.}
    \label{tab:corr}
    \begin{tabular}{l l c c}
        \tophline
        \multirow{2}{0.23cm}{S.N.} & &\multicolumn{2}{c}{Pearson correlation coefficient(r)} \\
        \cline{3-4} & MODIS SDS & normal & dry \\
        %\hhline{~--}
        \middlehline
        1 &\texttt{A}        & 0.68 & 0.85 \\  
        2 &\texttt{B}        & 0.68 & 0.85 \\
        3 &\texttt{C}        & 0.57 & 0.76 \\
        4 &\texttt{D}        & 0.75 & 0.87 \\
        \bottomhline
    \end{tabular}
\end{table*}

任何帮助都将不胜感激!

答案1

我怀疑你正在寻找这样的东西:

在此处输入图片描述

对于我在下面的 MWE 中所做的代码更改,请与我的任何表格中的代码进行比较(差异以 表示% <---):

\documentclass{article}         % <---
\usepackage{array, booktabs, multirow} % <---

\begin{document}
    \begin{table}
\caption{Pearson correlation between daily data.}
\label{tab:corr}
\centering                      % <---
\begin{tabular}{l c *{2}{>{\centering\arraybackslash}p{7em}}}  % <---
    \toprule                    % <---
\multirow{2.2}*{S.N.}           % <---
    & \multirow{2.2}{4em}{\centering  MODIS\\ SDS}  % <---
                & \multicolumn{2}{c}{Pearson correlation coefficient (r)} \\
    \cmidrule{3-4}              % <---
    &           & normal    & dry   \\
    \midrule
1   &\texttt{A} & 0.68      & 0.85 \\
2   &\texttt{B} & 0.68      & 0.85 \\
3   &\texttt{C} & 0.57      & 0.76 \\
4   &\texttt{D} & 0.75      & 0.87 \\
    \bottomrule                 % <---
\end{tabular}
    \end{table}
\end{document}

相关内容