2

I need a Table as shown in the attached image file. Could you help me to generate this table according to the image file. Thank you in advance.

enter image description here

\documentclass[]{article}
%\usepackage{booktabs}
\begin{document}

\begin{table}[htbp]
    \centering
    \caption{caption}   \label{tab:1}%
    \begin{tabular}{|p{2cm}|p{2cm}|}
        \hline
        A     & B \\
        \hline
        X     & 10 \\
        \hline
        Y     & 20 \\
        \hline
        Z     & 30 \\
        \hline
        P     & 33 \\
        \hline
    \end{tabular}%
\end{table}%
\end{document}
1

1 Answer 1

3

With {NiceTabular} of nicematrix.

\documentclass[]{article}
\usepackage{nicematrix}

\begin{document}

\begin{table}[htbp]
    \centering
    \caption{caption}   \label{tab:1}%
    \begin{NiceTabular}{p{2cm}p{2cm}}[hvlines]
        A     & B \\
        X     & 10 \\
        Y     & 20 \\
        Z     & 30 \\
    \Block[l,draw,line-width=1pt]{}{P}
&   \Block[l,draw,line-width=1pt]{}{33}
    \end{NiceTabular}%
\end{table}%
\end{document}

Output of the above code

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .