【问题标题】:How to remove vertical lines when combining multirow and multicolumn in a tabular?在表格中组合多行和多列时如何删除垂直线?
【发布时间】:2021-09-06 05:35:38
【问题描述】:

我查看了一些类似的问题,但似乎没有一个与我的相同。

这是一个 MWE:

\documentclass[a4paper]{article}

\usepackage{multirow}
\usepackage{multicol}

\begin{document}

\begin{tabular}{|*{5}{c|}}
\hline 
\backslashbox{1}{2} & A & B & C & D \\
\hline 
a & \multicolumn{3}{c|}{\multirow{3}{*}{P}}   & x \\
\cline{1-1} \cline{5-5}
b  & & & & y  \\
\cline{1-1} \cline{5-5}
c & & &  & z \\
\hline 
d & q & n & t & r \\
\hline 
e & l & m & s & p \\
\hline 
\end{tabular}

\end{document}

B 列的部分边界为 2 条垂直线。我希望条目 P 有一个 3 x 3 的大单元格。

我该怎么做?

【问题讨论】:

标签: latex tabular multirow


【解决方案1】:

只需在包含 P 的单元格下方添加“幻像”多列:

\documentclass[a4paper]{article}

\usepackage{multirow}
\usepackage{multicol}
\begin{document}

\begin{tabular}{|*{5}{c|}}
\hline 
\backslashbox{1}{2}  & A & B & C & D \\
\hline 
a & \multicolumn{3}{c|}{\multirow{3}{*}{P}}   & x \\
\cline{1-1} \cline{5-5}
%% Add a \multicolumn here
b  & \multicolumn{3}{c|}{}   & x \\
\cline{1-1} \cline{5-5}
%% Add a \multicolumn here
c & \multicolumn{3}{c|}{}& z \\
\hline 
d & q & n & t & r \\
\hline 
e & l & m & s & p \\
\hline 
\end{tabular}

\end{document}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-01-13
    • 1970-01-01
    • 2016-09-22
    • 2018-05-29
    • 2022-11-20
    • 2017-07-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多