有什么建议可以摆脱额外的空间表乳胶?
这里是代码和我的输出:
\documentclass[a4paper, 12pt]{article}
\usepackage[margin=2cm,a4paper]{geometry}
\usepackage{natbib}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage[protrusion=true,expansion=true]{microtype}
\usepackage{mathpazo}
\usepackage[mathcal]{eucal}
\usepackage[mathscr]{eucal}
\usepackage{mathrsfs}
\usepackage{lmodern}
\usepackage{textcomp}
\usepackage{mathtools, cuted}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{booktabs,dcolumn,caption}
\usepackage[font=small,labelfont={bf,sf},tableposition=top]{caption}
\usepackage{booktabs,tabularx}
\usepackage[bottom]{footmisc}
\usepackage{empheq}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{multirow}
\usepackage{mathtools}
\usepackage{array}
\usepackage{booktabs}
\usepackage{enumerate}
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage{tabulary}
\usepackage{tabularx}
\usepackage{varioref}
\usepackage{multirow}
\usepackage[skip=0.5\baselineskip,font=bf]{caption}
\usepackage[onehalfspacing]{setspace}
\usepackage{rotating}
\usepackage{siunitx}
\usepackage{booktabs, makecell, multirow, threeparttable}
\usepackage{caption}
\usepackage{xparse}
\usepackage{hyperref}
\usepackage[nameinlink,noabbrev]{cleveref}
\usepackage{xstring}
\usepackage[title]{appendix}
\begin{document}
\begin{table}[ht]
\centering
\caption{Contribution to volatility and levels of endogenous variables}
\begin{tabular}{l*{4}{c}r}
\hline
Variable & Horizon &Decomposition of volatility shocks & Decomposition of level shocks \\
\hline
\hline
GNP growth (y) & 2 Q& 34.819 & 22.206 \\
&& \textit{(23.5,28.40)}&\textit{(23.2,24.2)}\\
\cline{2-4} & 4 Q&23.901& 18.167\\
&& \textit{(15.52,18.65)}&\textit{(11.37,12.51)}\\
\cline{2-4} & 8 Q& 17.684&14.316 \\
&& \textit{(10.48,12.58)}&\textit{(8.57,9.52)}\\
\cline{2-4} & 12 Q& 9.654& 6.18\\
&& \textit{(2.08,2.48)}&\textit{(1.07,2.42)}\\
\hline
Unemployment (U) &2 Q & 8.874 & 6.245 \\
&& \textit{(9.52,12.44)}&\textit{(8.32,9.62)}\\
\cline{2-4} & 4 Q& 10.658 & 9.265 \\
&& \textit{(7.08,8.46)}&\textit{(6.82,7.22)}\\
\cline{2-4} & 8 Q& 8.840 & 6.235 \\
&& \textit{(6.32,7.02)}&\textit{(5.72,6.02)}\\
\cline{2-4} & 12 Q& 4.902 & 3.245 \\
&& \textit{(2.74,4.40)}&\textit{(1.40,3.10)}\\
\hline
Inflation (P) &2 Q & 34.736& 29.425 \\
&& \textit{(13.64,14.20)}&\textit{(12.12,13.14)}\\
\cline{2-4} & 4 Q& 27.405 & 26.278 \\
&& \textit{(13.02,12.65)}&\textit{(11.02,11.40)}\\
\cline{2-4} & 8 Q& 22.632 & 20.279 \\
&& \textit{(1.79,11.89)}&\textit{(1.62,11.72)}\\
\cline{2-4} & 12 Q& 17.893 & 15.719 \\
&& \textit{(10.24,0.40)}&\textit{(10.12,0.19)}\\
\hline
\end{tabular}
\label{tab4}
\begin{tablenotes}{\textwidth}
\small
\item Note:This table reports the changes in forecast error variances by level shocks and
volatility shock
using the VAR model with time-varying stochastic volatility.
\end{tablenotes}
\end{table}
\end{document}
答案1
一些建议和意见:
请彻底清理序言。这种矛盾的混乱绝对不会带来任何好处。很抱歉不得不使用如此严厉的言辞,但根本没有足够的委婉语可以掩盖这种情况。
为了减少桌子占用的水平空间,你可以必须允许在第 3 列和第 4 列的长标题单元格中换行。您可以手动执行此操作,也可以借助
tabularx
环境和X
列类型执行此操作。在下面的代码中,我选择了该tabularx
路线,将整体宽度设置为0.8\textwidth
。我会使用
\mathit
而不是\textit
。这样,括号将以直立形状呈现,并且 TeX 将在逗号后插入一些空格。您没有正确使用包的机制
threeparttable
。事实上,您对tablenotes
环境的使用除了造成代码混乱之外什么都没有完成。我建议取消包装tablenotes
器并使用threeparttable
环境来包裹标题、tabularx
环境和后续注释。这样,注释的宽度将被限制在环境的宽度内tabularx
。我将取消
\hline
和指令,而\cline
代之使用包的画线宏booktabs
:\toprule
,,,和。\midrule
\addlinespace
\bottomrule
\documentclass[a4paper, 12pt]{article}
\usepackage[margin=2cm]{geometry}
\usepackage{natbib}
\usepackage{mathtools,amssymb,amsthm}
\usepackage[protrusion=true,expansion=true]{microtype}
\usepackage{mathrsfs}
\usepackage{mathpazo} % or: \usepackage{lmodern}
\usepackage{textcomp} % are you sure you need this package?
\usepackage{cuted} % ditto
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{dcolumn} % ditto
\usepackage[font={small,bf},
labelfont={bf,sf},
tableposition=top,
justification=centering,
figurename=Fig.,
skip=0.333\baselineskip]{caption}
\usepackage{booktabs}
\usepackage[bottom]{footmisc}
\usepackage{empheq} % ditto
\usepackage{graphicx}
\usepackage{enumerate} % ditto
\usepackage{tabularx,tabulary}
% centered version of 'X' column type:
\newcolumntype{C}{>{\centering\arraybackslash}X}
\usepackage[onehalfspacing]{setspace}
\usepackage{rotating}
\usepackage{siunitx}
\usepackage{makecell, threeparttable}
\usepackage{xparse,xstring} % ditto
\usepackage[title]{appendix}
\usepackage{varioref}
\usepackage[colorlinks,allcolors=blue]{hyperref}
\usepackage[nameinlink,noabbrev]{cleveref}
\begin{document}
\begin{table}[ht]
\centering
\begin{threeparttable}
\caption{Contribution to volatility and levels of endogenous variables}
\label{tab4}
\begin{tabularx}{0.8\textwidth}{@{} l c C C @{}}
\toprule
Variable
& Horizon
& Decomposition of volatility shocks
& Decomposition of level shocks \\
\midrule
GNP growth (\,$y$)
& 2 Q& 34.819 & 22.206 \\
&& $\mathit{(23.5,28.40)}$ & $\mathit{(23.2,24.2)}$\\
& 4 Q& 23.901& 18.167\\
&& $\mathit{(15.52,18.65)}$ & $\mathit{(11.37,12.51)}$\\
& 8 Q& 17.684&14.316 \\
&& $\mathit{(10.48,12.58)}$ & $\mathit{(8.57,9.52)}$\\
& 12 Q& 9.654& 6.18\\
&& $\mathit{(2.08,2.48)}$ & $\mathit{(1.07,2.42)}$\\
\addlinespace
Unemployment ($U$)
& 2 Q& 8.874 & 6.245 \\
&& $\mathit{(9.52,12.44)}$ & $\mathit{(8.32,9.62)}$\\
& 4 Q& 10.658 & 9.265 \\
&& $\mathit{(7.08,8.46)}$ & $\mathit{(6.82,7.22)}$\\
& 8 Q& 8.840 & 6.235 \\
&& $\mathit{(6.32,7.02)}$ & $\mathit{(5.72,6.02)}$\\
& 12 Q& 4.902 & 3.245 \\
&& $\mathit{(2.74,4.40)}$ & $\mathit{(1.40,3.10)}$\\
\addlinespace
Inflation ($P$)
& 2 Q& 34.736& 29.425 \\
&& $\mathit{(13.64,14.20)}$ & $\mathit{(12.12,13.14)}$\\
& 4 Q& 27.405 & 26.278 \\
&& $\mathit{(13.02,12.65)}$ & $\mathit{(11.02,11.40)}$\\
& 8 Q& 22.632 & 20.279 \\
&& $\mathit{(1.79,11.89)}$ & $\mathit{(1.62,11.72)}$\\
& 12 Q& 17.893 & 15.719 \\
&& $\mathit{(10.24,0.40)}$ & $\mathit{(10.12,0.19)}$\\
\bottomrule
\end{tabularx}
\medskip
Note: This table reports the changes in forecast error
variances by level and volatility shocks, using
the VAR model with time-varying stochastic volatility.
\end{threeparttable}
\end{table}
\end{document}
答案2
我不会对软件包问题发表评论,请查看上面其他人的评论。对于列的额外宽度,您可以使用将\makecell{}
单元格拆分为两行。
\begin{table}[ht]
\centering
\caption{Contribution to volatility and levels of endogenous variables}
\begin{tabular}{l*{3}{c}}
\hline
Variable & Horizon & \makecell{Decomposition of\\volatility shocks} & \makecell{Decomposition of\\level shocks} \\
\hline
\hline
GNP growth (y) & 2 Q& 34.819 & 22.206 \\
&& \textit{(23.5,28.40)}&\textit{(23.2,24.2)}\\
\cline{2-4} & 4 Q&23.901& 18.167\\
&& \textit{(15.52,18.65)}&\textit{(11.37,12.51)}\\
\cline{2-4} & 8 Q& 17.684&14.316 \\
&& \textit{(10.48,12.58)}&\textit{(8.57,9.52)}\\
\cline{2-4} & 12 Q& 9.654& 6.18\\
&& \textit{(2.08,2.48)}&\textit{(1.07,2.42)}\\
\hline
Unemployment (U) &2 Q & 8.874 & 6.245 \\
&& \textit{(9.52,12.44)}&\textit{(8.32,9.62)}\\
\cline{2-4} & 4 Q& 10.658 & 9.265 \\
&& \textit{(7.08,8.46)}&\textit{(6.82,7.22)}\\
\cline{2-4} & 8 Q& 8.840 & 6.235 \\
&& \textit{(6.32,7.02)}&\textit{(5.72,6.02)}\\
\cline{2-4} & 12 Q& 4.902 & 3.245 \\
&& \textit{(2.74,4.40)}&\textit{(1.40,3.10)}\\
\hline
Inflation (P) &2 Q & 34.736& 29.425 \\
&& \textit{(13.64,14.20)}&\textit{(12.12,13.14)}\\
\cline{2-4} & 4 Q& 27.405 & 26.278 \\
&& \textit{(13.02,12.65)}&\textit{(11.02,11.40)}\\
\cline{2-4} & 8 Q& 22.632 & 20.279 \\
&& \textit{(1.79,11.89)}&\textit{(1.62,11.72)}\\
\cline{2-4} & 12 Q& 17.893 & 15.719 \\
&& \textit{(10.24,0.40)}&\textit{(10.12,0.19)}\\
\hline
\end{tabular}
\label{tab4}
\begin{tablenotes}{\textwidth}
\small
\item Note:This table reports the changes in forecast error variances by level shocks and
volatility shock
using the VAR model with time-varying stochastic volatility.
\end{tablenotes}
\end{table}