1

I would like to render two tables side by side. Thus, I started to use the subtable environment. The below is the MWE and the problem is that the tables are not side by side and the captions are not aligned as shown at the enclosed figure:

\documentclass{article}

\usepackage{booktabs}

\usepackage[flushleft]{threeparttable}

\usepackage{cuted}
\usepackage{diagbox}
\usepackage{slashbox}
\usepackage{subcaption}

\begin{document}

\begin{table}[!htb]
\caption{Results of Entropy}
    \begin{footnotesize}
      \begin{threeparttable}
    \begin{subtable}{.5\linewidth}
      \centering
      \caption{(N\tnote{a}=17)}
\begin{tabular}{|l|l|l|l|}
        \toprule
 \hline
   & a & b  \\
 \hline\hline
         \midrule
 Entropy \tnote{b} & 2.1 & 3.34\\
 \hline
  \bottomrule
 \hline
\end{tabular}
    \end{subtable}

    \begin{subtable}{.5\linewidth}
      \centering
       \caption{ (N\tnote{a}=1696)}
\begin{tabular}{|l|l|l|l|}
        \toprule

 \hline
   & a & b  \\
   \hline\hline
            \midrule

 Entropy \tnote{b} & 6.76 & 8.9 \\
 \hline
 \bottomrule

 \hline
\end{tabular}
    \end{subtable}


      \begin{tablenotes}\tiny
        \item[a] Number of queries.
        \item[b] Total acquired entropy
      \end{tablenotes}
    \end{threeparttable}

\end{footnotesize}

\end{table}

 \end{document} 

enter image description here

  • 1
    just as if you used two x if you put a blank line between them they are in separate paragraphs so stack vertically, if you put a linebreak between them then you get a word space (so no room for two subtable that are .5\textwidth, you need no space at all between them to fit two on a line. – David Carlisle Jul 21 '17 at 14:12
  • @DavidCarlisle Alright, but the captions arent aligned yet and I want a little bit of space between two tables. They are too close. – lonesome Jul 21 '17 at 14:18
  • if you want space between them, add some space , eg \hfill and make them less than .5\textwidth wide, if they are both that wide there is no space for space between them – David Carlisle Jul 21 '17 at 14:45
1

threeparttable tries hard to catch tabular environments inside it and also \caption commands.

You can do without it:

\documentclass{article}

\usepackage{booktabs}
\usepackage[flushleft]{threeparttable}
\usepackage{subcaption}

\begin{document}

\begin{table}[!htbp]
\renewcommand{\tnote}[1]{\textsuperscript{#1}}

\caption{Results of Entropy}

\subcaptionbox{(N\tnote{a}=17)}[.45\textwidth]{%
  \centering
  \begin{tabular}{llll}
  \toprule
    & a & b  \\
  \midrule
  Entropy\tnote{b} & 2.1 & 3.34\\
  \bottomrule
  \end{tabular}%
}
\subcaptionbox{(N\tnote{a}=1696)}[.45\textwidth]{%
  \centering
  \begin{tabular}{llll}
  \toprule
    & a & b  \\
  \midrule
  Entropy\tnote{b} & 6.76 & 8.9 \\
  \bottomrule
  \end{tabular}%
}

\begin{tablenotes}
  \item[a] Number of queries.
  \item[b] Total acquired entropy
\end{tablenotes}

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