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

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 '20 at 12:40
2

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{xcolor}
\usepackage{calc}
\usepackage{nicematrix}

\begin{document}
    

\newlength{\mylength}

\setlength{\mylength}{((0.85\textwidth)-\widthof{\textbf{Content macro-category}})/4}

\newcolumntype{X}{>{\centering\arraybackslash}p{\mylength}}


\NiceMatrixOptions{cell-space-top-limit=1ex,cell-space-bottom-limit=1ex}
\begin{NiceTabular}{l|XXXX}[code-before = \rowcolors{2}{}{lightgray}]
\diagbox{\hspace{5pt}\rule[-8pt]{0pt}{8pt}\textbf{Feature}}{\rule{0pt}{12pt}\textbf{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{NiceTabular}

\end{document}

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

Output of the above code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.