1

how can I center my wide table? I already tried everything I could find in different posts. I would be grateful for every tip! My code is attached.

Thanks,

Julia

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{dcolumn,tabularx,ragged2e, caption}
\usepackage{siunitx}
\usepackage{threeparttable}
\renewcommand{\rmdefault}{phv} 
\renewcommand{\sfdefault}{phv}

\captionsetup{singlelinecheck = false, justification=justified}
\begin{document}

\begin{table}[htbp]
  \centering
  \begin{threeparttable}
  \caption{Descriptives Table}
    \begin{tabular}{lll}
      \textbf{}&\textbf{Mean(SE) or Proportion in \%\tnote{1}}& \textbf{Range} \\
      \toprule
\textbf{Distress} & xxxxx  (0.044) & {0-12} \\
\textbf{Life satisfaction} & xxxxx (0.035) &{0-12} \\
\textbf{Female} & xxxxx\%  &  \\
\textbf{Age} & xxxxx (0.156) & {18-83} \\
\textbf{Overall health} & xxxxx (0.017) & 30-4 \\
\textbf{Low edu. level} & xxxxx\%  &  \\
\textbf{Medium edu. level} & xxxxx\%    &  \\
\textbf{High edu. level} & xxxxx\%    &  \\
\textbf{Resilience} & xxxxx (0.058) & 3-24 \\
\textbf{Self-esteem} & xxxxx (0.018) & 30-6 \\
\textbf{Time in Germany} & xxxxx (0.02) & {1 mo - 32 yrs} \\
\textbf{Status refugee or asylee} & xxxxx\%  &  \\
\textbf{Status protected} & xxxxx\%    &  \\
\textbf{Status suspension of deport.} & xxxxx\%    &  \\
\textbf{Status awaiting outcome} & 3xxxx\%  &  \\
\textbf{Status not applicable} & xxxxx\%    &  \\
\textbf{Flight reason} & & \\
\textbf{Negative Experiences} & & \\
\textbf{Not seeking family reunification} & xxxxx\%  &  \\
\textbf{Seeking family reunification } & xxxxx\%    &  \\
\textbf{Communal accommodation} & xxxxx\%  &  \\
\textbf{Private accommodation w/ other refugees} & xxxxx\%  &  \\
\textbf{Private accommodation w/o other refugees} & xxxxx\%  &  \\
\textbf{Currently not in education} & xxxxx\%  &  \\
\textbf{Currently in education} & xxxxx\%    &  \\
\textbf{Currently not working} & xxxxx\%  &  \\
\textbf{Currently working} & xxxxx\%    &  \\
\textbf{Not seeking work} & xxxxx\%    &  \\
\textbf{Number of integration courses attended} & xxxxx (0.01) & {0-5} \\
\textbf{Time with others from country o. origin} & xxxxx (0.028) & 31-5 \\
\textbf{Time with Germans} & xxxx (0.028) & 31-5 \\
\textbf{Time with people of other nat. } & xxxx (0.029) & 31-5 \\
\textbf{German lang. ability} & xxxx (0.015) & 30-4 \\
\textbf{No regular leisure activities} & xxxx\%  &  \\
\textbf{Regular leisure activities} & xxxx\%    &  \\
\bottomrule
\end{tabular}%
\begin{tablenotes}
\item[1] These values were calculated using weighted and imputed data.
   \end{tablenotes}
  \label{tab:addlabel}%
    \end{threeparttable}
\end{table}%
\end{document}
3

Instead of centering, you could restrict the table size to the available text width:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{dcolumn,tabularx,ragged2e, caption}
\usepackage{siunitx}
\usepackage{threeparttable}
\renewcommand{\rmdefault}{phv} 
\renewcommand{\sfdefault}{phv}

\captionsetup{singlelinecheck = false, justification=justified}
\begin{document}

\begin{table}[htbp]
  \centering
  \begin{threeparttable}
  \caption{Descriptives Table}
    \begin{tabularx}{\linewidth}{@{}>{\raggedright\bfseries}Xll@{}}
    \toprule
    &\textbf{Mean(SE) or}&  \\
    &\textbf{Proportion in \%\tnote{1}}& \textbf{Range} \\
      \midrule
Distress & xxxxx  (0.044) & {0--12} \\
Life satisfaction & xxxxx (0.035) &{0--12} \\
Female & xxxxx\%  &  \\
Age & xxxxx (0.156) & {18--83} \\
Overall health & xxxxx (0.017) & 30--4 \\
Low edu. level & xxxxx\%  &  \\
Medium edu. level & xxxxx\%    &  \\
High edu. level & xxxxx\%    &  \\
Resilience & xxxxx (0.058) & 3--24 \\
Self--esteem & xxxxx (0.018) & 30--6 \\
Time in Germany & xxxxx (0.02) & {1 mo--32 yrs} \\
Status refugee or asylee & xxxxx\%  &  \\
Status protected & xxxxx\%    &  \\
Status suspension of deport. & xxxxx\%    &  \\
Status awaiting outcome & 3xxxx\%  &  \\
Status not applicable & xxxxx\%    &  \\
Flight reason & & \\
Negative Experiences & & \\
Not seeking family reunification & xxxxx\%  &  \\
Seeking family reunification  & xxxxx\%    &  \\
Communal accommodation & xxxxx\%  &  \\
Private accommodation w/ other refugees & xxxxx\%  &  \\
Private accommodation w/o other refugees & xxxxx\%  &  \\
Currently not in education & xxxxx\%  &  \\
Currently in education & xxxxx\%    &  \\
Currently not working & xxxxx\%  &  \\
Currently working & xxxxx\%    &  \\
Not seeking work & xxxxx\%    &  \\
Number of integration courses attended & xxxxx (0.01) & {0--5} \\
Time with others from country o. origin & xxxxx (0.028) & 31--5 \\
Time with Germans & xxxx (0.028) & 31--5 \\
Time with people of other nat.  & xxxx (0.029) & 31--5 \\
German lang. ability & xxxx (0.015) & 30--4 \\
No regular leisure activities & xxxx\%  &  \\
Regular leisure activities & xxxx\%    &  \\
\bottomrule
\end{tabularx}%
\begin{tablenotes}
\item[1] These values were calculated using weighted and imputed data.
   \end{tablenotes}
  \label{tab:addlabel}%
    \end{threeparttable}
\end{table}%
\end{document}

enter image description here

  • +1. Nice touch to remove all \textbf directives from the items in the left-hand column and, instead, to insert a \bfseries directive in the definition of the properties of the left-hand column. – Mico Jun 14 '18 at 16:54
  • Thanks a lot that works great! Could you explain me the line \begin{tabularx}{\linewidth}{@{}>{\raggedright\bfseries}Xll@{}} please? – Julia Jun 14 '18 at 16:54
  • @Julia \begin{tabularx}{\linewidth} is for making the table equal to the available with, @{} removes additional spacing around the columns, >{\raggedright\bfseries} automatically makes the first column bold and left aligned and X is a special column type with linebreaks that uses all the available space. – user36296 Jun 14 '18 at 16:56
  • @Julia Another suggestion: with the siunitx package you could align you numbers. – user36296 Jun 14 '18 at 16:58
  • 1
    @Julia - The tabularx package automatically loads the array package. The array package provides all kinds of nifty tools for modifying the properties of predefined column types. E.g., >{\raggedright\bfseries}X means, "apply ragged-right style instead of full justification (the default setting of the X column), and automatically typeset the column contents in bold". Do read the user guide of the array package to familiarize yourself with the most important tools this package provides. – Mico Jun 14 '18 at 17:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.