1

I use Rmarkdown and I am trying to put a note below two tables that I want them to appear next to each other. I manage to make appear them next to each other only when the "note" is not there. If I add the note, the tables appear one below the other and the note appear at the end of the second table.

This is the code in Rmarkdown:

\documentclass{article}
\usepackage{booktabs, caption}
\usepackage{float}
\usepackage[flushleft]{threeparttable}


\begin{document}

\begin{table}[H]
\centering
\begin{threeparttable}
\caption{Estimated Wordscores in the Training Model}
\begin{tabular}{lr}
\toprule
\label{tab: first}
  & $Hawkish$\\
\midrule
budget balance & $-0.21$\\
rebuild fiscal buffer &  $-0.71$\\
fiscal consolidation &  $-0.93$\\
get their house in order & $-0.22$\\
avoid any procyclical bias & $-0.21$\\
expenditure restraint & $-0.75$\\
budget retrenchment & $-0.21$\\
no case for fiscal activism  & $-0.21$\\
debt sustainability & $-0.70$\\
deficit reduction & $-0.82$\\
structural adjustment & $-0.82$\\
\bottomrule
\end{tabular}
\begin{tabular}{lr}
\toprule
  & $Dovish$\\
\midrule
domestic demand & $0.75$\\
fiscal space & $0.84$\\
government expenditure & $0.53$\\
job creation & $0.18$\\
flexibility & $0.24$\\
automatic stabiliser & $0.51$\\
public investment & $0.91$\\
public sector & $0.54$\\
fiscal union & $0.68$\\
growth friendly & $0.71$\\
ease social hardship & $0.86$\\
\bottomrule
\end{tabular}
\begin{tablenotes}
\small
\item \textit{Note}: The table shows the estimated wordscores of the reference texts. A negative score means that the word is a fiscally hawkish word, while a positive score indicates a fiscally dovish one.
\end{tablenotes}
\end{threeparttable}
\end{table}

\end{document}

Can anyone help me sort this out?

Thanks!

7
  • 1
    Please make your code compilable by adding the documentclass as well as the relevant packages.
    – leandriis
    Commented Apr 26, 2020 at 13:58
  • Would it be an option to combine both tabular environments to just one? Or do you want to add individual captions later on? How is your question related to beamer? Is this the documentclass you use? If so, how did you manage to fit the two tables into the same frame?
    – leandriis
    Commented Apr 26, 2020 at 14:03
  • @leandriis I added the missing info. It should be reproducible now. Sorry about it. Ideally I want a unique tabular with a unique note below. If you remove the necessary code for the note, you will get that the two table appear next to each other
    – Rollo99
    Commented Apr 26, 2020 at 14:06
  • 1
    I'd suggest using a single tabular with 4 columns instead of two tabulars with 2 columns each. Do you also want to keep the small gap in the horizontal lines? I have edited the tags and removed beamer since you don't seem to use it here.
    – leandriis
    Commented Apr 26, 2020 at 14:10
  • @leandriis Right, I will try that. Beamer was useless indeed! Sorry
    – Rollo99
    Commented Apr 26, 2020 at 14:12

1 Answer 1

1

Here are three slightly different versions of your table. Probably one of them suits your needs:

enter image description here

\documentclass{article}
\usepackage{booktabs, caption}
\usepackage{float}
\usepackage[flushleft]{threeparttable}
\usepackage{siunitx}
\begin{document}

\begin{table}[H]
\centering
\begin{threeparttable}
\caption{Estimated Wordscores in the Training Model}
\begin{tabular}{lrlr}
\toprule
\label{tab: first}
  & Hawkish &   & Dovish\\
\midrule
budget balance & $-0.21$ & domestic demand & $0.75$\\
rebuild fiscal buffer &  $-0.71$ & fiscal space & $0.84$\\
fiscal consolidation &  $-0.93$ & government expenditure & $0.53$\\
get their house in order & $-0.22$ & job creation & $0.18$\\
avoid any procyclical bias & $-0.21$ & flexibility & $0.24$\\
expenditure restraint & $-0.75$ & automatic stabiliser & $0.51$\\
budget retrenchment & $-0.21$ & public investment & $0.91$\\
no case for fiscal activism  & $-0.21$ & public sector & $0.54$\\
debt sustainability & $-0.70$ & fiscal union & $0.68$\\
deficit reduction & $-0.82$ & growth friendly & $0.71$\\
structural adjustment & $-0.82$ & ease social hardship & $0.86$\\
\bottomrule
\end{tabular}
\begin{tablenotes}
\small
\item \textit{Note}: The table shows the estimated wordscores of the reference texts. A negative score means that the word is a fiscally hawkish word, while a positive score indicates a fiscally dovish one.
\end{tablenotes}
\end{threeparttable}
\end{table}


\begin{table}[H]
\centering
\begin{threeparttable}
\caption{Estimated Wordscores in the Training Model}
\begin{tabular}{lS[table-format=-1.2]lS[table-format=1.2]}
\toprule
\label{tab: first}
  & {\textit{Hawkish}} &   & {\textit{Dovish}}\\
\midrule
budget balance & -0.21 & domestic demand & 0.75\\
rebuild fiscal buffer &  -0.71 & fiscal space & 0.84\\
fiscal consolidation &  -0.93 & government expenditure & 0.53\\
get their house in order & -0.22 & job creation & 0.18\\
avoid any procyclical bias & -0.21 & flexibility & 0.24\\
expenditure restraint & -0.75 & automatic stabiliser & 0.51\\
budget retrenchment & -0.21 & public investment & 0.91\\
no case for fiscal activism  & -0.21 & public sector & 0.54\\
debt sustainability & -0.70 & fiscal union & 0.68\\
deficit reduction & -0.82 & growth friendly & 0.71\\
structural adjustment & -0.82 & ease social hardship & 0.86\\
\bottomrule
\end{tabular}
\begin{tablenotes}
\small
\item \textit{Note}: The table shows the estimated wordscores of the reference texts. A negative score means that the word is a fiscally hawkish word, while a positive score indicates a fiscally dovish one.
\end{tablenotes}
\end{threeparttable}
\end{table}


\begin{table}[H]
\centering
\begin{threeparttable}
\caption{Estimated Wordscores in the Training Model}
\begin{tabular}{@{}lS[table-format=-1.2]@{\hspace{4\tabcolsep}}lS[table-format=1.2]@{}}
\toprule
\label{tab: first}
  & {\textit{Hawkish}} &   & {\textit{Dovish}}\\
\midrule
budget balance & -0.21 & domestic demand & 0.75\\
rebuild fiscal buffer &  -0.71 & fiscal space & 0.84\\
fiscal consolidation &  -0.93 & government expenditure & 0.53\\
get their house in order & -0.22 & job creation & 0.18\\
avoid any procyclical bias & -0.21 & flexibility & 0.24\\
expenditure restraint & -0.75 & automatic stabiliser & 0.51\\
budget retrenchment & -0.21 & public investment & 0.91\\
no case for fiscal activism  & -0.21 & public sector & 0.54\\
debt sustainability & -0.70 & fiscal union & 0.68\\
deficit reduction & -0.82 & growth friendly & 0.71\\
structural adjustment & -0.82 & ease social hardship & 0.86\\
\bottomrule
\end{tabular}
\begin{tablenotes}
\small \setlength\labelsep{0pt}
\item \textit{Note}: The table shows the estimated wordscores of the reference texts. A negative score means that the word is a fiscally hawkish word, while a positive score indicates a fiscally dovish one.
\end{tablenotes}
\end{threeparttable}
\end{table}


\end{document}
1
  • Impressive! Thanks a lot!
    – Rollo99
    Commented Apr 26, 2020 at 14:21

You must log in to answer this question.

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