tabularx环境中的列宽表

tabularx环境中的列宽表

在此处输入图片描述 这些东西可能有点杂乱,但无论如何:我遇到的问题是,我想制作一个如上所示的相关矩阵,但成熟度列的宽度应该更小,以便所有列几乎等距。也就是说,“成熟度”列在我们得到数字之前应该有一个小间隙(可能通过指定左侧来实现(因为所有其他列都居中)。其他一切都应该保持不变...请让我知道您如何更改此修改后的表格中的列宽。

\documentclass[12pt]{article}
\pagestyle{plain}
\usepackage[english]{babel}
  %%%%%%%%%%%%%%%SUPER TABLE%%%%%%%%%%%%%%%%%%%%
%the float environment is necessary for the table setup.
\usepackage{float}
\makeatletter
\newcommand\fs@topruled{\def\@fs@cfont{\bfseries}\let\@fs@capt\floatc@ruled
  \def\@fs@pre{\hrule height.8pt depth0pt \kern2pt}%
  \def\@fs@post{}%
  \def\@fs@mid{}%
  \let\@fs@iftopcapt\iftrue}
\makeatletter
\floatstyle{topruled}
\restylefloat{table}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%TABLE type 2
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{tabularx,booktabs,caption}% http://ctan.org/pkg/
\captionsetup[table]{%
  labelsep = newline,
  textfont = sc, 
  name = TABLE, 
  skip = \medskipamount}
%\newcolumntype{d}[1]{D{.}{.}{#1}} % "decimal" column type
%%%%%%%%%%%%%%%New Commands%%%%%%%%%%%%%%%%
%%% 
\usepackage{xpatch} %THE FOLLOWING IS RELATED TO FANCYHDR PACKAGE
\makeatletter
\xapptocmd{\@sect}{\csname #1mark\endcsname{#7}}{}{}
\makeatother 


\begin{document}


      \begin{table}[h]
  \caption{Correlation matrix}
  \label{tab:Correlation matrix}
  \begin{tabularx}{\linewidth}{@{} X r r r r r@{}}
    \toprule[0.5pt]
    \toprule[0.5pt]
   \multicolumn{1}{l}{\small Maturity} & \multicolumn{1}{c}{\small 1} & \multicolumn{1}{c}{\small 3} & \multicolumn{1}{c}{\small 12} & \multicolumn{1}{c}{\small 36} & \multicolumn{1}{c}{\small 60}  \\
      \midrule[0.5pt]
      %
   \multicolumn{1}{l}{1} & \multicolumn{1}{c}{1} & \multicolumn{1}{c}{} &  \multicolumn{1}{c}{} & \multicolumn{1}{c}{}\\
%
% 
    \multicolumn{1}{l}{3} &  \multicolumn{1}{c}{0.997} & \multicolumn{1}{c}{1} &  \multicolumn{1}{c}{} & \multicolumn{1}{c}{} \\
  %
  %  
    12 & \multicolumn{1}{c}{0.978} & \multicolumn{1}{c}{0.983} &  \multicolumn{1}{c}{1} & \multicolumn{1}{c}{}  \\
    36 &  \multicolumn{1}{c}{0.937} & \multicolumn{1}{c}{0.940} &  \multicolumn{1}{c}{0.976} & \multicolumn{1}{c}{1} \\
    60 & \multicolumn{1}{c}{0.915} & \multicolumn{1}{c}{0.914} &  \multicolumn{1}{c}{0.949} & \multicolumn{1}{c}{0.993}  & \multicolumn{1}{c}{1}\\
       \bottomrule
  \end{tabularx}

  \medskip

  \parbox{\linewidth}{\scriptsize%
  \textsc{Note}:
  We present the correlation matrix for five (5) different maturities. The sample period is from 2000:01 to 2014:02.}
\end{table}

感谢你们!

\结束{文档}

答案1

在此处输入图片描述

\documentclass[12pt]{article}
\pagestyle{plain}
\usepackage[english]{babel}
  %%%%%%%%%%%%%%%SUPER TABLE%%%%%%%%%%%%%%%%%%%%
%the float environment is necessary for the table setup.
\usepackage{float}
\makeatletter
\newcommand\fs@topruled{\def\@fs@cfont{\bfseries}\let\@fs@capt\floatc@ruled
  \def\@fs@pre{\hrule height.8pt depth0pt \kern2pt}%
  \def\@fs@post{}%
  \def\@fs@mid{}%
  \let\@fs@iftopcapt\iftrue}
\makeatletter
\floatstyle{topruled}
\restylefloat{table}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%TABLE type 2
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{tabularx,booktabs,caption}% http://ctan.org/pkg/
\captionsetup[table]{%
  labelsep = newline,
  textfont = sc, 
  name = TABLE, 
  skip = \medskipamount}
%\newcolumntype{d}[1]{D{.}{.}{#1}} % "decimal" column type
%%%%%%%%%%%%%%%New Commands%%%%%%%%%%%%%%%%
%%% 
\usepackage{xpatch} %THE FOLLOWING IS RELATED TO FANCYHDR PACKAGE
\makeatletter
\xapptocmd{\@sect}{\csname #1mark\endcsname{#7}}{}{}
\makeatother 


\begin{document}


      \begin{table}[htp]%never [h]
  \caption{Correlation matrix}
  \label{tab:Correlation matrix}
  \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}} l*5{c}@{}}
    \toprule[0.5pt]
    \toprule[0.5pt]
   Maturity &  1 &  3 & 12 &  36 &  60  \\
      \midrule[0.5pt]
      %
   1 & 1 &  &   & \\
%
% 
    3 &  0.997 & 1 &   &  \\
  %
  %  
    12 & 0.978 & 0.983 &  1 &   \\
    36 &  0.937 & 0.940 &  0.976 & 1 \\
    60 & 0.915 & 0.914 &  0.949 & 0.993  & 1\\
       \bottomrule
  \end{tabular*}

  \medskip

  \parbox{\linewidth}{\scriptsize%
  \textsc{Note}:
  We present the correlation matrix for five (5) different maturities. The sample period is from 2000:01 to 2014:02.}
\end{table}

\end{document}

相关内容