表格未居中,脚注未放置在表格末尾

表格未居中,脚注未放置在表格末尾

表格很长且不居中,并且脚注未放置在表格末尾。

\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage{graphicx} % Required for inserting images
\usepackage{setspace}% for\doublespacing

\usepackage{indentfirst}% for indent the first line
\usepackage{longtable}
\usepackage{textalpha}

\usepackage{ragged2e}
 \usepackage[T1]{fontenc} % <-- new
\usepackage{xltabular} 
\usepackage{amsmath}
\usepackage{caption}
\DeclareUnicodeCharacter{2212}{-}%new

\begin{document}


 \section{Baseline behavioral measurements}

 
\begin{table}[ht]
\centering
\caption{Baseline behavioral measurements}
\begin{tabular}[t]{llllllll}
\hline

 &  &  &    &   Baseline Locomotion (cm)  &  & &\\
ST & df & F - value & pη2 &P - value& & M \textpm StD& N\\


\hline
 

SD & 1 & 0.027 &0.000 & 0.870& control & 1100 ± 237 &24 \\
 
   &      &      &     &     &  SD     & 1108 ± 193  & 54  \\
PhA &   1&  8.291**& 0.101& 0.005&  PhA- &  1163 ± 188 &39\\

 &      &      &     &     & PhA+ & 1047 ± 209&     39\\
 
SD \texttimes PhA&  1&  1.713&  0.023&  0.195   & & & \\        
Error & 74& &    &   &   &   &      \\


\hline
LT & df & F - value & pη2 &P - value& & M \textpm StD & N\\
\hline
SD & 1& 1.109&  0.015&  0.296&  Control &1405 ± 225& 23\\
  &  &       &         &     &  SD &    1461 ± 223& 54\\
PhA &   1&  25.147**&   0.256&  0.000&  PhA- &  1564 ± 189 &    38\\
   &     &        &       &           &PhA+ &   1327 ± 194 &    39\\
SD \texttimes PhA & 1&  0.071&  0.001&  0.790   &  &   &\\      
 Error&     73  &    &    &    &   &  &  \\                 
  \hline
&     &     &    &  Baseline SIR    &       &     &        \\
ST & df & F - value & pη2 &P - value& & M \textpm StD& N\\
\hline
SD &    1&  0.194   &0.003& 0.661   &Control &  117.16 ± 38.1 & 24\\
   &   &          &     &          &  SD &  122.07 ± 58.5&  51\\
PhA &   1&  2.280&  0.031&  0.136&  PhA- &  131.74 ± 52.99&     36\\
    &   &       &      &    &   PhA+ &  110.12 ± 50.07&     39\\
SD\texttimes PhA&   1&  669.481&    0.003&  0.621   &  &  & \\  
Error &     71&    &    &    &   &   &   \\
\hline
LT&     df &    F - value & pη2     &p - value  & & M ± StD &   N\\
\hline
SD&     1&  0.301&  0.005&  0.585&  Control&    136.81 ± 41.13&  23\\
 &       &     &        &      &    SD &    131.59 ± 40.44&     45\\
 PhA &  1&  1.896&  0.029&  0.173&  PhA- &  140.12 ± 45.8   & 34\\
    &   &       &     &    &    PhA+&   126.58 ± 33.6&  34\\
SD\texttimes PhA &  1&  0.038&  0.001&  0.846   &   &  & \\ 
Error&  64  &   &  &  &  &  &   \\
\hline
 &     &     &    &  Baseline Sociability score   &       &     &        \\   
 ST & df & F - value & pη2 &P - value& & M \textpm StD& N\\
\hline
SD &    1&  0.643   &0.009& 0.425&  Control     &0.36 ± 0.09 &  24\\
   &    &           &   &       & SD &  0.38 ± 0.08 &   54\\
PhA &   1&  0.981&  0.013   &0.325& PhA- &  0.38 ± 0.07 &   39\\
   &   &        &      &            &PhA+ & 0.36 ± 0.09 &   39\\
SD\texttimes PhA &  1&  0   &0  &0.882  &  &   &    \\      
Error&  74&    &    &    &    &    &   \\
\hline
LT&     df &    F - value & pη2     &p - value  & & M ± StD &   N\\
\hline
 SD &   1&  0   &0& 0.984&  Control &   0.35 ± 0.07 &   23\\
     &    &     &   &    &  SD &    0.35 ± 0.06 &   53\\
PhA &   1&  7.119**&    0.09&   0.009&  PhA- &  0.34 ± 0.06 &   37\\
    &    &      &       &     & PhA+&   0.37 ± 0.06 &   39\\
 SD\texttimes PhA & 1&  1.682&  0.023   &0.199  &   &   &        \\
Error&  72&   & & & & & \\
   \hline
 LT&    df &    F - value & pη2     &p - value  & & M ± StD &   N\\  
\hline



\label{table:7}
\end{tabular}
\end{table}%



     % This is footnote
\begin{minipage}{10cm}

\small Note:
\textit{p} < .05 = *, \textit{p} < .01 = **
\end{minipage}



\end{document}

答案1

对于长表格,您应该使用longtable,以允许它们跨页。

为了避免“基线...”标题增加列宽,您可以使用例如\multicolumn将它们放置在所有列的中央。

我还建议使用booktabs规则之上/之下的更多空间。

\documentclass{report}
\usepackage[utf8]{inputenc}% should not be needed
\usepackage{graphicx} % Not used in the example!
\usepackage{setspace}% Not used in the example!

\usepackage{indentfirst}% for indent the first line
\usepackage{longtable}
\usepackage{textalpha}

\usepackage{ragged2e}% Not used in the example!
 \usepackage[T1]{fontenc} % <-- new
\usepackage{xltabular}% Not used in the example!
\usepackage{amsmath}
\usepackage{caption}
\DeclareUnicodeCharacter{2212}{-}%new
\usepackage{booktabs}

\begin{document}


\section{Baseline behavioral measurements}

 
\begin{longtable}{llllllll}
  \caption{Baseline behavioral measurements}\label{table:7}\\
  \endfirsthead
  \caption[]{Baseline behavioral measurements \emph{(continued)}}\\
  \endhead
  \toprule
  \multicolumn{8}{c}{Baseline Locomotion (cm)}\\
  ST & df & F - value & pη2 &P - value& & M \textpm StD& N\\
  \midrule
  SD & 1 & 0.027 &0.000 & 0.870& control & 1100 ± 237 &24 \\
     &      &      &     &     &  SD     & 1108 ± 193  & 54  \\
  PhA &   1&  8.291**& 0.101& 0.005&  PhA- &  1163 ± 188 &39\\
      &      &      &     &     & PhA+ & 1047 ± 209&     39\\
  SD \texttimes PhA&  1&  1.713&  0.023&  0.195   & & & \\*        
  Error & 74& &    &   &   &   &      \\
  \midrule
  LT & df & F - value & pη2 &P - value& & M \textpm StD & N\\
  \midrule
  SD & 1& 1.109&  0.015&  0.296&  Control &1405 ± 225& 23\\
     &  &       &         &     &  SD &    1461 ± 223& 54\\
  PhA &   1&  25.147**&   0.256&  0.000&  PhA- &  1564 ± 189 &    38\\
      &     &        &       &           &PhA+ &   1327 ± 194 &    39\\
  SD \texttimes PhA & 1&  0.071&  0.001&  0.790   &  &   &\\*
  Error&     73  &    &    &    &   &  &  \\                 
  \midrule
  \multicolumn{8}{c}{Baseline SIR}\\*
  ST & df & F - value & pη2 &P - value& & M \textpm StD& N\\*
  \midrule
  SD &    1&  0.194   &0.003& 0.661   &Control &  117.16 ± 38.1 & 24\\
     &   &          &     &          &  SD &  122.07 ± 58.5&  51\\
  PhA &   1&  2.280&  0.031&  0.136&  PhA- &  131.74 ± 52.99&     36\\
      &   &       &      &    &   PhA+ &  110.12 ± 50.07&     39\\
  SD\texttimes PhA&   1&  669.481&    0.003&  0.621   &  &  & \\*
  Error &     71&    &    &    &   &   &   \\
  \midrule
  LT&     df &    F - value & pη2     &p - value  & & M ± StD &   N\\
  \midrule
  SD&     1&  0.301&  0.005&  0.585&  Control&    136.81 ± 41.13&  23\\
    &       &     &        &      &    SD &    131.59 ± 40.44&     45\\
  PhA &  1&  1.896&  0.029&  0.173&  PhA- &  140.12 ± 45.8   & 34\\
    &   &       &     &    &    PhA+&   126.58 ± 33.6&  34\\
  SD\texttimes PhA &  1&  0.038&  0.001&  0.846   &   &  & \\ 
  Error&  64  &   &  &  &  &  &   \\
  \midrule
  \multicolumn{8}{c}{Baseline Sociability score}\\*
   ST & df & F - value & pη2 &P - value& & M \textpm StD& N\\*
  \midrule
  SD &    1&  0.643   &0.009& 0.425&  Control     &0.36 ± 0.09 &  24\\
     &    &           &   &       & SD &  0.38 ± 0.08 &   54\\
  PhA &   1&  0.981&  0.013   &0.325& PhA- &  0.38 ± 0.07 &   39\\
     &   &        &      &            &PhA+ & 0.36 ± 0.09 &   39\\
  SD\texttimes PhA &  1&  0   &0  &0.882  &  &   &    \\*
  Error&  74&    &    &    &    &    &   \\
  \midrule
  LT&     df &    F - value & pη2     &p - value  & & M ± StD &   N\\
  \midrule
   SD &   1&  0   &0& 0.984&  Control &   0.35 ± 0.07 &   23\\
     &    &     &   &    &  SD &    0.35 ± 0.06 &   53\\
  PhA &   1&  7.119**&    0.09&   0.009&  PhA- &  0.34 ± 0.06 &   37\\
    &    &      &       &     & PhA+&   0.37 ± 0.06 &   39\\
  SD\texttimes PhA & 1&  1.682&  0.023   &0.199  &   &   &        \\*
  Error&  72&   & & & & & \\
    \midrule
   LT&    df &    F - value & pη2     &p - value  & & M ± StD &   N\\  
  \bottomrule
\end{longtable}



     % This is footnote
\begin{minipage}{10cm}

\small Note:
\textit{p} < .05 = *, \textit{p} < .01 = **
\end{minipage}



\end{document}

其他更改(例如使用)siunitx也可能有意义。但我已尝试将更改减少到最低限度。不过,我还建议考虑将长表拆分为几个较小的(子)表。甚至使用包也subcaption可能有意义。但我无法决定这一点。

相关内容