Wie füge ich dieser Tabelle eine Überschrift hinzu?

Wie füge ich dieser Tabelle eine Überschrift hinzu?

Ich habe folgende Tabelle. Ich möchte ihr gerne eine Überschrift mit Titel und Nummer der Tabelle hinzufügen. Das gelingt mir aber nicht. Hier mein Code:

\begin{center}
\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}
\end{center}

Kann mir jemand helfen?

Danke!

Antwort1

Bildbeschreibung hier eingeben

\documentclass{article}
\usepackage{booktabs, caption}

\begin{document}

\begin{table}

\centering
    \caption{caption above table}
\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}
\caption{caption below table}

\end{table}



\textbf{
or minipage environment if you dont want the table to float \\ [1cm] 
}


\begin{minipage}{\linewidth}
    \centering
    \captionof{table}{Table Title} \label{tab:title} 
\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}\par
        \bigskip
        Should be a caption
    \end{minipage}
\end{document}

verwandte Informationen