latex 表格中单元格换行,显示多行

除了使用multirow的方式(比较麻烦),更好地办法是用下面的语句,可以使得一个单元格中显示多行,再配合其它格式语句,就能使得表格非常美观。

\newcommand{\tabincell}[2]{\begin{tabular}{@{}#1@{}}#2\end{tabular}}

下面一个比较综合的例子:

\begin{table*}[htbp]

\centering

\newcommand{\tabincell}[2]{\begin{tabular}{@{}#1@{}}#2\end{tabular}}

\caption{XXXXXXX}

\begin{tabular}{|m{0.5cm}<{\centering}|m{2.5cm}<{\centering}|m{1.5cm}<{\centering}|m{1.5cm}<{\centering}|m{1.5cm}<{\centering}|m{1.5cm}<{\centering}|m{1.5cm}<{\centering}|}

\hline

\multicolumn{2}{|m{3cm}<{\centering}|}{Test instance}&

Number of the decision variables &

The decision space &

Number of the linear equations &

Number of the nonlinear equations &

Number of the optimal solutions\\

\hline

F1 &

\tabincell{l}{equ1 \\ equ2} &

2 &

2 &

2 &

2 &

2 \\

\hline

F1 & & & & & & \\

\hline

F2 & & & & & & \\

\hline

F3 & & & & & & \\

\hline

F4 & & & & & & \\

\hline

F5 & & & & & & \\

\hline

F6 & & & & & & \\

\hline

F7 & & & & & & \\

\hline

\end{tabular}

\end{table*}

最终效果如图:

wKioL1S4f1_Q1IqMAAFP5K700FA858.jpg


本文出自 “一梦一程-记录学习点滴” 博客,请务必保留此出处http://jincheng.blog.51cto.com/4625177/1604690

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值