我怎样才能将宽表居中?我已经尝试了在不同帖子中找到的所有方法。我会很感激每一个提示!我的代码已附上。
谢谢,
朱莉娅
\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}
答案1
除了居中之外,您还可以将表格大小限制为可用的文本宽度:
\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}