如何获得固定的列宽并打破过长的表格标题?

如何获得固定的列宽并打破过长的表格标题?

我想制作一个格式一致的表格。但是,由于我的列名长度不同(其中一些比其他的长),我的表格看起来很奇怪...

\documentclass[12pt,letterpaper]{article}
%\usepackage[longnamesfirst]{natbib}
\usepackage[round]{natbib}
\usepackage{rotating}
\usepackage{cancel}
%\usepackage{appendix}
%\usepackage[toc,page]{appendix}
\usepackage{amsfonts,mathtools,amsmath}
\usepackage{setspace}
\usepackage{threeparttable}
\usepackage{amsmath}
\usepackage{amsfonts}
%\usepackage{natbib}
\usepackage{longtable,lscape}
\usepackage{amssymb}
\usepackage{graphicx} 
%\usepackage{indentfirst}
\usepackage{color}
\usepackage{float}
\usepackage[center]{caption}
\usepackage{subfigure}
\usepackage{plain}
%\usepackage{afterpage}
%\bibliographystyle{apsr}
\usepackage{theorem}
\usepackage{multirow,dcolumn,booktabs}
\usepackage{sectsty}
\usepackage{url}
\usepackage{chngcntr}
%\usepackage[capposition=top]{floatrow}
\sectionfont{\normalsize}
\subsectionfont{\normalsize}
\makeatletter
\renewcommand\thesubsection{\thesection.\@arabic\c@subsection}
\renewcommand\thesubsubsection{\thesubsection.\@arabic\c@subsubsection}
\makeatother

\setlength{\textwidth}{16cm} \setlength{\textheight}{22.8cm}
\addtolength{\oddsidemargin}{-13mm} \addtolength{\topmargin}{-10mm}
\setlength{\topmargin}{-.5in}
    \linespread{1.5}

\renewcommand{\labelenumii}{\arabic{enumi}}
\newcommand\independent{\protect\mathpalette{\protect\independenT}{\perp}}
\def\independenT#1#2{\mathrel{\rlap{$#1#2$}\mkern2mu{#1#2}}}

\DeclareMathOperator*{\rk}{rk}
\DeclareMathOperator*{\Card}{Card}
\DeclareMathOperator*{\Prob}{Prob}
\DeclareMathOperator*{\cov}{cov}
\DeclareMathOperator*{\var}{var}
\DeclareMathOperator{\Var}{Var\,}
\DeclareMathOperator{\Post}{Post}
\DeclareMathOperator{\Pre}{Pre}
\DeclareMathOperator{\post}{post}
\DeclareMathOperator{\pre}{pre}
\DeclareMathOperator{\Mid}{Mid}
\DeclareMathOperator{\MID}{MID}

\usepackage{float}
\usepackage{graphicx}
\graphicspath{{./graphics/}}
\usepackage[all]{nowidow}
\usepackage{multirow}
\usepackage{textcomp}
\usepackage{soul}

\usepackage{colortbl}
\usepackage{booktabs}
\usepackage{ragged2e}
\usepackage{threeparttable}
\newcommand{\tabnote}[1]{\vskip5pt{\justifying\noindent\small {\emph{Note:~}#1\par}}}
\usepackage{epigraph}
\usepackage{fullwidth}
\usepackage{fancyvrb} % Allows customization of verbatim environments
\fvset{fontsize=\normalsize}

\usepackage{pdflscape}
\usepackage{lscape}
\usepackage{lipsum}
\usepackage{amssymb}% http://ctan.org/pkg/amssymb
\usepackage{pifont}% http://ctan.org/pkg/pifont

\begin{landscape}
\begin{table}[htbp]
\scriptsize
  \centering
  \caption{Add caption}
\begin{tabular}{lrrrrrrrrrrrr}
    \toprule
     Country & \multicolumn{1}{l}{Heavy } & \multicolumn{1}{l}{Foreigner} & \multicolumn{1}{l}{Female} & \multicolumn{1}{l}{Parental Status} & \multicolumn{1}{l}{Household Members } & \multicolumn{1}{l}{Married} & \multicolumn{1}{l}{Divorced/Seperated} & \multicolumn{1}{l}{Single} & \multicolumn{1}{l}{Widow} & \multicolumn{1}{l}{Age} & \multicolumn{1}{l}{Observations} \\
    \midrule
    Austria & 0.39  & 0.027 & 0.56  & 0.33  & 2     & 0.62  & 0.1   & 0.18  & 0.1   & 48    & 2941 \\
    Belgium & 0.37  & 0.066 & 0.52  & 0.42  & 3     & 0.7   & 0.08  & 0.14  & 0.09  & 51    & 2785 \\
    Bulgaria & 0.23  & 0.003 & 0.53  & 0.44  & 3     & 0.72  & 0.07  & 0.11  & 0.11  & 50    & 2827 \\
    Croatia & 0.36  & 0.005 & 0.57  & 0.46  & 3     & 0.64  & 0.05  & 0.21  & 0.11  & 47    & 1931 \\
    Cyprus & 0.29  & 0.057 & 0.52  & 0.54  & 3     & 0.68  & 0.05  & 0.22  & 0.05  & 45    & 1465 \\
    Czechia & 0.36  & 0.005 & 0.57  & 0.43  & 3     & 0.67  & 0.12  & 0.14  & 0.08  & 45    & 2925 \\
    Denmark & 0.6   & 0.02  & 0.51  & 0.33  & 2     & 0.64  & 0.1   & 0.16  & 0.09  & 53    & 2878 \\
    Estonia & 0.41  & 0.006 & 0.61  & 0.36  & 2     & 0.55  & 0.12  & 0.18  & 0.15  & 51    & 2815 \\
    Finland & 0.42  & 0.019 & 0.55  & 0.26  & 2     & 0.57  & 0.13  & 0.17  & 0.13  & 54    & 2870 \\
    France & 0.38  & 0.059 & 0.55  & 0.39  & 2     & 0.6   & 0.12  & 0.19  & 0.09  & 50    & 2905 \\
    Germany & 0.35  & 0.027 & 0.51  & 0.32  & 2     & 0.66  & 0.07  & 0.19  & 0.07  & 51    & 4304 \\
    Greece & 0.25  & 0.016 & 0.52  & 0.4   & 3     & 0.62  & 0.07  & 0.24  & 0.08  & 47    & 2918 \\
    Hungary & 0.21  & 0.004 & 0.59  & 0.42  & 3     & 0.64  & 0.11  & 0.13  & 0.13  & 49    & 2842 \\
    Ireland & 0.37  & 0.09  & 0.55  & 0.49  & 3     & 0.73  & 0.04  & 0.18  & 0.06  & 47    & 2771 \\
    Italy & 0.32  & 0.01  & 0.56  & 0.51  & 3     & 0.71  & 0.05  & 0.18  & 0.06  & 47    & 2842 \\
    Latvia & 0.41  & 0.006 & 0.57  & 0.49  & 3     & 0.67  & 0.11  & 0.16  & 0.07  & 44    & 2714 \\
    Lithuania & 0.31  & 0.001 & 0.59  & 0.36  & 2     & 0.53  & 0.13  & 0.19  & 0.15  & 48    & 2866 \\
    Luxembourg & 0.48  & 0.379 & 0.56  & 0.54  & 3     & 0.69  & 0.09  & 0.15  & 0.07  & 48    & 1414 \\
    Malta & 0.28  & 0.023 & 0.6   & 0.48  & 3     & 0.67  & 0.04  & 0.2   & 0.09  & 52    & 1419 \\
    Netherlands & 0.61  & 0.022 & 0.53  & 0.36  & 2     & 0.63  & 0.07  & 0.27  & 0.03  & 52    & 2864 \\
    Poland & 0.27  & 0.003 & 0.61  & 0.45  & 3     & 0.66  & 0.07  & 0.14  & 0.13  & 48    & 2793 \\
    Portugal & 0.21  & 0.016 & 0.56  & 0.42  & 3     & 0.62  & 0.09  & 0.17  & 0.12  & 49    & 2788 \\
    Romania & 0.2   & 0     & 0.5   & 0.42  & 3     & 0.73  & 0.05  & 0.13  & 0.1   & 47    & 2754 \\
    Slovakia & 0.3   & 0.008 & 0.58  & 0.5   & 3     & 0.69  & 0.07  & 0.14  & 0.11  & 48    & 2895 \\
    Slovenia & 0.34  & 0.012 & 0.57  & 0.46  & 3     & 0.67  & 0.04  & 0.17  & 0.11  & 51    & 2783 \\
    Spain & 0.29  & 0.06  & 0.52  & 0.44  & 3     & 0.68  & 0.06  & 0.19  & 0.07  & 48    & 2854 \\
    Sweden & 0.62  & 0.026 & 0.47  & 0.29  & 2     & 0.62  & 0.12  & 0.18  & 0.07  & 56    & 2890 \\
    United Kingdom & 0.39  & 0.091 & 0.54  & 0.38  & 2     & 0.55  & 0.09  & 0.26  & 0.1   & 50    & 3710 \\
    \bottomrule
    \end{tabular}%
  \label{tab:addlabel}%
\end{table}%
\end{landscape}

我的表格使用上面的代码

答案1

您可能喜欢以下表格设计:

在此处输入图片描述

  • 对于它我使用tabularray带有库的包booktabssiunitx(加载同名的包)
  • 您应该提供一个 MWE(最小工作示例),即一个小但完整的文档,其序言仅包含与问题相关的信息:页面布局、使用的字体、必要的包和文档主体中使用的定义。——看来,您的文档使用了相当旧的“模板”:您加载过时的包subfigure(现在已被取代,subfig但更好的是使用subcaption
  • 一些包会覆盖已经加载的包(lscape,pdflscape
  • 许多包被加载多次。
  • 您确实需要花点力气来清理序言……

梅威瑟:

\documentclass[12pt,letterpaper]{article}
\setlength{\textwidth}{16cm}
\setlength{\textheight}{22.8cm}
\addtolength{\oddsidemargin}{-13mm}
\addtolength{\topmargin}{-10mm}
\setlength{\topmargin}{-.5in}
%\linespread{1.5}

\usepackage{pdflscape}

\usepackage[skip=1ex]{caption}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}


\begin{document}
    \begin{landscape}
\begin{table}[htbp]
\small
\centering
    \caption{Add caption}
\begin{tblr}{colspec={@{} l
                           X[c, si={table-format=1.2}]
                           X[c, si={table-format=1.3}]
                      *{2}{X[c, si={table-format=1.2}]}
                           X[c, si={table-format=1.0}]
                      *{4}{X[c, si={table-format=1.2}]}
                           X[c, si={table-format=2.0}]
                           X[c, si={table-format=4.0}]
                      @{} },
            colsep=4pt,
            rowsep = 0pt,
            row{1} = {guard, m}
            }
    \toprule
Country     & Heavy & Foreigner 
                            &Female & {Parental\\ Status} 
                                            & {Household\\ Members} 
                                                    & Married 
                                                            &{Divorced/\\Seperated} 
                                                                    &Single & Widow & Age   & Obser\-vations  \\
    \midrule
Austria     & 0.39  & 0.027 & 0.56  & 0.33  & 2     & 0.62  & 0.1   & 0.18  & 0.1   & 48    & 2941 \\
Belgium     & 0.37  & 0.066 & 0.52  & 0.42  & 3     & 0.7   & 0.08  & 0.14  & 0.09  & 51    & 2785 \\
Bulgaria    & 0.23  & 0.003 & 0.53  & 0.44  & 3     & 0.72  & 0.07  & 0.11  & 0.11  & 50    & 2827 \\
Croatia     & 0.36  & 0.005 & 0.57  & 0.46  & 3     & 0.64  & 0.05  & 0.21  & 0.11  & 47    & 1931 \\
Cyprus      & 0.29  & 0.057 & 0.52  & 0.54  & 3     & 0.68  & 0.05  & 0.22  & 0.05  & 45    & 1465 \\
Czechia     & 0.36  & 0.005 & 0.57  & 0.43  & 3     & 0.67  & 0.12  & 0.14  & 0.08  & 45    & 2925 \\
Denmark     & 0.6   & 0.02  & 0.51  & 0.33  & 2     & 0.64  & 0.1   & 0.16  & 0.09  & 53    & 2878 \\
Estonia     & 0.41  & 0.006 & 0.61  & 0.36  & 2     & 0.55  & 0.12  & 0.18  & 0.15  & 51    & 2815 \\
Finland     & 0.42  & 0.019 & 0.55  & 0.26  & 2     & 0.57  & 0.13  & 0.17  & 0.13  & 54    & 2870 \\
France      & 0.38  & 0.059 & 0.55  & 0.39  & 2     & 0.6   & 0.12  & 0.19  & 0.09  & 50    & 2905 \\
Germany     & 0.35  & 0.027 & 0.51  & 0.32  & 2     & 0.66  & 0.07  & 0.19  & 0.07  & 51    & 4304 \\
Greece      & 0.25  & 0.016 & 0.52  & 0.4   & 3     & 0.62  & 0.07  & 0.24  & 0.08  & 47    & 2918 \\
Hungary     & 0.21  & 0.004 & 0.59  & 0.42  & 3     & 0.64  & 0.11  & 0.13  & 0.13  & 49    & 2842 \\
Ireland     & 0.37  & 0.09  & 0.55  & 0.49  & 3     & 0.73  & 0.04  & 0.18  & 0.06  & 47    & 2771 \\
Italy       & 0.32  & 0.01  & 0.56  & 0.51  & 3     & 0.71  & 0.05  & 0.18  & 0.06  & 47    & 2842 \\
Latvia      & 0.41  & 0.006 & 0.57  & 0.49  & 3     & 0.67  & 0.11  & 0.16  & 0.07  & 44    & 2714 \\
Lithuania   & 0.31  & 0.001 & 0.59  & 0.36  & 2     & 0.53  & 0.13  & 0.19  & 0.15  & 48    & 2866 \\
Luxembourg  & 0.48  & 0.379 & 0.56  & 0.54  & 3     & 0.69  & 0.09  & 0.15  & 0.07  & 48    & 1414 \\
Malta       & 0.28  & 0.023 & 0.6   & 0.48  & 3     & 0.67  & 0.04  & 0.2   & 0.09  & 52    & 1419 \\
Netherlands & 0.61  & 0.022 & 0.53  & 0.36  & 2     & 0.63  & 0.07  & 0.27  & 0.03  & 52    & 2864 \\
Poland      & 0.27  & 0.003 & 0.61  & 0.45  & 3     & 0.66  & 0.07  & 0.14  & 0.13  & 48    & 2793 \\
Portugal    & 0.21  & 0.016 & 0.56  & 0.42  & 3     & 0.62  & 0.09  & 0.17  & 0.12  & 49    & 2788 \\
Romania     & 0.2   & 0     & 0.5   & 0.42  & 3     & 0.73  & 0.05  & 0.13  & 0.1   & 47    & 2754 \\
Slovakia    & 0.3   & 0.008 & 0.58  & 0.5   & 3     & 0.69  & 0.07  & 0.14  & 0.11  & 48    & 2895 \\
Slovenia    & 0.34  & 0.012 & 0.57  & 0.46  & 3     & 0.67  & 0.04  & 0.17  & 0.11  & 51    & 2783 \\
Spain       & 0.29  & 0.06  & 0.52  & 0.44  & 3     & 0.68  & 0.06  & 0.19  & 0.07  & 48    & 2854 \\
Sweden      & 0.62  & 0.026 & 0.47  & 0.29  & 2     & 0.62  & 0.12  & 0.18  & 0.07  & 56    & 2890 \\
United Kingdom
            & 0.39  & 0.091 & 0.54  & 0.38  & 2     & 0.55  & 0.09  & 0.26  & 0.1   & 50    & 3710 \\
    \bottomrule
    \end{tblr}\par
  \label{tab:addlabel}%
\end{table}%
\end{landscape}
\end{document}

答案2

也许可以将每个标题中的长文本更改为较短的内容,例如首字母缩略词/符号,或者旋转它们。表格还包含按其列类型格式化的数字siunitxS经过建议的更改(包括旋转),表格可以适合页面,而无需使用横向环境。

您应该整理一下您的前言。至少,删除重复和多余的包。不要添加您遇到的所有内容,只保留文档中实际使用的包。

这是他的代码:

\documentclass[12pt,letterpaper]{article}
% \usepackage[longnamesfirst,round]{natbib}
\usepackage{rotating}
% \usepackage{cancel}
% \usepackage[toc,page]{appendix}
% \usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{setspace}
% \usepackage{threeparttable}
\usepackage{longtable,pdflscape}
% \usepackage{graphicx} 
% \usepackage{indentfirst}
% \usepackage{color}
% \usepackage{float}
\usepackage{subcaption}
% \usepackage{plain}
% \usepackage{afterpage}
% \bibliographystyle{apsr}
% \usepackage{theorem}
% \usepackage{multirow,dcolumn}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{sectsty}
% \usepackage{url}
% \usepackage{chngcntr}
% \usepackage[capposition=top]{floatrow}
\usepackage{makecell}
% \usepackage{float}
% \usepackage{graphicx}
\graphicspath{{./graphics/}}
% \usepackage[all]{nowidow}
% \usepackage{multirow}
\usepackage{textcomp}
\usepackage{soul}
\usepackage{colortbl}
\usepackage{ragged2e}
\newcommand{\tabnote}[1]{\vskip5pt{\justifying\noindent\small {\emph{Note:~}#1\par}}}
% \usepackage{epigraph}
% \usepackage{fullwidth}
% \usepackage{fancyvrb} % Allows customization of verbatim environments
% \fvset{fontsize=\normalsize}
\usepackage{lipsum}
\usepackage{pifont}% http://ctan.org/pkg/pifont

\sectionfont{\normalsize}
\subsectionfont{\normalsize}
\makeatletter
\renewcommand\thesubsection{\thesection.\@arabic\c@subsection}
\renewcommand\thesubsubsection{\thesubsection.\@arabic\c@subsubsection}
\makeatother

\setlength{\textwidth}{16cm} \setlength{\textheight}{22.8cm}
\addtolength{\oddsidemargin}{-13mm} \addtolength{\topmargin}{-10mm}
\setlength{\topmargin}{-.5in}
\setstretch{1.21}

\renewcommand{\labelenumii}{\arabic{enumi}}
\newcommand\independent{\protect\mathpalette{\protect\independenT}{\perp}}
\def\independenT#1#2{\mathrel{\rlap{$#1#2$}\mkern2mu{#1#2}}}

% \DeclareMathOperator*{\rk}{rk}
% \DeclareMathOperator*{\Card}{Card}
% \DeclareMathOperator*{\Prob}{Prob}
% \DeclareMathOperator*{\cov}{cov}
% \DeclareMathOperator*{\var}{var}
% \DeclareMathOperator{\Var}{Var\,}
% \DeclareMathOperator{\Post}{Post}
% \DeclareMathOperator{\Pre}{Pre}
% \DeclareMathOperator{\post}{post}
% \DeclareMathOperator{\pre}{pre}
% \DeclareMathOperator{\Mid}{Mid}
% \DeclareMathOperator{\MID}{MID}


\begin{document}
{%\begin{landscape}
  \small
  % Settings for makecell
  \renewcommand*\theadalign{l}
  \renewcommand*\theadfont{\normalfont\small}
  \renewcommand*\theadset{\setstretch{0.8}}
  % Setting chaption
  \captionsetup[table]{position=top,skip=0pt}
  % Spacing
  \setlength\tabcolsep{3pt}
  \centering
  \captionof{table}{Add caption}
  \label{tab:addlabel}% 
  \begin{longtable}{
      l
      S[table-format=1.2,minimum-decimal-digits=2]
      S[table-format=1.3,minimum-decimal-digits=3]
      *2{S[table-format=1.2,minimum-decimal-digits=2]}
      c
      *4{S[table-format=1.2,minimum-decimal-digits=2]}
      *2{c}
    }
    \toprule
    Country
    & {\rotatebox{90}{\thead{Heavy}}}
    & {\rotatebox{90}{\thead{Foreigner}}}
    & {\rotatebox{90}{\thead{Female}}}
    & {\rotatebox{90}{\thead{Parental\\Status}}}
    & {\rotatebox{90}{\thead{Household\\Members}}}
    & {\rotatebox{90}{\thead{Married}}}
    & {\rotatebox{90}{\thead{Divorced\\/Seperated}}}
    & {\rotatebox{90}{\thead{Single}}}
    & {\rotatebox{90}{\thead{Widow}}}
    & {\rotatebox{90}{\thead{Age}}}
    & {\rotatebox{90}{\thead{Observations\enspace}}} \\
    \midrule\endhead
    \bottomrule\endfoot
    Austria        & 0.39 & 0.027 & 0.56 & 0.33 & 2 & 0.62 & 0.1  & 0.18 & 0.1  & 48 & 2941 \\
    Belgium        & 0.37 & 0.066 & 0.52 & 0.42 & 3 & 0.7  & 0.08 & 0.14 & 0.09 & 51 & 2785 \\
    Bulgaria       & 0.23 & 0.003 & 0.53 & 0.44 & 3 & 0.72 & 0.07 & 0.11 & 0.11 & 50 & 2827 \\
    Croatia        & 0.36 & 0.005 & 0.57 & 0.46 & 3 & 0.64 & 0.05 & 0.21 & 0.11 & 47 & 1931 \\
    Cyprus         & 0.29 & 0.057 & 0.52 & 0.54 & 3 & 0.68 & 0.05 & 0.22 & 0.05 & 45 & 1465 \\
    Czechia        & 0.36 & 0.005 & 0.57 & 0.43 & 3 & 0.67 & 0.12 & 0.14 & 0.08 & 45 & 2925 \\
    Denmark        & 0.6  & 0.02  & 0.51 & 0.33 & 2 & 0.64 & 0.1  & 0.16 & 0.09 & 53 & 2878 \\
    Estonia        & 0.41 & 0.006 & 0.61 & 0.36 & 2 & 0.55 & 0.12 & 0.18 & 0.15 & 51 & 2815 \\
    Finland        & 0.42 & 0.019 & 0.55 & 0.26 & 2 & 0.57 & 0.13 & 0.17 & 0.13 & 54 & 2870 \\
    France         & 0.38 & 0.059 & 0.55 & 0.39 & 2 & 0.6  & 0.12 & 0.19 & 0.09 & 50 & 2905 \\
    Germany        & 0.35 & 0.027 & 0.51 & 0.32 & 2 & 0.66 & 0.07 & 0.19 & 0.07 & 51 & 4304 \\
    Greece         & 0.25 & 0.016 & 0.52 & 0.4  & 3 & 0.62 & 0.07 & 0.24 & 0.08 & 47 & 2918 \\
    Hungary        & 0.21 & 0.004 & 0.59 & 0.42 & 3 & 0.64 & 0.11 & 0.13 & 0.13 & 49 & 2842 \\
    Ireland        & 0.37 & 0.09  & 0.55 & 0.49 & 3 & 0.73 & 0.04 & 0.18 & 0.06 & 47 & 2771 \\
    Italy          & 0.32 & 0.01  & 0.56 & 0.51 & 3 & 0.71 & 0.05 & 0.18 & 0.06 & 47 & 2842 \\
    Latvia         & 0.41 & 0.006 & 0.57 & 0.49 & 3 & 0.67 & 0.11 & 0.16 & 0.07 & 44 & 2714 \\
    Lithuania      & 0.31 & 0.001 & 0.59 & 0.36 & 2 & 0.53 & 0.13 & 0.19 & 0.15 & 48 & 2866 \\
    Luxembourg     & 0.48 & 0.379 & 0.56 & 0.54 & 3 & 0.69 & 0.09 & 0.15 & 0.07 & 48 & 1414 \\
    Malta          & 0.28 & 0.023 & 0.6  & 0.48 & 3 & 0.67 & 0.04 & 0.2  & 0.09 & 52 & 1419 \\
    Netherlands    & 0.61 & 0.022 & 0.53 & 0.36 & 2 & 0.63 & 0.07 & 0.27 & 0.03 & 52 & 2864 \\
    Poland         & 0.27 & 0.003 & 0.61 & 0.45 & 3 & 0.66 & 0.07 & 0.14 & 0.13 & 48 & 2793 \\
    Portugal       & 0.21 & 0.016 & 0.56 & 0.42 & 3 & 0.62 & 0.09 & 0.17 & 0.12 & 49 & 2788 \\
    Romania        & 0.2  & 0     & 0.5  & 0.42 & 3 & 0.73 & 0.05 & 0.13 & 0.1  & 47 & 2754 \\
    Slovakia       & 0.3  & 0.008 & 0.58 & 0.5  & 3 & 0.69 & 0.07 & 0.14 & 0.11 & 48 & 2895 \\
    Slovenia       & 0.34 & 0.012 & 0.57 & 0.46 & 3 & 0.67 & 0.04 & 0.17 & 0.11 & 51 & 2783 \\
    Spain          & 0.29 & 0.06  & 0.52 & 0.44 & 3 & 0.68 & 0.06 & 0.19 & 0.07 & 48 & 2854 \\
    Sweden         & 0.62 & 0.026 & 0.47 & 0.29 & 2 & 0.62 & 0.12 & 0.18 & 0.07 & 56 & 2890 \\
    United Kingdom & 0.39 & 0.091 & 0.54 & 0.38 & 2 & 0.55 & 0.09 & 0.26 & 0.1  & 50 & 3710 \\
    \end{longtable}
  }%\end{landscape}%
\end{document}

和桌子

在此处输入图片描述

编辑。表格处于水平模式。

这是内部水平表的代码landscape

\documentclass[12pt,letterpaper]{article}
% \usepackage[longnamesfirst,round]{natbib}
\usepackage{rotating}
% \usepackage{cancel}
% \usepackage[toc,page]{appendix}
% \usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{setspace}
% \usepackage{threeparttable}
\usepackage{longtable,pdflscape}
% \usepackage{graphicx} 
% \usepackage{indentfirst}
% \usepackage{color}
% \usepackage{float}
\usepackage{subcaption}
% \usepackage{plain}
% \usepackage{afterpage}
% \bibliographystyle{apsr}
% \usepackage{theorem}
% \usepackage{multirow,dcolumn}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{sectsty}
% \usepackage{url}
% \usepackage{chngcntr}
% \usepackage[capposition=top]{floatrow}
% \usepackage{float}
% \usepackage{graphicx}
\graphicspath{{./graphics/}}
% \usepackage[all]{nowidow}
% \usepackage{multirow}
\usepackage{textcomp}
\usepackage{soul}
\usepackage{colortbl}
\usepackage{ragged2e}
\newcommand{\tabnote}[1]{\vskip5pt{\justifying\noindent\small {\emph{Note:~}#1\par}}}
% \usepackage{epigraph}
% \usepackage{fullwidth}
% \usepackage{fancyvrb} % Allows customization of verbatim environments
% \fvset{fontsize=\normalsize}
\usepackage{lipsum}
\usepackage{pifont}% http://ctan.org/pkg/pifont

\sectionfont{\normalsize}
\subsectionfont{\normalsize}
\makeatletter
\renewcommand\thesubsection{\thesection.\@arabic\c@subsection}
\renewcommand\thesubsubsection{\thesubsection.\@arabic\c@subsubsection}
\makeatother

\setlength{\textwidth}{16cm} \setlength{\textheight}{22.8cm}
\addtolength{\oddsidemargin}{-13mm} \addtolength{\topmargin}{-10mm}
\setlength{\topmargin}{-.5in}

\renewcommand{\labelenumii}{\arabic{enumi}}
\newcommand\independent{\protect\mathpalette{\protect\independenT}{\perp}}
\def\independenT#1#2{\mathrel{\rlap{$#1#2$}\mkern2mu{#1#2}}}

% \DeclareMathOperator*{\rk}{rk}
% \DeclareMathOperator*{\Card}{Card}
% \DeclareMathOperator*{\Prob}{Prob}
% \DeclareMathOperator*{\cov}{cov}
% \DeclareMathOperator*{\var}{var}
% \DeclareMathOperator{\Var}{Var\,}
% \DeclareMathOperator{\Post}{Post}
% \DeclareMathOperator{\Pre}{Pre}
% \DeclareMathOperator{\post}{post}
% \DeclareMathOperator{\pre}{pre}
% \DeclareMathOperator{\Mid}{Mid}
% \DeclareMathOperator{\MID}{MID}

% \setstretch{1.21}
\newcommand\thead[1]{\begin{tabular}{@{}c@{}}#1\end{tabular}}


\begin{document}
\begin{landscape}
  \small
  % Setting chaption
  \captionsetup[table]{position=top,skip=-6pt}
  % Spacing
  \setlength\tabcolsep{3pt}
  \centering
  \captionof{table}{Add caption}
  \label{tab:addlabel}% 
  \begin{longtable}{
      l
      S[table-format=1.2,minimum-decimal-digits=2]
      S[table-format=1.3,minimum-decimal-digits=3]
      *2{S[table-format=1.2,minimum-decimal-digits=2]}
      c
      *4{S[table-format=1.2,minimum-decimal-digits=2]}
      *2{c}
    }
    \toprule
    Country
    & {\thead{Heavy}}
    & {\thead{Foreigner}}
    & {\thead{Female}}
    & {\thead{Parental\\Status}}
    & {\thead{Household\\Members}}
    & {\thead{Married}}
    & {\thead{Divorced/\\Seperated}}
    & {\thead{Single}}
    & {\thead{Widow}}
    & {\thead{Age}}
    & {\thead{Observations\enspace}} \\
    \midrule\endhead
    \bottomrule\endfoot
    Austria        & 0.39 & 0.027 & 0.56 & 0.33 & 2 & 0.62 & 0.1  & 0.18 & 0.1  & 48 & 2941 \\
    Belgium        & 0.37 & 0.066 & 0.52 & 0.42 & 3 & 0.7  & 0.08 & 0.14 & 0.09 & 51 & 2785 \\
    Bulgaria       & 0.23 & 0.003 & 0.53 & 0.44 & 3 & 0.72 & 0.07 & 0.11 & 0.11 & 50 & 2827 \\
    Croatia        & 0.36 & 0.005 & 0.57 & 0.46 & 3 & 0.64 & 0.05 & 0.21 & 0.11 & 47 & 1931 \\
    Cyprus         & 0.29 & 0.057 & 0.52 & 0.54 & 3 & 0.68 & 0.05 & 0.22 & 0.05 & 45 & 1465 \\
    Czechia        & 0.36 & 0.005 & 0.57 & 0.43 & 3 & 0.67 & 0.12 & 0.14 & 0.08 & 45 & 2925 \\
    Denmark        & 0.6  & 0.02  & 0.51 & 0.33 & 2 & 0.64 & 0.1  & 0.16 & 0.09 & 53 & 2878 \\
    Estonia        & 0.41 & 0.006 & 0.61 & 0.36 & 2 & 0.55 & 0.12 & 0.18 & 0.15 & 51 & 2815 \\
    Finland        & 0.42 & 0.019 & 0.55 & 0.26 & 2 & 0.57 & 0.13 & 0.17 & 0.13 & 54 & 2870 \\
    France         & 0.38 & 0.059 & 0.55 & 0.39 & 2 & 0.6  & 0.12 & 0.19 & 0.09 & 50 & 2905 \\
    Germany        & 0.35 & 0.027 & 0.51 & 0.32 & 2 & 0.66 & 0.07 & 0.19 & 0.07 & 51 & 4304 \\
    Greece         & 0.25 & 0.016 & 0.52 & 0.4  & 3 & 0.62 & 0.07 & 0.24 & 0.08 & 47 & 2918 \\
    Hungary        & 0.21 & 0.004 & 0.59 & 0.42 & 3 & 0.64 & 0.11 & 0.13 & 0.13 & 49 & 2842 \\
    Ireland        & 0.37 & 0.09  & 0.55 & 0.49 & 3 & 0.73 & 0.04 & 0.18 & 0.06 & 47 & 2771 \\
    Italy          & 0.32 & 0.01  & 0.56 & 0.51 & 3 & 0.71 & 0.05 & 0.18 & 0.06 & 47 & 2842 \\
    Latvia         & 0.41 & 0.006 & 0.57 & 0.49 & 3 & 0.67 & 0.11 & 0.16 & 0.07 & 44 & 2714 \\
    Lithuania      & 0.31 & 0.001 & 0.59 & 0.36 & 2 & 0.53 & 0.13 & 0.19 & 0.15 & 48 & 2866 \\
    Luxembourg     & 0.48 & 0.379 & 0.56 & 0.54 & 3 & 0.69 & 0.09 & 0.15 & 0.07 & 48 & 1414 \\
    Malta          & 0.28 & 0.023 & 0.6  & 0.48 & 3 & 0.67 & 0.04 & 0.2  & 0.09 & 52 & 1419 \\
    Netherlands    & 0.61 & 0.022 & 0.53 & 0.36 & 2 & 0.63 & 0.07 & 0.27 & 0.03 & 52 & 2864 \\
    Poland         & 0.27 & 0.003 & 0.61 & 0.45 & 3 & 0.66 & 0.07 & 0.14 & 0.13 & 48 & 2793 \\
    Portugal       & 0.21 & 0.016 & 0.56 & 0.42 & 3 & 0.62 & 0.09 & 0.17 & 0.12 & 49 & 2788 \\
    Romania        & 0.2  & 0     & 0.5  & 0.42 & 3 & 0.73 & 0.05 & 0.13 & 0.1  & 47 & 2754 \\
    Slovakia       & 0.3  & 0.008 & 0.58 & 0.5  & 3 & 0.69 & 0.07 & 0.14 & 0.11 & 48 & 2895 \\
    Slovenia       & 0.34 & 0.012 & 0.57 & 0.46 & 3 & 0.67 & 0.04 & 0.17 & 0.11 & 51 & 2783 \\
    Spain          & 0.29 & 0.06  & 0.52 & 0.44 & 3 & 0.68 & 0.06 & 0.19 & 0.07 & 48 & 2854 \\
    Sweden         & 0.62 & 0.026 & 0.47 & 0.29 & 2 & 0.62 & 0.12 & 0.18 & 0.07 & 56 & 2890 \\
    United Kingdom & 0.39 & 0.091 & 0.54 & 0.38 & 2 & 0.55 & 0.09 & 0.26 & 0.1  & 50 & 3710 \\
  \end{longtable}
\end{landscape}%
\end{document}

在此处输入图片描述

相关内容