Diagbox 线与单元格高度有关的问题

Diagbox 线与单元格高度有关的问题

我尝试了这里发布的各种解决方案,但找不到合适的解决方案来解决我的问题。我在第二列中有一个长文本标题,它影响了第一列中的对角线和单元格高度。

这是我的第一次尝试:

\documentclass{article}
\usepackage[a4paper,landscape, margin=0.5in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{pifont}
\usepackage{tabularx}
\usepackage{adjustbox}
\usepackage{array}
\usepackage{diagbox}
\usepackage[table]{xcolor}

\begin{document}
    
\renewcommand\arraystretch{1.5}
    {\rowcolors{2}{}{lightgray}
    \begin{tabularx}{0.85\textwidth}{ 
      l | >{\centering\arraybackslash}X >{\centering\arraybackslash}X >{\centering\arraybackslash}X >{\centering\arraybackslash}X}
    \textbf{\diagbox{Feature}{Type of DSR}} & 
    \textbf{Manifold discussion within a community} &
    \textbf{Evaluation to support information management and purchase decision} &
    \textbf{Immediate discussion within a community}    &
    \textbf{Hybrid interaction related to sales and gratification} \\ \hline 
    \textbf{Content macro-category}   &   rating, review, discussion forum, social media post, tag, list    &   highlight, tooltip, comment, rating, review, tag, list & highlight, tooltip, comment (margin/footer), rating, tag &   highlight, tooltip, comment (margin/footer), rating, review, social media post, tag, list \\
    \textbf{Relation to source text} & external & immediate, external & immediate & immediate, external \\
    \textbf{Type of audience} & group, institution, public & group, institution, public &   group, institution, public & group, institution, public  \\
    \textbf{Timeframe} & after reading, scheduled, self-paced & after reading, self-paced & during/after reading, scheduled, self-paced & during/after reading, scheduled, self-paced \\
    \textbf{Examples} & Goodreads groups and discussions, fanfiction blogs & Amazon highlights and reviews, Goodreads lists, AO3 collections, Twitter bookmarks and lists & Hypothesis groups, Wattpad, comments in fanfiction archives & Kobo Reading app gamification, bookstagram, booktubers   \\
    \end{tabularx}
    }

\end{document}

这表明:

在此处输入图片描述

更改一些选项后,我得到了以下内容,但我不想在列标题顶部出现空白。

\documentclass{article}
\usepackage[a4paper,landscape, margin=0.5in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{pifont}
\usepackage{tabularx}
\usepackage{adjustbox}
\usepackage{array}
\usepackage{diagbox}
\usepackage[table]{xcolor}

\begin{document}

    \renewcommand\arraystretch{1.5}
        {\rowcolors{2}{}{lightgray}
        \begin{tabularx}{0.85\textwidth}{ 
          l | >{\centering\arraybackslash}X >{\centering\arraybackslash}X >{\centering\arraybackslash}X >{\centering\arraybackslash}X}
        \textbf{\diagbox[height=5.2\line]{\raisebox{1em}{Feature}}{\raisebox{-1em}{Type of DSR}}} & 
        \textbf{Manifold discussion within a community} &
        \textbf{Evaluation to support information management and purchase decision} &
        \textbf{Immediate discussion within a community}    &
        \textbf{Hybrid interaction related to sales and gratification} \\ \hline 
        \textbf{Content macro-category}   &   rating, review, discussion forum, social media post, tag, list    &   highlight, tooltip, comment, rating, review, tag, list & highlight, tooltip, comment (margin/footer), rating, tag &   highlight, tooltip, comment (margin/footer), rating, review, social media post, tag, list \\
        \textbf{Relation to source text} & external & immediate, external & immediate & immediate, external \\
        \textbf{Type of audience} & group, institution, public & group, institution, public &   group, institution, public & group, institution, public  \\
        \textbf{Timeframe} & after reading, scheduled, self-paced & after reading, self-paced & during/after reading, scheduled, self-paced & during/after reading, scheduled, self-paced \\
        \textbf{Examples} & Goodreads groups and discussions, fanfiction blogs & Amazon highlights and reviews, Goodreads lists, AO3 collections, Twitter bookmarks and lists & Hypothesis groups, Wattpad, comments in fanfiction archives & Kobo Reading app gamification, bookstagram, booktubers   \\
        \end{tabularx}
        }
\end{document}

在此处输入图片描述

知道如何修复它吗?

答案1

\raisebox我对其应用了负片\diagbox并调整了与之相关的一些其他参数\diagbox

\documentclass{article}
\usepackage[a4paper,landscape, margin=0.5in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{pifont}
\usepackage{tabularx}
\usepackage{adjustbox}
\usepackage{array}
\usepackage{diagbox}
\usepackage[table]{xcolor}

\begin{document}

    \renewcommand\arraystretch{1.5}
        {\rowcolors{2}{}{lightgray}
        \begin{tabularx}{0.85\textwidth}{ 
          l | >{\centering\arraybackslash}X >{\centering\arraybackslash}X >{\centering\arraybackslash}X >{\centering\arraybackslash}X}
        \raisebox{-1.8em}{\textbf{\diagbox[height=4.2\line]%
        {\raisebox{1em}{Feature}}{\raisebox{-0.2em}{Type of DSR}}}} & 
        \textbf{Manifold discussion within a community} &
        \textbf{Evaluation to support information management and purchase decision} &
        \textbf{Immediate discussion within a community}    &
        \textbf{Hybrid interaction related to sales and gratification} \\ \hline 
        \textbf{Content macro-category}   &   rating, review, discussion forum, social media post, tag, list    &   highlight, tooltip, comment, rating, review, tag, list & highlight, tooltip, comment (margin/footer), rating, tag &   highlight, tooltip, comment (margin/footer), rating, review, social media post, tag, list \\
        \textbf{Relation to source text} & external & immediate, external & immediate & immediate, external \\
        \textbf{Type of audience} & group, institution, public & group, institution, public &   group, institution, public & group, institution, public  \\
        \textbf{Timeframe} & after reading, scheduled, self-paced & after reading, self-paced & during/after reading, scheduled, self-paced & during/after reading, scheduled, self-paced \\
        \textbf{Examples} & Goodreads groups and discussions, fanfiction blogs & Amazon highlights and reviews, Goodreads lists, AO3 collections, Twitter bookmarks and lists & Hypothesis groups, Wattpad, comments in fanfiction archives & Kobo Reading app gamification, bookstagram, booktubers   \\
        \end{tabularx}
        }
\end{document}

在此处输入图片描述

注意:明显的第一列后没有垂直线是基于缩放级别的视觉伪影:

在此处输入图片描述

答案2

以下是使用 的解决方案nicematrix。在该扩展的环境下{NiceTabular},垂直规则惯于在某些 PDF 查看器的某些缩放级别下,它们似乎会消失。

\documentclass{article}
\usepackage[a4paper,landscape, margin=0.5in]{geometry}
\usepackage{nicematrix}

\begin{document}

\begin{NiceTabular}
      [cell-space-limits=1ex,width=0.85\textwidth,color-inside]
      {>{\bfseries}l|X[c]X[c]X[c]X[c]}
\rowcolors{}{lightgray}
\RowStyle{\bfseries}
\diagbox{\hspace{5pt}\rule[-8pt]{0pt}{8pt}Feature}{\rule{0pt}{12pt}Type of DSR\;} & 
Manifold discussion within a community &
Evaluation to support information management and purchase decision &
Immediate discussion within a community    &
Hybrid interaction related to sales and gratification \\ \hline 
Content macro-category   &   rating, review, discussion forum, social media post, tag, list    &   highlight, tooltip, comment, rating, review, tag, list & highlight, tooltip, comment (margin/footer), rating, tag &   highlight, tooltip, comment (margin/footer), rating, review, social media post, tag, list \\
Relation to source text & external & immediate, external & immediate & immediate, external \\
Type of audience & group, institution, public & group, institution, public &   group, institution, public & group, institution, public  \\
Timeframe & after reading, scheduled, self-paced & after reading, self-paced & during/after reading, scheduled, self-paced & during/after reading, scheduled, self-paced \\
Examples & Goodreads groups and discussions, fanfiction blogs & Amazon highlights and reviews, Goodreads lists, AO3 collections, Twitter bookmarks and lists & Hypothesis groups, Wattpad, comments in fanfiction archives & Kobo Reading app gamification, bookstagram, booktubers   \\
\end{NiceTabular}

\end{document}

nicematrix但是,由于使用 PGF/Tikz 节点,因此需要多次编译。

上述代码的输出

相关内容