我有下表:
\documentclass[a4paper,11pt]{article}
\usepackage{caption}
\usepackage{lscape} % Package allowing to put your text in landscape
\usepackage{longtable,pdflscape}
\captionsetup[table]{font={stretch=1}} %% change 1.2 as you like
\captionsetup[figure]{font={stretch=1}} %% change 1.2 as you like
\usepackage{threeparttable}
\usepackage{booktabs}
\usepackage{rotating}
\usepackage{tabularx}
\usepackage{makecell}
\usepackage{float}
\begin{document}
\begin{table}[H]
\captionsetup{font=large, labelfont=bf}
\centering
\setlength{\tabcolsep}{5pt}
\setlength{\extrarowheight}{1pt}
\begin{threeparttable}
\caption{Sample of $N$-grams and Unigrams for Each Topic}
\label{tab: tab00002}
\begin{tabular}{cccccccc}
\toprule
\multicolumn{2}{c}{\textbf{Monetary Policy}} & & \multicolumn{2}{c}{\textbf{Economic Outlook}} & & \multicolumn{2}{c}{\textbf{Inflation Outlook}} \\
\midrule
\multicolumn{1}{c}{Dovish} & \multicolumn{1}{c}{Hawkish} & &\multicolumn{1}{c}{Positive} & \multicolumn{1}{c}{Negative} & &\multicolumn{1}{c}{Positive} & \multicolumn{1}{c}{Negative}\\
\cline{1-2}\cline{4-5}\cline{7-8} \\
favourable lending conditions & higher commodity prices & & stronger than expected & negative cyclical momentum & & tighter labour markets & fall below \tabularnewline
additional asset purchases & increase interest rates & & growth momentum & heightened uncertainty & & higher energy price & lower wage pressures \tabularnewline
accommodative stance & inflationary pressure & & positive outlook & revised downwards & & higher inflation & disappointing \tabularnewline
increase the envelope & strong fundamentals & & revised upwards & downside risks & & solid wage growth & higher unemployment \tabularnewline
reduce interest rates & counter upside risks & & strong recovery & vulnerabilities & & build up & unutilised capacity \tabularnewline
heightened alertness & rise in inflation & & encouraging & decelerating & & higher pressure & lower unit labour costs \tabularnewline
extension of credit & end purchases & & upswing & disequilibria & & stronger than expected & lower oil prices \tabularnewline
liquidity provision & winding down & & impetus & contracting & & upside risks & contained \tabularnewline
weakening & rising wages & & surging & headwinds & & fast growing & muted \tabularnewline
subdued & withdrawal & & upturn & softening & & second round effects & sluggish \tabularnewline
\bottomrule
\end{tabular}
\begin{tablenotes}[flushleft]
\small
\item\hskip -\fontdimen2\font\textit{Note}: The table shows a sample of $n$-grams and unigrams for each ECB field-specific dictionary.
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}
问题是表格太宽,无法在论文中显示,而且我不希望它水平显示。我想要做的是,将 3 个主列改为 1 个主列,主列彼此叠放。基本上,一个表格叠放在另一个表格下面。
有人能帮我做吗?
多谢!
答案1
这是您表格的两个版本,具有所需的布局。但就我个人而言,我不会将内容居中。
\documentclass[a4paper,11pt]{article}
\usepackage{caption}
\usepackage{threeparttable}
\usepackage{booktabs}
\usepackage{array}
\begin{document}
\begin{table}
\captionsetup{font=large, labelfont=bf}
\centering
\small
\begin{threeparttable}
\caption{Sample of $N$-grams and Unigrams for Each Topic}
\label{tab: tab00002}
\begin{tabular}{cc}
\toprule
\multicolumn{2}{c}{\textbf{Monetary Policy}} \\
\midrule
\multicolumn{1}{c}{Dovish} & \multicolumn{1}{c}{Hawkish} \\
\midrule
favourable lending conditions & higher commodity prices \tabularnewline
additional asset purchases & increase interest rates \tabularnewline
accommodative stance & inflationary pressure \tabularnewline
increase the envelope & strong fundamentals \tabularnewline
reduce interest rates & counter upside risks \tabularnewline
heightened alertness & rise in inflation \tabularnewline
extension of credit & end purchases \tabularnewline
liquidity provision & winding down \tabularnewline
weakening & rising wages \tabularnewline
subdued & withdrawal \tabularnewline
\midrule
\multicolumn{2}{c}{\textbf{Economic Outlook}}\\
\midrule
\multicolumn{1}{c}{Positive} & \multicolumn{1}{c}{Negative} \\
\midrule
stronger than expected & negative cyclical momentum \tabularnewline
growth momentum & heightened uncertainty \tabularnewline
positive outlook & revised downwards \tabularnewline
revised upwards & downside risks \tabularnewline
strong recovery & vulnerabilities \tabularnewline
encouraging & decelerating \tabularnewline
upswing & disequilibria \tabularnewline
impetus & contracting \tabularnewline
surging & headwinds\tabularnewline
upturn & softening \tabularnewline
\midrule
\multicolumn{2}{c}{\textbf{Inflation Outlook}} \\
\midrule
\multicolumn{1}{c}{Positive} & \multicolumn{1}{c}{Negative}\\
\midrule
tighter labour markets & fall below \tabularnewline
higher energy price & lower wage pressures \tabularnewline
higher inflation & disappointing \tabularnewline
solid wage growth & higher unemployment \tabularnewline
build up & unutilised capacity \tabularnewline
higher pressure & lower unit labour costs \tabularnewline
stronger than expected & lower oil prices \tabularnewline
upside risks & contained \tabularnewline
fast growing & muted \tabularnewline
second round effects & sluggish \tabularnewline
\bottomrule
\end{tabular}
\begin{tablenotes}[flushleft]
\small
\item\hskip -\fontdimen2\font\textit{Note}: The table shows a sample of $n$-grams and unigrams for each ECB field-specific dictionary.
\end{tablenotes}
\end{threeparttable}
\end{table}
\begin{table}
\captionsetup{font=large, labelfont=bf}
\centering
\begin{threeparttable}
\caption{Sample of $N$-grams and Unigrams for Each Topic}
\label{tab: tab00002}
\begin{tabular}{*{2}{wc{0.4\linewidth}}}
\toprule
\multicolumn{2}{c}{\textbf{Monetary Policy}} \\
\midrule
\multicolumn{1}{c}{Dovish} & \multicolumn{1}{c}{Hawkish} \\
\midrule
favourable lending conditions & higher commodity prices \tabularnewline
additional asset purchases & increase interest rates \tabularnewline
accommodative stance & inflationary pressure \tabularnewline
increase the envelope & strong fundamentals \tabularnewline
reduce interest rates & counter upside risks \tabularnewline
heightened alertness & rise in inflation \tabularnewline
extension of credit & end purchases \tabularnewline
liquidity provision & winding down \tabularnewline
weakening & rising wages \tabularnewline
subdued & withdrawal \tabularnewline
\midrule
\multicolumn{2}{c}{\textbf{Economic Outlook}}\\
\midrule
\multicolumn{1}{c}{Positive} & \multicolumn{1}{c}{Negative} \\
\midrule
stronger than expected & negative cyclical momentum \tabularnewline
growth momentum & heightened uncertainty \tabularnewline
positive outlook & revised downwards \tabularnewline
revised upwards & downside risks \tabularnewline
strong recovery & vulnerabilities \tabularnewline
encouraging & decelerating \tabularnewline
upswing & disequilibria \tabularnewline
impetus & contracting \tabularnewline
surging & headwinds\tabularnewline
upturn & softening \tabularnewline
\midrule
\multicolumn{2}{c}{\textbf{Inflation Outlook}} \\
\midrule
\multicolumn{1}{c}{Positive} & \multicolumn{1}{c}{Negative}\\
\midrule
tighter labour markets & fall below \tabularnewline
higher energy price & lower wage pressures \tabularnewline
higher inflation & disappointing \tabularnewline
solid wage growth & higher unemployment \tabularnewline
build up & unutilised capacity \tabularnewline
higher pressure & lower unit labour costs \tabularnewline
stronger than expected & lower oil prices \tabularnewline
upside risks & contained \tabularnewline
fast growing & muted \tabularnewline
second round effects & sluggish \tabularnewline
\bottomrule
\end{tabular}
\begin{tablenotes}[flushleft]
\small
\item\hskip -\fontdimen2\font\textit{Note}: The table shows a sample of $n$-grams and unigrams for each ECB field-specific dictionary.
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}
这是表格的另一种布局,也可以纵向放置在单个页面上:
\documentclass[a4paper,11pt]{article}
\usepackage[english]{babel}
\usepackage{caption}
\usepackage{threeparttable}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{ragged2e}
\usepackage{enumitem}
\newlist{tabitem}{itemize}{1}
\setlist[tabitem]{label=--, noitemsep,leftmargin=*,topsep=0pt,partopsep=0pt, nosep, before=\begin{minipage}[t]{\hsize}, after=\end{minipage}}
\begin{document}
\begin{table}
\captionsetup{font=large, labelfont=bf}
\setlength{\tabcolsep}{4pt}
\centering
\begin{threeparttable}
\caption{Sample of $N$-grams and Unigrams for Each Topic}
\label{tab: tab00002}
\begin{tabularx}{\linewidth}{@{}*{3}{>{\RaggedRight\arraybackslash}X}@{}}
\toprule
\multicolumn{1}{c}{\textbf{Monetary Policy}} & \multicolumn{1}{c}{\textbf{Economic Outlook}} & \multicolumn{1}{c}{\textbf{Inflation Outlok}} \\
\cmidrule(r){1-1} \cmidrule(lr){2-2} \cmidrule(l){3-3}
\multicolumn{1}{c}{Dovish} & \multicolumn{1}{c}{Positive} & \multicolumn{1}{c}{Positive} \\
\cmidrule(r){1-1} \cmidrule(lr){2-2} \cmidrule(l){3-3}
\begin{tabitem}
\item favourable lending conditions
\item additional asset purchases
\item accommodative stance
\item increase the envelope
\item reduce interest rates
\item heightened alertness
\item extension of credit
\item liquidity provision
\item weakening
\item subdued
\end{tabitem}
&
\begin{tabitem}
\item stronger than expected
\item growth momentum
\item positive outlook
\item revised upwards
\item strong recovery
\item encouraging
\item upswing
\item impetus
\item surging
\item upturn
\end{tabitem}
&
\begin{tabitem}
\item tighter labour markets
\item higher energy price
\item higher inflation
\item solid wage growth
\item build up
\item higher pressure
\item stronger than expected
\item upside risks
\item fast growing
\item second round effects
\end{tabitem}
\\
\cmidrule(r){1-1} \cmidrule(lr){2-2} \cmidrule(l){3-3}
\multicolumn{1}{c}{Hawkish} & \multicolumn{1}{c}{Negative} & \multicolumn{1}{c}{Negative} \\
\cmidrule(r){1-1} \cmidrule(lr){2-2} \cmidrule(l){3-3}
\begin{tabitem}
\item higher commodity prices
\item increase interest rates
\item inflationary pressure
\item strong fundamentals
\item counter upside risks
\item rise in inflation
\item end purchases
\item winding down
\item rising wages
\item withdrawal
\end{tabitem}
&
\begin{tabitem}
\item negative cyclical momentum
\item heightened uncertainty
\item revised downwards
\item downside risks
\item vulnerabilities
\item decelerating
\item disequilibria
\item contracting
\item headwinds
\item softening
\end{tabitem}
&
\begin{tabitem}
\item fall below
\item lower wage pressures
\item disappointing
\item higher unemployment
\item unutilised capacity
\item unit labour costs
\item lower oil prices
\item contained
\item muted
\item sluggish
\end{tabitem}
\\
\bottomrule
\end{tabularx}
\begin{tablenotes}[flushleft]
\small
\item\hskip -\fontdimen2\font\textit{Note}: The table shows a sample of $n$-grams and unigrams for each ECB field-specific dictionary.
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}
答案2
我会允许单元格中有换行符。我还会切换到横向格式,以便让换行符的数量可控。最后,我会将单元格内容左对齐,而不是居中。
\documentclass[a4paper,11pt]{article}
\usepackage[margin=2.5cm]{geometry}
\usepackage{caption}
\usepackage{threeparttable}
\usepackage{booktabs}
\usepackage{rotating}
\usepackage{tabularx,ragged2e}
%% Left-aligned cell contents, automatic
%% line-breaking w/ hanging indentation
\newcolumntype{L}{>{\RaggedRight\hangafter=1\hangindent=1em}X}
\begin{document}
\begin{sidewaystable}
\captionsetup{font=large, labelfont=bf, skip=0.5\baselineskip}
\setlength{\tabcolsep}{4pt} % default: 6pt
\begin{threeparttable}
\caption{Sample of $n$-grams and unigrams for each topic}
\label{tab:tab00002}
\begin{tabularx}{\textwidth}{@{} *{6}{L} @{}}
\toprule
\multicolumn{2}{c}{Monetary Policy} &
\multicolumn{2}{c}{Economic Outlook} &
\multicolumn{2}{c@{}}{Inflation Outlook} \\
\cmidrule(r){1-2} \cmidrule(lr){3-4} \cmidrule(l){5-6} \\
Dovish & Hawkish & Positive & Negative & Positive & Negative \\
\midrule
favourable lending conditions & higher commodity prices &
stronger than expected & negative cyclical momentum &
tighter labour markets & fall below \\ \addlinespace
additional asset purchases & increase interest rates &
growth momentum & heightened uncertainty &
higher energy price & lower wage pressures \\ \addlinespace
accommodative stance & inflationary pressure &
positive outlook & revised downwards &
higher inflation & disappointing \\ \addlinespace
increase the envelope & strong fundamentals &
revised upwards & downside risks &
solid wage growth & higher unemployment \\ \addlinespace
reduce interest rates & counter upside risks &
strong recovery & vulnerabilities &
build up & unutilised capacity \\ \addlinespace
heightened alertness & rise in inflation &
encouraging & decelerating &
higher pressure & lower unit labour costs \\ \addlinespace
extension of credit & end purchases &
upswing & disequilibria &
stronger than expected & lower oil prices \\ \addlinespace
liquidity provision & winding down &
impetus & contracting &
upside risks & contained \\ \addlinespace
weakening & rising wages &
surging & headwinds &
fast growing & muted \\ \addlinespace
subdued & withdrawal &
upturn & softening &
second round effects & sluggish \\
\bottomrule
\end{tabularx}
\smallskip\small
\begin{tablenotes}[flushleft]
\item\hskip-\fontdimen2\font\textit{Note}: The table shows a sample of $n$-grams and unigrams for each ECB field-specific dictionary.
\end{tablenotes}
\end{threeparttable}
\end{sidewaystable}
\end{document}