Adjust backslashbox to a different arraystretch (row too high)

by Josemi   Last Updated October 09, 2019 21:23 PM - source

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.

Tags : tables


Answers 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
leandriis
October 09, 2019 21:11 PM

Related Questions


ConTeXt xtable setup format of table head

Updated September 19, 2018 10:23 AM

Creating a huge table in Latex

Updated January 24, 2019 19:23 PM

text adjustment in table

Updated March 26, 2015 08:07 AM

Fancy table of tables

Updated March 27, 2015 15:07 PM

Part of my table is not placed in the pdf output

Updated March 28, 2015 07:07 AM