# Is it possible to add a diagonal line or slashbox to a very simple template of a table?

I have a very simple template of a table

I would like to add a slashbox at the top left corner (entry|item), similar to this post LaTeX table cell with a diagonal line and 2 sub cells

However, I have tried to add their code on top of the code below, yet I was not able to make it work.

Can someone provide a simple solution that creates a slashbox / diagonal line for this table?

\documentclass{article}
\usepackage{xcolor}
\usepackage{bbding}
\usepackage{amsthm, thmtools}
\usepackage{mathtools}
\usepackage{steinmetz}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{graphics}
\usepackage{cancel}
\usepackage{subcaption}
\usepackage{sidecap}
\usepackage{setspace}
\usepackage{verbatim}
\everymath{\displaystyle}
\setlength\parindent{0pt}
\setlength{\footskip}{40pt}

\begin{document}
\begin{center}
\centering\begin{tabular}{ |p{3cm}||p{2cm}|p{2cm}|p{2cm}|p{2cm}|}
\hline
& entry 1 &  entry 2 & entry 3 &  entry 4 \\
\hline
item 1 & $\%$ & $\%$  & $\%$ & $\%$\\
\hline
item 2 & $\%$  & $\%$  & $\%$ & $\%$\\
\hline
item 3  & $\%$ & $\%$  & $\%$ & $\%$\\
\hline
item 4 & $\%$ & $\%$  & $\%$ & $\%$\\
\hline
\end{tabular}\\
\end{center}
\end{document}

• are you sure you want to globally do \everymath{\displaystyle} ?(it makes inline math essentially unusable as inline math, although it can be useful for some special situations where you need to use inline math for technical reasons but want it to look like display – David Carlisle Nov 28 '17 at 22:55
• @DavidCarlisle I might have added that line as a quick fix for something a long time ago. I am not sure what this line does anymore. it makes inline math essentially unusable? Oh that sounds bad – Bajie Nov 28 '17 at 22:59
• Do you need text to appear in the slashbox as in your linked example? Or just the diagonal line? – Sandy G Nov 28 '17 at 23:35

You can do that with the diagbox package:

\documentclass{article}
\usepackage{array, diagbox}
\setlength\parindent{0pt}

\begin{document}

\begin{center}\setlength{\extrarowheight}{2pt}
\begin{tabular}{ |p{3cm}||*{4}{p{2cm}|}}
\hline
\diagbox[innerwidth = 3cm, height = 4ex]{}{} & entry 1 & entry 2 & entry 3 & entry 4 \\
\hline
item 1 & $\%$ & $\%$ & $\%$ & $\%$\\
\hline
item 2 & $\%$ & $\%$ & $\%$ & $\%$\\
\hline
item 3 & $\%$ & $\%$ & $\%$ & $\%$\\
\hline
item 4 & $\%$ & $\%$ & $\%$ & $\%$\\
\hline
\end{tabular}
\end{center}

\end{document}