3

I want to add a diagonal line in a the top line of a table where the other entries on the first row are written sideways. I've tried \backslashbox and \diagbox and \diag but no matter how I change the values the topmost position of the line does not increase without lifting all the other entries.

\usepackage{slashbox}

\begin{table}[ht]
\centering
\caption{Pugh matrix}
\begin{tabular}{|l|c|c|c|}
\hline\hline
\backslashbox[130pt]{Property}{Concept} & \begin{sideways} Concept 1 \end{sideways} &  \begin{sideways} Next concept \end{sideways} & 
\begin{sideways} Next concept/increase line{\ }  \end{sideways} \\
\hline
Do this                & 0 & 0 & - \\
Do that     & 0 & 0 & 0 \\
Do it quickly   & 0 & + & + \\
Do the task quickly         & 0 & 0 & - \\ 
\hline 
SUM:                        & 0 & +1 & +2 \\
\hline
Ranking                     & 2 & 2 & 1  \\
\hline
Keep                        & NO & NO & YES \\
\hline\hline
\end{tabular}
\label{tab:Pugh_matrix2}
\end{table}

example

3

I used diagbox instead of slashbox and the rotatebox macro from graphicx instead of the rotating package:

\documentclass{article}
\usepackage{diagbox}
\usepackage{rotating}
\usepackage{graphicx}
\begin{document}
\begin{table}[ht]
\centering
\caption{Pugh matrix}
\begin{tabular}{|l|c|c|c|}
\hline\hline
\diagbox[dir=NW]{\rule{0mm}{4cm}Property}{Concept} & \rotatebox[x=2cm]{90}{Concept 1} & \rotatebox[x=2cm]{90}{Next concept} & 
\rotatebox[x=2cm]{90}{Next concept/increase line\ } \\
\hline
Do this                & 0 & 0 & - \\
Do that     & 0 & 0 & 0 \\
Do it quickly   & 0 & + & + \\
Do the task quickly         & 0 & 0 & - \\ 
\hline 
SUM:                        & 0 & +1 & +2 \\
\hline
Ranking                     & 2 & 2 & 1  \\
\hline
Keep                        & NO & NO & YES \\
\hline\hline
\end{tabular}
\label{tab:Pugh_matrix2}
\end{table}
\end{document}

enter image description here

1

I propose another solution, based on the \rotcell command from makecell, which allows fro line breaks in cells. Also various improvements to the table, in particular vertical padding between caption and table thanks to the caption package.

\documentclass{article}
\usepackage{diagbox}
\usepackage{rotating}
\usepackage{graphicx}
\usepackage{makecell, caption, booktabs}

\begin{document}

\begin{table}[ht]
  \centering\settowidth\rotheadsize{Next concept/}
  \renewcommand\cellalign{cl}
  \renewcommand\arraystretch{1.25}
  \caption{Pugh matrix}
  \begin{tabular}{|l|c|c|c|c}
    \toprule\noalign{\vskip-1pt}\hline
    \diagbox[height=1.25\rotheadsize]{\raisebox{3ex}{Property}}{\raisebox{-4ex}{Concept}} & \rotcell{Concept 1} & \rotcell{Next concept} & \rotcell{Next concept/ \\increase line} \\
    \hline
    Do this & 0 & 0 & $ - $ \\
    Do that & 0 & 0 & 0 \\
    Do it quickly & 0 & + & + \\
    Do the task quickly & 0 & 0 & $ - $ \\
    \hline
    SUM: & 0 & +1 & +2 \\
    \hline
    Ranking & 2 & 2 & 1 \\
    \hline
    Keep & NO & NO & YES \\
    \hline\bottomrule
  \end{tabular}
  \label{tab:Pugh_matrix2}
\end{table}

\end{document} 

enter image description here

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.