\begin{tabular}{|c|c|c|}
\hline
1 & 2 & 3 \\ \hline
4 & 5 & 6 \\ \cline{1-2}
7 & 8 & \\ \hline
9 & \multicolumn{2}{|c|}{10} \\ \hline
\end{tabular}
出力結果は以下のようになる。
表の幅を指定
表の幅を指定するには tabularx パッケージを使用する。
\usepackage{tabularx}
\begin{tabularx}{100mm}{|p{20mm}|p{10mm}|X|}
\hline
1 & 2 & 3 \\ \hline
4 & 5 & 6 \\ \hline
\end{tabularx}
\end{verbatim}
出力結果は以下のようになる。
もう少し複雑な例
\begin{tabularx}{\textwidth}{|p{10mm}|X|p{10mm}|p{10mm}|p{10mm}|}
\hline
\multicolumn{2}{|X|}{1} & 3 & 4 & 5 \\ \hline
6 & \multicolumn{2}{X|}{7} & 8 & 9 \\ \hline
\end{tabularx}
出力結果は以下のようになる。
行を跨いで配置
最初に multirow パッケージを使用することを明記しておく。
\beginpackage{multirow}
\begin{document}
\begin{tabular}{|c|c|c|}
\hline
1 & 2 & 3 \\ \hline
4 & 5 & \multirow{2}{*}{6} \\ \cline{1-2}
7 & 8 & \\ \hline
9 & \multicolumn{2}{c|}{10} \\ \hline
\multirow{3}{*}{11} & 12 & 13 \\ \cline{2-3}
& \multicolumn{2}{c|}{14} \\ \cline{2-3}
& 15 & 16 \\ \hline
\end{tabular}
\end{document}
出力結果は以下のようになる。
0 件のコメント:
コメントを投稿