3

I am having trouble with my table borders again. I want to produce something like this: enter image description here

or like this: enter image description here

But I keep getting this: enter image description here

These are my commands:

    \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}
  • 1
    \multicolumn{2}{c} should be \multicolumn{2}{c|} as you want a rule after the span – David Carlisle Mar 25 '14 at 15:13
2

Try this:

\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}
  • You may want to replace \begin{center} with \centering and omit the \end{center} instruction. Doing so will avoid the insertion of unwanted (vertical) whitespace. – Mico Mar 25 '14 at 16:39
0

Another solution and a different look might be of interest: the last two columns have equal (minimal) width and the data are centred.

        \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} 

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.