2

I've created a table that (I think) needs \makecell{}, \multirow{}, and multicolumn{} to be displayed properly. The issue is that the spatial arrangement of my elements is not so great.

  • The lower and upper subheadings (columns 5 & 6) are not aligned properly.
  • Columns 1-4 are not placed sensibly (centered or bottom aligned would work).
  • I have to use a hack (\B) to space my \hline so that it does not overlap text of columns 3 & 4.

Any advice On what I might be doing wrong or a better approach (apologies for the single use nature of the question)?

\documentclass{article}
\usepackage{makecell, multirow, ctable}

\newcommand\B{\rule[-2.5ex]{0pt}{0pt}}

\begin{document}

\begin{table}[h]
\centering
\caption{title}
\small
\begin{tabular}{cccccc}

\specialrule{.2em}{.1em}{.1em} 
\multirow{2}{*}{Condition} & \multirow{2}{*}{\textit{N}} & \multirow{2}{*}{\makecell{Mean Proportion \\ Taxonomic  \\ Responses}} & \multirow{2}{*}{\makecell{Taxonomic \\ Responding Exact \\ Binomial Test \textit{p}}} & \multicolumn{2}{c}{\makecell{95\% Binomial \\ Confidence Intervals}} \\
\cline{5-6}
& & & & Lower & Upper \B \\ 
\hline
Alien & \textit{n} = 65 & .74 & \\ 
Alike & \textit{n} = 63 & .68 & \\
Similar & \textit{n} = 50 & .68 & \\
No Reminder & \textit{n} = 59 & .40 & \\
\hline
\end{tabular}
\label{table:e1rt}
\end{table}

\end{document}

enter image description here

0

2 Answers 2

2

Some improvements with booktabs and code simplification with \multirowcell command, since you load makecell:

\documentclass{article}
\usepackage{array}
\usepackage{makecell, multirow, booktabs}
\usepackage{caption}

\begin{document}

\begin{table}[h]
    \centering
    \caption{title}
    \footnotesize\setlength{\extrarowheight}{2pt}
    \begin{tabular}{c>{$}c<{$}cccc}
        \toprule
        \multirowcell{3}[-1pt]{Condition} & \multirowcell{3}[-1pt]{$N$} & \multirowcell{3}[-1pt]{Mean Proportion \\ Taxonomic \\ Responses}& \multirowcell{3}[-1pt]{Taxonomic \\\strut Responding Exact \\ Binomial Test $p$} & \multicolumn{2}{c}{\makecell{95\% Binomial \\ Confidence Intervals}} \\
        \cmidrule(lr){5-6}
        & & & & \multicolumn{1}{c}{Lower} & \multicolumn{1}{c}{Upper} \\
        \midrule
        Alien & n = 65 & .74 & \\
        Alike & n = 63 & .68 & \\
        Similar & n = 50 & .68 & \\
        No Reminder & n = 59 & .40 & \\
        \bottomrule
    \end{tabular}
    \label{table:e1rt}
\end{table}

\end{document} 

enter image description here

5
  • I think your solution needs \usepackage{siunitx}
    – ghonke
    Commented Oct 5, 2017 at 19:08
  • @ghonke: With the data you posted, it isn't useful: all numbers in the third column have the same number of digits, so the alignment will be automatic.
    – Bernard
    Commented Oct 5, 2017 at 19:13
  • I only mention it because the document fails to compile without it, maybe the error was something else but it seems like I isolated it to presence/absence of that package call, it throws an error here without it: \begin{tabular}{c>{$}c<{$}cccc}
    – ghonke
    Commented Oct 5, 2017 at 19:38
  • The error happens with the very code in my answer?
    – Bernard
    Commented Oct 5, 2017 at 19:42
  • Sorry, no, mistake on my end. thanks for the response it looks much better.
    – ghonke
    Commented Oct 6, 2017 at 1:32
2

I think you could improve it using booktabs:

\documentclass{article}
\usepackage{array}
\usepackage{makecell, multirow, booktabs}
\renewcommand{\arraystretch}{1.2}
\usepackage{siunitx}
\usepackage{caption}

\begin{document}
\begin{table}[h]
    \centering
    \caption{title}
    \footnotesize
    \begin{tabular}{c>{$}c<{$}S[table-format=.2,add-integer-zero=false]ccc}
        \toprule
        \multirow{2}{*}{Condition} & \multirow{2}{*}{$N$} & \multicolumn{1}{c}{\multirow{2}{*}{\makecell{Mean Proportion \\ Taxonomic  \\ Responses}}} & \multirow{2}{*}{\makecell{Taxonomic \\ Responding Exact \\ Binomial Test $p$}} & \multicolumn{2}{c}{\makecell{95\% Binomial \\ Confidence Intervals}} \\
        \cmidrule{5-6}
        & & & & \multicolumn{1}{c}{Lower} & \multicolumn{1}{c}{Upper} \\ 
        \midrule
        Alien & n = 65 & .74 & \\ 
        Alike & n = 63 & .68 & \\
        Similar & n = 50 & .68 & \\
        No Reminder & n = 59 & .40 & \\
        \bottomrule
    \end{tabular}
    \label{table:e1rt}
\end{table}
\end{document}

enter image description here

You must log in to answer this question.

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