带有跨单元格对角线的表格

带有跨单元格对角线的表格

如何在 LaTeX 中绘制下表?

在此处输入图片描述

我试着寻找这里但从例子中我无法弄清楚如何得出这个结论。

编辑:再浏览几次后,我发现借助它,我可以画出表格无对角线。这是我的 MWE,

\begin{table}[]
\centering
\caption{My caption}
\label{my-label}
\begin{tabular}{|l|l|l|l|l|l|l|}
\hline
\multicolumn{1}{|c|}{CONCEPT} & \multicolumn{6}{c|}{COMPREHENSIVE NOTES}                                \\ \hline
Man                            & Substance & Material & Living           &     Sentient & Rational & Man \\ \hline
Animal                         & Substance & Material & Living           &     Sentient & Brutes   & Man \\ \hline
Organism                       & Substance & Material & Inanimate Bodies &     Plants   & Brutes   & Man \\ \hline
Body                           & Substance & Material & Inanimate Bodies &     Plants   & Brutes   & Man \\ \hline
Substance                      & Substance & Spirit   & Inanimate Bodies &     Plants   & Brutes   & Man \\ \hline
\multicolumn{1}{|c|}{}         & \multicolumn{6}{c|}{EXTENSIVE SUBJECTS}                                 \\ \hline
\end{tabular}
\end{table}

答案1

使用 tikz

\documentclass[a4paper]{article}
\usepackage{tikz}

\newcommand{\tikzmark}[2][]{\tikz[remember picture, overlay]\node[#1,inner sep=0pt,xshift=-\tabcolsep](#2){};\ignorespaces}
\newcommand{\tm}[2][]{\tikzmark[yshift=#1]{#2}}

\begin{document}
\begin{table}[]
\centering
\caption{My caption}
\label{my-label}
\begin{tabular}{|l|l|l|l|l|l|l|}
\hline
\multicolumn{1}{|c|}{CONCEPT}& \multicolumn{6}{c|}{COMPREHENSIVE NOTES}                                                       \\ \hline
Man                          & Substance & Material               & Living           & Sentient & Rational &\tm[1.8ex]{A} Man \\ \hline
Animal                       & Substance & Material               & Living           & Sentient & Brutes   & Man              \\ \hline
Organism                     & Substance & Material               & Inanimate Bodies & Plants   & Brutes   & Man              \\ \hline
Body                         & Substance & Material               & Inanimate Bodies & Plants   & Brutes   & Man              \\ \hline
Substance                    & Substance & \tm[-0.9ex]{B} Spirits & Inanimate Bodies & Plants   & Brutes   & Man              \\ \hline
\multicolumn{1}{|c|}{}       & \multicolumn{6}{c|}{EXTENSIVE SUBJECTS}                                                        \\ \hline
\end{tabular}
\tikz[remember picture, overlay]\draw[thick] (A)--(B);
\end{table}
\end{document}

答案2

以下是使用包来实现此目的的一种方法graphicx

\documentclass[10pt,letterpaper]{article}
 \usepackage{graphicx}
\begin{document}
\begin{table}[]
    \centering
    \caption{My caption}
    \label{my-label}
    \begin{tabular}{|l|l|l|l|l|l|l|}
        \hline
        \multicolumn{1}{|c|}{CONCEPT} & \multicolumn{6}{c|}%
{COMPREHENSIVE NOTES\Large\strut}                                \\ \hline
        Man                            & Substance & Material & Living           &     Sentient & Rational & Man \\ \hline
        Animal                         & Substance & Material & Living           &     Sentient & Brutes   & Man \\ \hline
        Organism                       & Substance & Material & Inanimate Bodies &     Plants   & Brutes   & Man \\ \hline
        Body                           & Substance & Material & Inanimate Bodies &     Plants   & Brutes   & Man \\ \hline
        Substance                      & Substance & Spirit   & Inanimate Bodies &     Plants   & Brutes   & Man \\ \hline
        \multicolumn{1}{|c|}{}         & \multicolumn{6}{c|}%
{EXTENSIVE SUBJECTS\Large\strut}                                 \\ \hline
    \end{tabular}


\vskip-1.17in\rotatebox{14}{\hskip1.5in\vtop{\hsize=3.75in\rule{3.28in}{1pt}}}



\end{table} 

并调整尺寸以满足您的需求。我添加了一个\Large\strut来调整顶部和底部单元格的单元格填充。

在此处输入图片描述

答案3

使用{NiceTabular}of nicematrix。该环境类似于{tabular}(of array),但在单元格下创建 PGF/Tikz 节点。然后可以使用这些节点与 Tikz 一起绘制您想要的任何规则(在或of 数组\CodeAfter中)。\CodeBefore

\documentclass{article}
\usepackage{nicematrix,tikz}

\begin{document}

\begin{table}[]
\centering
\caption{My caption}
\label{my-label}
\begin{NiceTabular}{lllllll}[hvlines]
\multicolumn{1}{c}{CONCEPT} & \multicolumn{6}{c}{COMPREHENSIVE NOTES}                                    \\ 
Man                            & Substance & Material & Living           &     Sentient & Rational & Man \\ 
Animal                         & Substance & Material & Living           &     Sentient & Brutes   & Man \\ 
Organism                       & Substance & Material & Inanimate Bodies &     Plants   & Brutes   & Man \\ 
Body                           & Substance & Material & Inanimate Bodies &     Plants   & Brutes   & Man \\ 
Substance                      & Substance & Spirit   & Inanimate Bodies &     Plants   & Brutes   & Man \\ 
                               & \multicolumn{6}{c}{EXTENSIVE SUBJECTS}                                  \\ 
\CodeAfter
  \tikz \draw (2-|7) -- (7-|3) ;
\end{NiceTabular}
\end{table}

\end{document}

上述代码的输出

相关内容