2

I want to make table as below.

\documentclass{article}
\usepackage[left=4cm,right=3cm,top=4cm,bottom=3cm]{geometry}
\usepackage{amsmath}
\usepackage{slashbox}
\begin{document}
    \begin{table}[h!]
        \centering
        \caption{$(a_1,b_1)+(a_2,b_2)\in \boldsymbol{\cdot}$}
        \begin{tabular}{|c|c|c|c|c|c|}
            \hline
            \backslashbox{\tabular{@{}l@{}}$(a_1,b_1)\in\boldsymbol{\cdot} $\endtabular}{$(a_2,b_2)\in\boldsymbol{\cdot}$}&$\{(0,0)\}$&$\mathcal{A}_1$&$\mathcal{A}_2$&$\mathcal{A}_3$&$\mathcal{A}_4$\\
            \hline
            $\{(0,0)\}$&$\{(0,0)\}$&$\mathcal{A}_1$&$\mathcal{A}_2$&$\mathcal{A}_3$&$\mathcal{A}_4$\\
            \hline
            $\mathcal{A}_1$&$\mathcal{A}_1$&$\{(0,0)\},\mathcal{A}_4$&$\mathcal{A}_3$&$\mathcal{A}_2$&$\mathcal{A}_1$\\
            \hline
            $\mathcal{A}_2$&$\mathcal{A}_2$&$\mathcal{A}_3$&$\{(0,0)\},\mathcal{A}_4$&$\mathcal{A}_1$&$\mathcal{A}_2$\\
            \hline
            $\mathcal{A}_3$&$\mathcal{A}_3$&$\mathcal{A}_2$&$\mathcal{A}_1$&$\{(0,0)\},\mathcal{A}_4$&$\mathcal{A}_3$\\
            \hline
            $\mathcal{A}_4$&$\mathcal{A}_4$&$\mathcal{A}_1$&$\mathcal{A}_2$&$\mathcal{A}_3$&$\{(0,0)\},\mathcal{A}_4$\\
            \hline
        \end{tabular}
        \label{tabelbukti15}
    \end{table}
\end{document}

The result is

enter image description here

Now, I want to increase row height of first row and decrease column width of first column like this picture: enter image description here

I have tried use this code

\documentclass{article}
\usepackage[left=4cm,right=3cm,top=4cm,bottom=3cm]{geometry}
\usepackage{amsmath}
\usepackage{slashbox}
\begin{document}
    \begin{table}[h!]
        \centering
        \caption{$(a_1,b_1)+(a_2,b_2)\in \boldsymbol{\cdot}$}
        \begin{tabular}{|p{3cm}|c|c|c|c|c|}
            \hline
            \backslashbox{\tabular{@{}l@{}}$(a_1,b_1)\in\boldsymbol{\cdot} $\endtabular}{$(a_2,b_2)\in\boldsymbol{\cdot}$}&$\{(0,0)\}$&$\mathcal{A}_1$&$\mathcal{A}_2$&$\mathcal{A}_3$&$\mathcal{A}_4$\\[1cm]
            \hline
            $\{(0,0)\}$&$\{(0,0)\}$&$\mathcal{A}_1$&$\mathcal{A}_2$&$\mathcal{A}_3$&$\mathcal{A}_4$\\
            \hline
            $\mathcal{A}_1$&$\mathcal{A}_1$&$\{(0,0)\},\mathcal{A}_4$&$\mathcal{A}_3$&$\mathcal{A}_2$&$\mathcal{A}_1$\\
            \hline
            $\mathcal{A}_2$&$\mathcal{A}_2$&$\mathcal{A}_3$&$\{(0,0)\},\mathcal{A}_4$&$\mathcal{A}_1$&$\mathcal{A}_2$\\
            \hline
            $\mathcal{A}_3$&$\mathcal{A}_3$&$\mathcal{A}_2$&$\mathcal{A}_1$&$\{(0,0)\},\mathcal{A}_4$&$\mathcal{A}_3$\\
            \hline
            $\mathcal{A}_4$&$\mathcal{A}_4$&$\mathcal{A}_1$&$\mathcal{A}_2$&$\mathcal{A}_3$&$\{(0,0)\},\mathcal{A}_4$\\
            \hline
        \end{tabular}
        \label{tabelbukti15}
    \end{table}
\end{document}

And the result is not as expected.

enter image description here

How to increase row height of first row and decrease column width of first column in the table same as the picture I want?

1

Here is a solution with the package nicematrix which provides a built-in command \diagbox in its environments {NiceTabular} and {NiceArray}.

\documentclass{article}
\usepackage[left=4cm,right=3cm,top=4cm,bottom=3cm]{geometry}
\usepackage{amsmath}
\usepackage{nicematrix}
\begin{document}
\begin{table}[h!]
\centering
\caption{$(a_1,b_1)+(a_2,b_2)\in \boldsymbol{\cdot}$}
\renewcommand{\arraystretch}{1.4}
\[\begin{NiceArray}{wc{3cm}ccccc}[hvlines]
    \rule[-4mm]{0pt}{1.1cm}
    \diagbox{(a_1,b_1)\in\boldsymbol{\cdot}}{(a_2,b_2)\in\boldsymbol{\cdot}}&\{(0,0)\}&\mathcal{A}_1&\mathcal{A}_2&\mathcal{A}_3&\mathcal{A}_4\\
    \{(0,0)\}&\{(0,0)\}&\mathcal{A}_1&\mathcal{A}_2&\mathcal{A}_3&\mathcal{A}_4\\
    \mathcal{A}_1&\mathcal{A}_1&\{(0,0)\},\mathcal{A}_4&\mathcal{A}_3&\mathcal{A}_2&\mathcal{A}_1\\
    \mathcal{A}_2&\mathcal{A}_2&\mathcal{A}_3&\{(0,0)\},\mathcal{A}_4&\mathcal{A}_1&\mathcal{A}_2\\
    \mathcal{A}_3&\mathcal{A}_3&\mathcal{A}_2&\mathcal{A}_1&\{(0,0)\},\mathcal{A}_4&\mathcal{A}_3\\
    \mathcal{A}_4&\mathcal{A}_4&\mathcal{A}_1&\mathcal{A}_2&\mathcal{A}_3&\{(0,0)\},\mathcal{A}_4\\
\end{NiceArray}\]
\label{tabelbukti15}
\end{table}
\end{document}

You need several compilations (because niceamtrix uses PGF/Tikz nodes).

Output of the above code

1

I wouldn't use slashbox, instead it I would rather redesign your table as follows:

\documentclass{article}
\usepackage[hmargin={4cm,3cm}, vmargin={4cm,3cm}]{geometry}
\usepackage{amsmath}
\usepackage[table]{xcolor}

\begin{document}
    \begin{table}[h!]
\caption{$(a_1,b_1)+(a_2,b_2)\in \boldsymbol{\cdot}$}
        \label{tabelbukti15}
    \centering
    \renewcommand\arraystretch{1.5}
    \vskip-\abovedisplayskip
\[
\begin{array}{|*{6}{c|}}
    \hline
    & \multicolumn{5}{c|}{(a_2,b_2)\in\bullet}   \\
    \cline{2-6}
(a_2,b_2)\in\bullet
    &   \{(0,0)\}
        &   \mathcal{A}_1
            &   \mathcal{A}_2
                &   \mathcal{A}_3
                    &   \mathcal{A}_4           \\
    \hline
\{(0,0)\}
    &   \cellcolor{gray!30}{\{(0,0)\}}
        &   \mathcal{A}_1
            &   \mathcal{A}_2
                &   \mathcal{A}_3
                    &   \mathcal{A}_4           \\
            \hline
\mathcal{A}_1
    &   \mathcal{A}_1
        &   \cellcolor{gray!30}{\{(0,0)\},\mathcal{A}_4}
            &   \mathcal{A}_3
                &   \mathcal{A}_2
                    &   \mathcal{A}_1           \\
    \hline
\mathcal{A}_2
    &   \mathcal{A}_2
        &   \mathcal{A}_3
            &   \cellcolor{gray!30}{\{(0,0)\},\mathcal{A}_4}
                &   \mathcal{A}_1
                    &   \mathcal{A}_2           \\
    \hline
\mathcal{A}_3
    &   \mathcal{A}_3
        &   \mathcal{A}_2
            &   \mathcal{A}_1
                &   \cellcolor{gray!30}{\{(0,0)\},\mathcal{A}_4}
                    &   \mathcal{A}_3           \\
    \hline
\mathcal{A}_4
    &   \mathcal{A}_4
        &   \mathcal{A}_1
            &   \mathcal{A}_2
                &   \mathcal{A}_3
                    &   \cellcolor{gray!30}{\{(0,0)\},\mathcal{A}_4}\\

    \hline
\end{array}
\]
    \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.