[Tex/LaTex] How to specify array row height with slashbox

tables

I'm having issues with \backslashbox. As you can see from the picture, it's, for lack of a better word, ugly. I want to make the row height smaller to force the slashbox smaller as well. I tried using \arraystretch, but that didn't affect the slashbox. Is there any way I can make it looks nicer while still using \backslashbox?

Here is a snippet of the code:

\documentclass[11pt]{article}
\usepackage{setspace}
\doublespacing
\usepackage{array}
\usepackage{slashbox}

\begin{document}

\begin{equation}
\mbox D^{\frac 1 2}_{mm^\prime}=\begin{array}{r | r r}
\mbox{\backslashbox{$m$\kern-1em}{\kern-1em$m^{\prime\prime}$}}& \frac 1 2 & -\frac 1 2 \\ \hline
\frac 1 2 & a & b \\
-\frac 1 2 & c & d
\end{array}
\end{equation}

\end{document}

enter image description here

Best Answer

I came up with something that worked for your particular arguments. And then, in order to try to make it work for alternate things in the \bsbox (backslash box), I introduced the \refA and \refB concept in the MWE, wherein I place the \bsbox arguments in boxes that are the same size as what worked originally.

\documentclass[11pt]{article}
\usepackage{setspace}
\doublespacing
\usepackage{array}
%\usepackage{slashbox}
\usepackage{stackengine}[2013-09-11]
\usepackage{graphicx}
\def\refA{$m$}
\def\refB{$m^{\prime\prime}$}
\newcommand\bsbox[2]{%
  \raisebox{-1pt}{%
  \stackinset{c}{}{c}{}{\rotatebox{45}{\rule[-.5em]{.2pt}{3em}}}{%
  \def\stacktype{L}%
  \setstackgap{L}{.5\baselineskip}%
  \kern-1pt\makebox[\widthof{\refA}][r]{#1}\stackon{}{\smash{\makebox[\widthof{\refB}]{#2}}}\kern1pt%
  }%
  \kern-5.5pt}%
}
\begin{document}
\begin{equation}
\mbox D^{\frac 1 2}_{mm^\prime}=\begin{array}{r | r r}
\mbox{\normalsize\bsbox{$m$}{$m^{\prime\prime}$}}& \frac 1 2 & -\frac 1 2 \\ \hline
\frac 1 2 & a & b \\
-\frac 1 2 & c & d
\end{array}
\end{equation}

\begin{equation}
\mbox D^{\frac 1 2}_{mm^\prime}=\begin{array}{r | r r}
\mbox{\normalsize\bsbox{$m^2$}{$m_{2}$}}& \frac 1 2 & -\frac 1 2 \\ \hline
\frac 1 2 & a & b \\
-\frac 1 2 & c & d
\end{array}
\end{equation}
\end{document}

enter image description here

Related Question