我使用 Rmarkdown,并尝试在两个表格下方添加注释,让它们并排显示。我设法让它们仅在没有“注释”时并排显示。如果我添加注释,表格会一个在另一个下方显示,注释会出现在第二个表格的末尾。
这是 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}
有人能帮我解决这个问题吗?
谢谢!
答案1
以下是您的表格的三个略有不同的版本。其中之一可能适合您的需求:
\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}