0

The table is long and not centred and the footnote isn't placec at the end of the table.

\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}

Ingmar
  • 6,690
  • 5
  • 26
  • 47
Annie
  • 93
  • The minipage with the notes is outside the table, therefore the (oversized) table is explicitly allowed to float behind it. For table notes → threeparttable – cabohah Aug 05 '23 at 14:04
  • You table is wider than the width of the text area. So it overlaps into the margin. Either make the text area wider, reduce the width of the table or explicitly allow the table to use parts of the right an the left margin. – cabohah Aug 05 '23 at 14:08
  • How can I reduce the width of the table then? – Annie Aug 05 '23 at 14:14
  • Reducing the width is a question of design. You have to find out and decide, which columns can be made smaller without changing the semantic and with keeping them readable. You have to decide, e.g., if the table can be spitted. This is nothing we can do for you. But I've show one example of what could be done in my answer. – cabohah Aug 05 '23 at 14:27

1 Answers1

0

For long tables you should use longtable, to allow them to break across pages.

To avoid, that the “Baseline …” headings increase the column width, you can use, e.g., \multicolumn, to place them centered across all columns.

I would also recommend to use booktabs for more space above/below the rules.

\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}

Other changes like using siunitx could also make sense. But I've tried to reduce the changes to a minimum. However, I would also recommend to think about splitting the long table into several smaller (sub-)tables. Maybe even using package subcaption would make sense. But I cannot decide this.

cabohah
  • 11,455
  • Oh thank you for this wonderful solution! – Annie Aug 05 '23 at 14:28
  • Actually, longtable supports normal footnotes, although it may have a problem if the footnotes extend beyond the end of the longtable (see https://tex.stackexchange.com/questions/359903/i-have-table-with-long-notes-in-the-longtable-and-threeparttable-environment-h). – John Kormylo Aug 05 '23 at 15:38