4

I tried various solutions posted here but I can't find the appropriate one to solve my issue. I have a long text header in the second column that is affecting the diagonal line and celle height in the first column.

This is my first attempt:

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

Which shows this:

enter image description here

Changing some options, I get the following, but I don't want the white space on top of the column headers.

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

enter image description here

Any idea how to fix it?

3

2 Answers 2

2

I applied a negative \raisebox to the \diagbox and tweaked some of the other parameters associated with the \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}

enter image description here

NOTE: the apparent absence of the vertical line after the first column is a visual artifact based on the zoom level:

enter image description here

1
  • great! thank you
    – fpianz
    Oct 21, 2020 at 12:40
3

Here is a solution with nicematrix. With the environment {NiceTabular} of that extension, the vertical rule won't seem to vanish in some PDF viewers at some levels of zoom.

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

However, you need several compilations because nicematrix uses PGF/Tikz nodes.

Output of the above code

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .