简体   繁体   中英

Latex table too wide

The code below shows my table but its obviously too wide. I am not familiar with packages like tabularx or tabular* so I am really not sure how to adjust the table to make it properly fit on my page. I also wouldn't mind the table to be sideways or in landscape mode, but when I try that the table positioning is way off. Can someone please help me?

\begin{table}

\begin{threeparttable}
  \centering
  \caption[Descriptive Statistics ]{Descriptive Statistics s}
    \sisetup{add-integer-zero=false}

  \begin{tabular}{lcccccccccccccccccccc}
 
   \toprule
  
    & \multicolumn{6}{c}{$\boldsymbol{2004-2011}$} && \multicolumn{6}{c}{$\boldsymbol{2012-2020}$} && \multicolumn{6}{c}{\textbf{Full Sample}}\\
   \cmidrule(r){2-7}\cmidrule(lr){9-14}\cmidrule(l){16-21}      
 \\
     
& \textbf{Mean} & \textbf{Std.Dev.} &\textbf{Median} & \textbf{Min.} & \textbf{Max.} & \textbf{Obs} && \textbf{Mean} & \textbf{Std.Dev.} &\textbf{Median} & \textbf{Min.} & \textbf{Max.} & \textbf{Obs}&& \textbf{Mean} & \textbf{Std.Dev.} &\textbf{Median} & \textbf{Min.} & \textbf{Max.} & \textbf{Obs} \\
       \midrule
       \textbf{FSTS}  & 0.39& 0.24& 0.38& -0.37&1.0& 3,039&& 0.42&0.24&0.40&-0.06&1.0&4,566& &0.40 & 0.24& 0.39& -0.37& 1.0&7,605 \\\addlinespace
       \textbf{FATA} &0.33 &0.25 &0.30 &-2.15 &0.99  & 3,039&& 0.35&0.26&0.31&-1.53&1.0&4,566 && 0.34&0.25 &0.31 &-2.15 & 1.0&7,605 \\\addlinespace
       \textbf{OSTS} &0.33 &0.34 &0.20 &0.0 &1.0 &3,039& &0.45 &0.34 & 0.55& 0.0&1.0 & 4,566&& 0.40&0.34 &0.46 &0.0 & 1.0&7,605 \\\addlinespace
       \textbf{PDIO} &3.63 &3.19 &  2.0&1.0 &10.0& 3,039&& 4.79& 3.38& 4.0& 1.0& 10& 4,566&& 4.32 & 3.35& 3.0& 1.0& 10.0& 7,605 \\\addlinespace
       \textbf{DOI} & 0.51&0.21& 0.43& 0.0& 0.99& 3,039& &0.59& 0.21& 0.62& 0.26& 1.0& 4,566&& 0.56& 0.21& 0.57& 0.0& 1.0& 7,605 \\
       
       \bottomrule
       \end{tabular}
            \begin{tablenotes}
            \item \footnotesize\textit{Note.} $N=330$ in $t_1$; $N=328$ in $t_2$; $N=298$ in $t_3$. $\alpha$ represents Cronbach's Alpha. Prompt pursuit is presented as a global scale.
            \end{tablenotes}
  \label{tab:scales}%
\end{threeparttable}  

\end{table}

You can rotate the table by using sidewaystable environment with use package rotating . I have break the word Std.Dev. by my macro \spheadcenter

\newcommand{\spheadcenter}[2][0]{%
  {{\begin{turn}{#1}\let\toprule\relax\begin{tabular}[t]{c} #2 \end{tabular}\end{turn}}}}

Adjusting the column space by \tabcolsep3pt . @{} is to remove the extra space left and right of the table. See my below coding

\begin{sidewaystable}[!p]

\begin{threeparttable}
  \centering
  \caption[Descriptive Statistics ]{Descriptive Statistics s}
    \sisetup{add-integer-zero=false}

  {\tabcolsep3pt\begin{tabular}{@{}lcccccccccccccccccccc@{}}
   \toprule
    & \multicolumn{6}{c}{$\boldsymbol{2004-2011}$} && \multicolumn{6}{c}{$\boldsymbol{2012-2020}$} && \multicolumn{6}{c}{\textbf{Full Sample}}\\
   \cmidrule(r){2-7}\cmidrule(lr){9-14}\cmidrule(l){16-21}
 \\
& \textbf{Mean} & \textbf{\spheadcenter{Std.\\Dev.}} &\textbf{Median} & \textbf{Min.} & \textbf{Max.} & \textbf{Obs} && \textbf{Mean} & \textbf{\spheadcenter{Std.\\Dev.}} &\textbf{Median} & \textbf{Min.} & \textbf{Max.} & \textbf{Obs}&& \textbf{Mean} & \textbf{\spheadcenter{Std.\\Dev.}} &\textbf{Median} & \textbf{Min.} & \textbf{Max.} & \textbf{Obs} \\
       \midrule
       \textbf{FSTS}  & 0.39& 0.24& 0.38& -0.37&1.0& 3,039&& 0.42&0.24&0.40&-0.06&1.0&4,566& &0.40 & 0.24& 0.39& -0.37& 1.0&7,605 \\\addlinespace
       \textbf{FATA} &0.33 &0.25 &0.30 &-2.15 &0.99  & 3,039&& 0.35&0.26&0.31&-1.53&1.0&4,566 && 0.34&0.25 &0.31 &-2.15 & 1.0&7,605 \\\addlinespace
       \textbf{OSTS} &0.33 &0.34 &0.20 &0.0 &1.0 &3,039& &0.45 &0.34 & 0.55& 0.0&1.0 & 4,566&& 0.40&0.34 &0.46 &0.0 & 1.0&7,605 \\\addlinespace
       \textbf{PDIO} &3.63 &3.19 &  2.0&1.0 &10.0& 3,039&& 4.79& 3.38& 4.0& 1.0& 10& 4,566&& 4.32 & 3.35& 3.0& 1.0& 10.0& 7,605 \\\addlinespace
       \textbf{DOI} & 0.51&0.21& 0.43& 0.0& 0.99& 3,039& &0.59& 0.21& 0.62& 0.26& 1.0& 4,566&& 0.56& 0.21& 0.57& 0.0& 1.0& 7,605 \\

       \bottomrule
       \end{tabular}}
            \begin{tablenotes}
            \item \footnotesize\textit{Note.} $N=330$ in $t_1$; $N=328$ in $t_2$; $N=298$ in $t_3$. $\alpha$ represents Cronbach's Alpha. Prompt pursuit is presented as a global scale.
            \end{tablenotes}
  \label{tab:scales}%
\end{threeparttable}

\end{sidewaystable}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM