回归表中的输入对齐(Latex)

时间:2018-03-24 14:46:11

标签: latex stata

我使用以下命令创建了一个回归表:

\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{adjustbox}{max
width={\textwidth},caption={Cumulative Average Abnormal Return},nofloat=table}
\begin{tabular}{l*{4}{c}}
\hline\hline
                    &\multicolumn{1}{c}{(1)}&\multicolumn{1}{c}{(2)}&\multicolumn{1}{c}{(3)}&\multicolumn{1}{c}{(4)}\\
                    &\multicolumn{1}{c}{Test Model 1}&\multicolumn{1}{c}{Test Model 2}&\multicolumn{1}{c}{Test Model 3}&\multicolumn{1}{c}{Test Model 4}\\
\hline
Window 1:\\
{[0]}               &      0.0254\sym{***}&      0.02565\sym{***}&      0.0431\sym{***}&      0.0495\sym{***}\\
                    &    (0.0024)         &    (0.0065)         &    (0.0098)         &    (0.0024)         \\
Window 2:\\
{[-1,-10]}           &    0.000249         &    0.000230         &    0.000276         &   0.0000194         \\
                    &   (0.00024)         &   (0.00092)         &   (0.00032)         &   (0.000322)         \\
{[-11,-20]}          &   0.0000232         &   -0.000242         &   -0.000242         &   -0.000232         \\
                    &    (0.0019)         &    (0.0019)         &    (0.0019)         &    (0.0023)         \\
Window 3:\\
{[1,10]}             &   -0.000124         &   -0.000436         &   -0.000321         &   -0.000232         \\
                    &    (0.0011)         &    (0.0010)         &    (0.0010)         &    (0.0010)         \\
{[11,20]}            &    0.000124         &    0.000124         &    0.000124         &    0.000124         \\
                    &    (0.0014)         &    (0.0014)         &    (0.0014)         &    (0.0015)         \\                                                                              

\hline
Observations        &         417         &         417         &         417         &         417         \\
\hline\hline
\multicolumn{5}{p{\textwidth}}{\footnotesize xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxxxxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxxxxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxxxxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx}\\
\multicolumn{5}{p{\textwidth}}{\footnotesize \sym{*} \(p<0.10\), \sym{**} \(p<0.05\), \sym{***} \(p<0.01\)}\\
\end{tabular}\end{adjustbox}

Text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text

这导致以下输出:

screenshot of output

我的问题是,如何对齐回归表中的所有列,同时保持表宽度等于文本宽度。我还想将标题和表格文本“链接”到表格中,这样它就不会结束到不同的页面。谢谢!

1 个答案:

答案 0 :(得分:0)

我不清楚 你想如何“对齐表格中的所有列”。

如果您想将列对齐到左边,让它们具有相同的宽度,同时保持tabular的总宽度等于textwidth,您可以尝试更改

\begin{tabular}{l*{4}{c}}

\begin{tabular}{l*{4}{p{.2\textwidth}}}

\begin{tabular}{*{5}{p{.2\textwidth}}}

如果这没有用,请发表评论!!