因此,我基本上在 Excel 中创建所有表格,然后使用 Excel 的 Excel2LaTeX 插件传输到 Texnic Center。我不太熟悉根据自己的喜好调整输出的代码。例如,我有下表(直接来自 Excel2LaTeX):
\begin{table}[htbp]
\centering
\caption{Add caption}
\begin{tabular}{ccccccc}
\toprule
Dependent variable: & $CoJPoD_{system|sov}$ & & $\Delta$$CoJPoD_{system|sov}$ & & $CoJPoD_{sov|system}$ & \\
\midrule
& & & & & & \\
& \textbf{(1)} & \textbf{(2)} & \textbf{(3)} & \textbf{(4)} & \textbf{(5)} & \textbf{(6)} \\
& & & & & & \\
Constant & -11.116*** & -10.045*** & -6.668*** & -5.597*** & 13.194*** & 13.938*** \\
& (-2.934) & (-3.540) & (-2.939) & (-3.000) & (3.584) & (3.556) \\
Market Ret (6 months) (\%) & 0.001*** & & 0.001*** & & 0.000 & \\
& (3.022) & & (3.645) & & (-0.016) & \\
Market Vol (6 months) (\%) & 0.008 & & 0.009 & & 0.008 & \\
& (0.686) & & (1.127) & & (0.458) & \\
Market Ret (1 month) (\%) & & 0.013** & & 0.010** & & -0.021*** \\
& & (2.010) & & (2.171) & & (-2.723) \\
Market Vol (1 month) (\%) & & -1.949*** & & -1.629*** & & -0.051 \\
& & (-4.682) & & (-5.221) & & (-0.063) \\
Log GDP & 0.913*** & 0.826*** & 0.550*** & 0.463*** & -1.180*** & -1.242*** \\
& (2.882) & (3.470) & (2.919) & (2.943) & (-3.824) & (-3.764) \\
Debt/GDP (\%) & 0.004*** & 0.004*** & 0.002* & 0.002 & 0.004* & 0.004* \\
& (2.796) & (2.825) & (1.953) & (1.949) & (1.750) & (1.730) \\
Reserve/Debt (\%) & 0.0689** & 0.071** & 0.043** & 0.045* & 0.075** & 0.072** \\
& (2.478) & (2.322) & (2.101) & (1.919) & (2.371) & (2.325) \\
Term Spread (\%) & 0.0423*** & 0.041*** & 0.038*** & 0.037*** & 0.012 & 0.015** \\
& (6.244) & (6.984) & (7.033) & (7.261) & (1.312) & (2.154) \\
VSTOXX (\%) & 0.004*** & 0.003*** & 0.003*** & 0.002*** & 0.008*** & 0.007868*** \\
& (4.853) & (4.192) & (4.389) & (3.737) & (7.545) & (7.848) \\
& & & & & & \\
Bank fixed effects & Yes & Yes & Yes & Yes & Yes & Yes \\
No. of observations & 620 & 620 & 620 & 620 & 620 & 620 \\
Adjusted $R^2$ & 0.728 & 0.719 & 0.774 & 0.760 & 0.822 & 0.822 \\
\bottomrule
\end{tabular}
\label{tab:addlabel}
\end{table}
基本上,表格太宽,无法放在纵向页面上(我不想使用横向)。我发现每列之间的间隙很大,有没有什么方法可以减少列之间的间隙?
谢谢。
答案1
使用p{1.5cm}
而不是c
。根据您的要求调整宽度。如果需要,您还可以调整两列之间的间隙。
\begin{tabular}{p{2cm} p{2cm}p{2cm}p{1.5cm}p{1.5cm}p{1.5cm}p{1.5cm}}
你的餐桌
\documentclass[a4paper]{article}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[colorinlistoftodos]{todonotes}
\title{Your Paper}
\author{You}
\begin{document}
\maketitle
\begin{table}[htbp]
\centering
\caption{Add caption}
\begin{tabular}{p{2cm} p{2cm}p{2cm}p{1.5cm}p{1.5cm}p{1.5cm}p{1.5cm}}
Dependent variable: & $CoJPoD_{system|sov}$ & & $\Delta$$CoJPoD_{system|sov}$ & & $CoJPoD_{sov|system}$ & \\
& & & & & & \\
& \textbf{(1)} & \textbf{(2)} & \textbf{(3)} & \textbf{(4)} & \textbf{(5)} & \textbf{(6)} \\
& & & & & & \\
Constant & -11.116*** & -10.045*** & -6.668*** & -5.597*** & 13.194*** & 13.938*** \\
& (-2.934) & (-3.540) & (-2.939) & (-3.000) & (3.584) & (3.556) \\
Market Ret (6 months) (\%) & 0.001*** & & 0.001*** & & 0.000 & \\
& (3.022) & & (3.645) & & (-0.016) & \\
Market Vol (6 months) (\%) & 0.008 & & 0.009 & & 0.008 & \\
& (0.686) & & (1.127) & & (0.458) & \\
Market Ret (1 month) (\%) & & 0.013** & & 0.010** & & -0.021*** \\
& & (2.010) & & (2.171) & & (-2.723) \\
Market Vol (1 month) (\%) & & -1.949*** & & -1.629*** & & -0.051 \\
& & (-4.682) & & (-5.221) & & (-0.063) \\
Log GDP & 0.913*** & 0.826*** & 0.550*** & 0.463*** & -1.180*** & -1.242*** \\
& (2.882) & (3.470) & (2.919) & (2.943) & (-3.824) & (-3.764) \\
Debt/GDP (\%) & 0.004*** & 0.004*** & 0.002* & 0.002 & 0.004* & 0.004* \\
& (2.796) & (2.825) & (1.953) & (1.949) & (1.750) & (1.730) \\
Reserve/Debt (\%) & 0.0689** & 0.071** & 0.043** & 0.045* & 0.075** & 0.072** \\
& (2.478) & (2.322) & (2.101) & (1.919) & (2.371) & (2.325) \\
Term Spread (\%) & 0.0423*** & 0.041*** & 0.038*** & 0.037*** & 0.012 & 0.015** \\
& (6.244) & (6.984) & (7.033) & (7.261) & (1.312) & (2.154) \\
VSTOXX (\%) & 0.004*** & 0.003*** & 0.003*** & 0.002*** & 0.008*** & 0.007868*** \\
& (4.853) & (4.192) & (4.389) & (3.737) & (7.545) & (7.848) \\
& & & & & & \\
Bank fixed effects & Yes & Yes & Yes & Yes & Yes & Yes \\
No. of observations & 620 & 620 & 620 & 620 & 620 & 620 \\
Adjusted $R^2$ & 0.728 & 0.719 & 0.774 & 0.760 & 0.822 & 0.822 \\
\end{tabular}
\label{tab:addlabel}
\end{table}
\end{document}
答案2
对于想要在缩小边距的同时实现居中对齐的人,请添加:
\usepackage{array}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\begin{table}
\begin{tabular}{C{1cm}C{1cm}}
test for this & test for this
\end{tabular}
\end{table}