0

I have some code to define a table with a different height so that it looks better:

\begin{table}[h!]
        \centering
        {
            \renewcommand{\arraystretch}{2.25}
        \begin{tabular}{*{3}{|c}|}
            \hline
            \backslashbox{$V_b$}{$V_1$} & $-\dfrac{V_{\pi}}{4}$ & $\dfrac{V_{\pi}}{4}$  \\
            \hline 
            $-\dfrac{V_{\pi}}{2}$ & max & min \\
            \hline
            $-\dfrac{V_{\pi}}{2}$ & min & max \\ 
            \hline
        \end{tabular}
        }
    \end{table}

But the result is the following:

enter image description here

I'd like that the diagonal line coincided with both corners. I have found many solutions for a wider cell, but nothing for a higher cell, and if I try to change the wide of the cell (with \backslashbox[width]) it is the same result. Thank you in advance.

Josemi
  • 266

1 Answers1

1

With the help of diagbox and a combination of cellspace and \arraystretch:

enter image description here

\documentclass{article}
\usepackage{diagbox}
\usepackage{amsmath}
\usepackage{cellspace}
\setlength\cellspacetoplimit{6pt}
\setlength\cellspacebottomlimit{6pt}
\begin{document}

\begin{table}[h!]
        \centering
            \renewcommand{\arraystretch}{1.5}
        \begin{tabular}{*{3}{|Sc}|}
            \hline
            \multicolumn{1}{|c|}{\backslashbox{$V_b$}{$V_1$}} & \multicolumn{1}{c|}{$-\dfrac{V_{\pi}}{4}$} & \multicolumn{1}{c|}{$\dfrac{V_{\pi}}{4}$}  \\
            \hline 
            $-\dfrac{V_{\pi}}{2}$ & max & min \\
            \hline
            $-\dfrac{V_{\pi}}{2}$ & min & max \\ 
            \hline
        \end{tabular}
\end{table}
\end{document}
leandriis
  • 62,593