problemas com bordas de tabelas - algumas estão incompletas

problemas com bordas de tabelas - algumas estão incompletas

Estou tendo problemas com as bordas da minha mesa novamente. Quero produzir algo assim: insira a descrição da imagem aqui

ou assim: insira a descrição da imagem aqui

Mas continuo recebendo isso: insira a descrição da imagem aqui

Estes são meus comandos:

    \begin{table}[ht!]
\renewcommand{\arraystretch}{1}
\small
\doublespacing
\begin{center}
    \caption{The Estimated Effect of Cultural Distance on Protectionism, Treatment Received}
    \begin{tabular}{c|c|c|}
    \cline{2-3}
    & \multicolumn{2}{c}{\textbf{Treatment Received}}\\ \cline{2-3}
    & All Respondents & Prejudiced Respondents\\ \cline{1-3}
    Culturally Foreign & 25.6 & 44.4\\ 
    Culturally Familiar & 20.0 & 19.0\\
    Difference & 5.6 & 25.4*\\
    (95\% Confidence Interval) & (-1.1 to 12.4) & (6.6 to 44.1)\\
    p-value & 0.101  & 0.009\\ \hline
\end{tabular}
\end{center}
\end{table}

Responder1

Experimente isto:

\begin{table}[ht!]
\renewcommand{\arraystretch}{1}
\small
\doublespacing
\begin{center}
\caption{The Estimated Effect of Cultural Distance on Protectionism, Treatment Received}
\begin{tabular}{c|c|c|}
\cline{2-3}
& \multicolumn{2}{c|}{\textbf{Treatment Received}}\\ \cline{2-3}
& All Respondents & Prejudiced Respondents\\ \cline{1-3}
\multicolumn{1}{|c|}{Culturally Foreign} & 25.6 & 44.4\\ 
\multicolumn{1}{|c|}{Culturally Familiar} & 20.0 & 19.0\\
\multicolumn{1}{|c|}{Difference} & 5.6 & 25.4*\\
\multicolumn{1}{|c|}{(95\% Confidence Interval)} & (-1.1 to 12.4) & (6.6 to 44.1)\\
\multicolumn{1}{|c|}{p-value} & 0.101  & 0.009\\ \hline
\end{tabular}
\end{center}
\end{table}

Responder2

Outra solução e uma aparência diferente podem ser interessantes: as duas últimas colunas têm largura igual (mínima) e os dados estão centralizados.

        \documentclass{scrartcl}%

        \usepackage[utf8]{inputenc}
        \usepackage{setspace}
        \usepackage{array}
        \usepackage{makecell}
        \newlength{\colwidth}
        \usepackage[svgnames]{xcolor}
        \usepackage{colortbl}

        \begin{document}

        \begin{table}[ht!]
        \doublespacing\centering
        \small\arrayrulecolor{SteelBlue}\arrayrulewidth = 1.2pt
        \settowidth{\colwidth}{Prejudiced Respondents}
        \caption{The Estimated Effect of Cultural Distance on Protectionism, Treatment Received}
        \begin{tabular}{r@{\color{SteelBlue}\enspace\vrule width 2pt\enspace}c @{\color{SteelBlue}\vrule width 1.2pt\ }c @{\color{SteelBlue}\vrule width 1.2pt}c}
        \multicolumn{1}{c}{}& \multicolumn{2}{c}{\textbf{Treatment Received}} & \\
        \multicolumn{1}{c@{\color{SteelBlue}\enspace\vrule width 2pt\enspace}}{} & \multicolumn{1}{c}{\makebox[\colwidth][c]{All Respondents}} & \multicolumn{1}{c}{Prejudiced Respondents}\\
        \cline{2-4}\\[-12pt]%{1.2pt}
        Culturally Foreign & 25.6 & 44.4\\
        Culturally Familiar & 20.0 & 19.0\\
        Difference & 5.6 & 25.4*\\
        (95\% Confidence Interval) & (-1.1 to 12.4) & (6.6 to 44.1)\\
        p-value & 0.101  & 0.009\\[6pt]% \cline{2-3}
        \end{tabular}
        \end{table}

        \begin{table}[ht!]
        \doublespacing\centering
        \small\arrayrulecolor{SteelBlue}\arrayrulewidth = 2pt
        \settowidth{\colwidth}{Prejudiced Respondents}
        \caption{The Estimated Effect of Cultural Distance on Protectionism, Treatment Received}
        \begin{tabular}{@{}r@{\color{SteelBlue}\enspace\vrule width 2pt\enspace}c @{\color{SteelBlue}\vrule width 1.2pt\ }c @{\color{SteelBlue}\vrule width 1.2pt}c}
        & \multicolumn{2}{c}{\textbf{Treatment Received}} &\\
        \multicolumn{1}{c@{\color{SteelBlue}\enspace\vrule width 2pt\enspace}}{} & \multicolumn{1}{c}{\makebox[\colwidth][c]{All Respondents}} & \multicolumn{1}{c}{Prejudiced Respondents}\\
        \hline\\[-12pt]%{1.2pt}{2-4}
        Culturally Foreign & 25.6 & 44.4\\
        Culturally Familiar & 20.0 & 19.0\\
        Difference & 5.6 & 25.4*\\
        (95\% Confidence Interval) & (-1.1 to 12.4) & (6.6 to 44.1)\\
        p-value & 0.101  & 0.009\\[6pt]% \cline{2-3}
        \end{tabular}
        \end{table}

    \end{document} 

insira a descrição da imagem aqui

Responder3

Para obter informações, aqui está uma maneira de criar essa tabela com {NiceTabular}of nicematrix.

\documentclass{article}
\usepackage{caption}
\usepackage{nicematrix}

\begin{document}

\begin{table}[ht!]
\small
\centering
\renewcommand{\arraystretch}{1.4}
\begin{NiceTabular}{ccc}% 
  [
    hvlines,
    corners,
    caption = {The Estimated Effect of Cultural Distance on Protectionism, Treatment Received}
  ]
& \Block{1-2}{\textbf{Treatment Received}}\\ 
& All Respondents & Prejudiced Respondents\\ 
Culturally Foreign & $25.6$ & $44.4$ \\ 
Culturally Familiar & $20.0$ & $19.0$ \\
Difference & $5.6$ & $25.4$* \\
(95\% Confidence Interval) & ($-1.1$ to $12.4$) & ($6.6$ to $44.1$)\\
p-value & 0.101  & 0.009
\end{NiceTabular}
\end{table}

\end{document}

Você precisa de várias compilações.

Saída do código acima

informação relacionada