latex 表格中單元格換行,顯示多行

除了使用multirow的方式(比較麻煩),更好地辦法是用下面的語句,能夠使得一個單元格中顯示多行,再配合其它格式語句,就能使得表格很是美觀。ide

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

下面一個比較綜合的例子:
blog

\begin{table*}[htbp]ci

\centeringget

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

\caption{XXXXXXX}io

\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}|}table

\hlineclass

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

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

相關文章
相關標籤/搜索