latex,设置表格宽度

latex,设置表格宽度
latex,设置表格宽度

竭诚为您提供优质文档/双击可除latex,设置表格宽度

篇一:latex中表格的画法

latex中表格的画法

介绍一下不规则表格的一种画法,使用multirow这个包,在latex文件最前面用这个包\usepackage{multirow} 在正文中用以下代码:这个是模版,根据需要调整。\begin{table}[htbp]

\centering

\caption{\label{comparison}Resultcomparisononlndata }\begin{tabular}{c|c|c|c|c|c|c|c}

\hline

\multirow{2}{*}{instance}tlikehyphenationintablefoo tnotes.}

}

{\Fl&$h(mu)+F_2$&$h(mu)+cl_2$\ml

$\beta$(h)&$80.9$\tmark[b]&$83.2$\nn

$\beta$(mu)&$86.7$&$87.7$\ll

}

使用threeparttable宏包。下面是典型代码和效果:\begin{table}[htbp]

\centering\small

\begin{threeparttable}

\caption{\label{tab:results}effectoftradeopennesson environment(airpollution)}

\begin{tabular}{lccc}

\toprule

&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:Robuststandarderrorsinparentheses.intercept includedbutnotreported.

\begin{tablenotes}

\item[*]significantat5\%level

\item[**]significantat10\%level

\end{tablenotes}

\end{threeparttable}

\end{table}

固定列宽和自动伸缩列宽

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

固定列宽与对齐方式

固定列宽可以使用array宏包的p{2cm}系列命令,如果

需要指定水平对齐方式,可以使用下面的形

式>{\centering}p{2cm}实现,但如果使用这种方式,缺省情况下不能使用\\换行,需要使用\tabularnewline代替。为了仍然使用\\换行,需要在导言区加上下面的代码:\usepackage{array}

\newcommand{\preservebackslash}[1]{\let\temp=\\#1\l et\\=\temp}\newcolumntype{c}[1]{>{\preservebackslas h\centering}p{#1}}

\newcolumntype{R}[1]{>{\preservebackslash\raggedlef t}p{#1}}

\newcolumntype{l}[1]{>{\preservebackslash\raggedrig ht}p{#1}}

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

下面是一个的例子:

\begin{table}[htbp]

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

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

\toprule

&2000&20xx\\

\midrule

钢铁&3.1&5.2\\

化学制品&2.1&2.7\\

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

汽车产品&0.3&0.7\\

纺织品&10.(latex,设置表格宽度)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和~20xx

年中国制造业产品的出口份额}

\begin{tabularx}{10cm}{xrr}

\toprule

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