latex-table

latex-table
latex-table

& NO$_2$ & SO$_2$ & PM \\

\midrule

$\ln(y/pop)$ & 408.74* & 287.25* & 566.65 \\

& (121.79) & (118.81) & (336.19) \\

$\ln(y/pop)^2$ & $-$22.85* & $-$16.58* & $-$35.57** \\

& (6.90) & (6.78) & (19.06) \\

$(X+M)/Y$ & $-$.29** & $-$.31* & $-$.37 \\

& (.17) & (.08) & (.34) \\

$Polity$ & $-$3.20* & $-$6.58* & $-$6.70** \\

& (1.47) & (2.05) & (3.42) \\

$\ln(LandArea/pop)$ & $-$5.94 & $-$2.92* & $-$13.02* \\

& (5.93) & (1.39) & (6.29) \\

Obs. & 36 & 41 & 38 \\

$R^2$ & 0.16 & 0.68 & 0.62 \\

\bottomrule

\end{tabular}

\small

Note: Robust standard errors in parentheses. Intercept

included but not reported.

\begin{tablenotes}

\item[*] significant at 5\% level

\item[**] significant at 10\% level

\end{tablenotes}

\end{threeparttable}

\end{table}

固定列宽和自动伸缩列宽

有时三线表需要固定某列的列宽,或者指定整个表格的总宽度,指定某几列自动伸缩。

固定列宽与对齐方式

固定列宽可以使用array宏包的p{2cm}系列命令,如果需要指定水平对齐方式,可以使用下面的形式>{\centering}p{2cm}实现,但如果使用这种方式,缺省情况下不能使用\\换行,需要使用\tabularnewline代替。为了仍然使用\\换行,需要在导言区加上下面的代码:

\usepackage{array}

\newcommand{\PreserveBackslash}[1]{\let\temp=\\#1\let\\=\temp}

\newcolumntype{C}[1]{>{\PreserveBackslash\centering}p{#1}}

\newcolumntype{R}[1]{>{\PreserveBackslash\raggedleft}p{#1}}

\newcolumntype{L}[1]{>{\PreserveBackslash\raggedright}p{#1}}

使用C{3cm}命令即可指定该列宽度为 3cm,并且文字居中对齐,左对齐和右对齐命令分别是L{2cm}和R{2cm}。

下面是一个的例子:

\begin{table}[htbp]

\centering\caption{\label{tab:test}2000 和~2004 年中国制造业产品的出口份额}

\begin{tabular}{l*{2}{R{2cm}}}

\toprule

& 2000 & 2004 \\

\midrule

钢铁& 3.1 & 5.2 \\

化学制品& 2.1 & 2.7 \\

办公设备及电信设备& 4.5 & 15.2 \\

汽车产品& 0.3 & 0.7 \\

纺织品& 10.4 & 17.2 \\

服装& 18.3 & 24\\

\bottomrule

\end{tabular}

\end{table}

自动伸缩列宽

使用tabularx宏包可以实现自动伸缩列宽。下面是一个简单的例子。与普通的tabular环境不同之处在于:(1)需要指定整个表格的总宽度;(2)需要用X指定至少一列为自动伸缩列。

\begin{table}[htbp]

\centering\caption{\label{tab:test}2000 和~2004 年中国制造业产品的出口份额}

\begin{tabularx}{10cm}{Xrr}

\toprule

& 2000 & 2004 \\

\midrule

钢铁& 3.1 & 5.2 \\

化学制品& 2.1 & 2.7 \\

办公设备及电信设备& 4.5 & 15.2 \\

汽车产品& 0.3 & 0.7 \\

纺织品& 10.4 & 17.2 \\

服装& 18.3 & 24\\

\bottomrule

\end{tabularx}

\end{table}

相关主题
相关文档
最新文档