我生成表的代码如下:
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[margin=1.25in]{geometry}
\usepackage{booktabs}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{float}
\usepackage{caption}
\usepackage{booktabs}
\usepackage{natbib}
\usepackage{ltxtable}
\usepackage{ltablex}
\usepackage{longtable}
\usepackage{tocloft}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage[titletoc,page]{appendix}
\usepackage[nottoc,notlot,notlof]{tocbibind}
\usepackage{titling}
\usepackage{filecontents}
\setlength{\cftsecnumwidth}{7em}% Set numwidth of section
\begin{filecontents}{\jobname.bib}
@misc{A01,
author = {Author, A.},
year = {2001},
title = {Alpha},
}
\end{filecontents}
\usepackage{blindtext}
\renewcommand\appendix{\par
\setcounter{section}{0}
\setcounter{subsection}{0}
\setcounter{figure}{0}
\setcounter{table}{0}
\renewcommand\thesection{Appendix \Alph{section}}
\renewcommand\thefigure{\Alph{section}\arabic{figure}}
\renewcommand\thetable{\Alph{section}\arabic{table}}
}
\setlength{\parskip}{1em}
\renewcommand{\baselinestretch}{1.5}
\begin{document}
\begin{table}[H]
\caption{Granger causality from S\&P500 to Bitcoin price}
\label{tab:BTC_SP500}
$H_0$: 'BitCoin Price' do not Granger-cause S\&P500.
\medskip\centering
\begin{tabular}{cccc}
\toprule
Test statistic & Critical Value & $p$-value & df \\
\midrule
23.465636 & 37.652484 & 0.550 & 25 \\
\bottomrule
\end{tabular}
\medskip\raggedright \\
Conclusion: fail to reject $H_0$ at 5\% significance leve.
\end{table}
\begin{table}[H]
\caption{Granger causality from Bitcoin price on S\&P500 } % title of Table
$H_0$: 'Close S\&P500' do not Granger-cause BitCoin Price.
\medskip\centering
\begin{tabular}{rrrr}
\toprule
Test statistic & Critical value & $p$-value & df \\
\midrule
28.421991 & 37.652484 & 0.289 & 25\\
\bottomrule
\end{tabular}
\label{tab:SP500_BTC}
\medskip\raggedright
Conclusion: fail to reject $H_0$ at 5\% significance level.
\end{table}
\end{document}
并且,我希望表格居中,并在表格下方显示“结论...”。有人知道我该如何纠正这个问题吗?谢谢!
答案1
您可以使用\multicolumn{4}{l}{...}
,将表格更改为\begin{tabular}{cccc}
并删除\raggedright
......
注意:最小工作示例包含最少的包。
最小工作示例(MWE):
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[margin=1.25in]{geometry}
\usepackage{float}
\usepackage{booktabs}
\begin{document}
\begin{table}[H]
\caption{Granger causality from S\&P500 to Bitcoin price}
\label{tab:BTC_SP500}
$H_0$: 'BitCoin Price' do not Granger-cause S\&P500.
\medskip\centering
\begin{tabular}{cccc}
\toprule
Test statistic & Critical Value & $p$-value & df \\
\midrule
23.465636 & 37.652484 & 0.550 & 25 \\
\bottomrule
\multicolumn{4}{l}{Conclusion: fail to reject $H_0$ at 5\% significance leve.}
\end{tabular}
\end{table}
\begin{table}[H]
\caption{Granger causality from Bitcoin price on S\&P500 }
\label{tab:SP500_BTC}
\medskip\centering
\begin{tabular}{cccc}
\multicolumn{4}{c}{$H_0$: 'Close S\&P500' do not Granger-cause BitCoin Price.}\\
\toprule
Test statistic & Critical value & $p$-value & df \\
\midrule
28.421991 & 37.652484 & 0.289 & 25\\
\bottomrule
\multicolumn{4}{l}{Conclusion: fail to reject $H_0$ at 5\% significance level.}
\end{tabular}
\end{table}
\end{document}
答案2
真的很紧急:标题和解释相互矛盾。您必须更正其中一个。
我建议您使用一个table
环境,其中包含两个tabular
环境以及相关的\caption
s、\label
s 和相关描述。使用单个\centering
指令,不使用任何\raggedright
指令。此外,小数点后显示六位数字确实没有什么好处。两位数字也一样好——事实上更好,因为读者更有可能费心查看测试统计量。
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[margin=1.25in]{geometry}
\usepackage{caption,booktabs,float}
\setlength{\parskip}{1em}
\usepackage{setspace}
\setstretch{1.5} % don't set low-level macro '\baselineskip' directly
\begin{document}
\begin{table}[H]
\caption{Granger causality from S\&P500 to Bitcoin price}
\label{tab:BTC_SP500}
\centering
$H_0$: `BitCoin Price' does not Granger-cause S\&P500.
\medskip
\begin{tabular}{cccc}
\toprule
Test statistic & Critical Value & $p$-value & df \\
\midrule
23.47 & 37.65 & 0.55 & 25 \\
\bottomrule
\end{tabular}
\medskip
Conclusion: Fail to reject $H_0$ at 5\% significance level.
\bigskip
\caption{Granger causality from Bitcoin price to S\&P500}
\label{tab:SP500_BTC}
$H_0$: `Close S\&P500' does not Granger-cause BitCoin Price.
\medskip
\begin{tabular}{rrrr}
\toprule
Test statistic & Critical value & $p$-value & df \\
\midrule
28.42 & 37.65 & 0.29 & 25\\
\bottomrule
\end{tabular}
\medskip
Conclusion: Fail to reject $H_0$ at 5\% significance level.
\end{table}
\end{document}