如何在 LaTeX 上的 Stata 中缩小系数和标准误差之间的间距?

如何在 LaTeX 上的 Stata 中缩小系数和标准误差之间的间距?

在此处输入图片描述我使用 outreg 命令来获取以下 tex 代码,但我找不到如何使系数及其标准误差尽可能接近。

代码如下:

序言:

\documentclass[]{article}
\setlength{\pdfpagewidth}{12in} \setlength{\pdfpageheight}{11in}
\usepackage[utf8]{inputenc}
\usepackage[a4paper,includeheadfoot,margin=2.5 cm]{geometry}
\usepackage{cases} 
\usepackage{amsmath}
\usepackage{adjustbox}
\usepackage[symbol]{footmisc}

\RequirePackage{etex}
\usepackage{graphicx}
\usepackage{imakeidx}
\usepackage[round]{natbib}
\linespread{1.5}

代码:

\documentclass{article}

\begin{document}
\begin{table}[]
\centering
\begin{adjustbox}{width=\textwidth}
\begin{tabular}{lcccccc} \hline \hline
 & (1) & (2) & (3) & (4) & (5) & (6) \\
 & ic7d & ic14d & ic7d & ic14d & ic7d & ic14d \\ \hline
 &   \\
\textbf{c7} & 0.003   \sym{}\\
 & (0.0025)   \\
\textbf{c14} &  & 0.003   \sym{}\\
 &  & (0.0025)   \\
\textbf{avrg7} &  &  & -0.502*  \sym{}\\
 &  &  & (0.2030)  \\
\textbf{avrg14} &  &  &  & -0.506* \sym{}\\
 &  &  &  & (0.2070)  \\
\textbf{dg7} &  &  &  &  & 1.257**   \sym{}\\
 &  &  &  &  & (0.2980) &  \\
\textbf{dg14} &  &  &  &  &  & 1.261** \sym{}\\
 &  &  &  &  &  & (0.3010) \\
\textbf{Number of Obs.} & 1,453 & 1,402 & 1,424 & 1,373 & 1,377 & 1,326 \\
\textbf{R-squared} & 0.001 & 0.001 & 0.093 & 0.093 & 0.169 & 0.170 \\
 \hline \hline 
\multicolumn{7}{\linewidth}{\small Robust standard errors in parentheses; + p$<$0.1, * p$<$0.05, ** p$<$0.01} \\
\multicolumn{7}{\linewidth}{\small Table 1} \\
\multicolumn{7}{\linewidth}{\small The regressions are of 7 days of lags.} \\
\end{tabular}
 \  \end{adjustbox}
\end{table}
\end{document}

答案1

从您的问题来看,我假设您希望行距仅影响文本,同时在表格内保持较小的行距。如果这是正确的假设,那么使用setspace自动处理该问题的包可能会让您感兴趣。在下面的 MWE 中,我还对序言和表格代码本身做了一些更改,以进一步改进输出:

在此处输入图片描述

在此处输入图片描述

\documentclass[]{article}
%\setlength{\pdfpagewidth}{12in} \setlength{\pdfpageheight}{11in} % seems to contradict the geometry package options you set, therefore removed
%\usepackage[utf8]{inputenc} % default with up to date latex
\usepackage[a4paper,includeheadfoot,margin=2.5 cm]{geometry}

\usepackage{amsmath} % switched load order to prevent error messages
\usepackage{cases}
%\usepackage{adjustbox} % not needed any more, since adjustbox environment around table was removed. Using adjustbox on a table makes font sized inconsistent. If you insist on a table that is exactly as wide as the textwidth, take a look at the second example.

%%%% unrelated to the table issue: %%%%
%\usepackage[symbol]{footmisc}
%\RequirePackage{etex}
%\usepackage{graphicx}
%\usepackage{imakeidx}
%\usepackage[round]{natbib}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{setspace} % replacement for \linespread. Only afects text, does not change line spacing inside of tables
\doublespacing

\usepackage{caption} % improve spacing around caption, offers ways to change the caption's style
\usepackage{booktabs} % for horizontal lines with improved spacing


\usepackage{lipsum} % just for dummy text. Do not use in real document.



\begin{document}
\lipsum[4]


\begin{table}
\centering
\caption{The regressions are of 7 days of lags.}
\begin{tabular}{lcccccc} 
\toprule
 & (1) & (2) & (3) & (4) & (5) & (6) \\
 & ic7d & ic14d & ic7d & ic14d & ic7d & ic14d \\ 
 \midrule
\textbf{c7} & 0.003   \\
 & (0.0025)   \\
\textbf{c14} &  & 0.003   \\
 &  & (0.0025)   \\
\textbf{avrg7} &  &  & -0.502*  \\
 &  &  & (0.2030)  \\
\textbf{avrg14} &  &  &  & -0.506* \\
 &  &  &  & (0.2070)  \\
\textbf{dg7} &  &  &  &  & 1.257**   \\
 &  &  &  &  & (0.2980) &  \\
\textbf{dg14} &  &  &  &  &  & 1.261** \\
 &  &  &  &  &  & (0.3010) \\
\textbf{Number of Obs.} & 1,453 & 1,402 & 1,424 & 1,373 & 1,377 & 1,326 \\
\textbf{R-squared} & 0.001 & 0.001 & 0.093 & 0.093 & 0.169 & 0.170 \\
\bottomrule
\multicolumn{7}{l}{\small Robust standard errors in parentheses; + p$<$0.1, * p$<$0.05, ** p$<$0.01} 
\end{tabular}
\end{table}


\begin{table}
\centering
\caption{The regressions are of 7 days of lags.}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}lcccccc} 
\toprule
 & (1) & (2) & (3) & (4) & (5) & (6) \\
 & ic7d & ic14d & ic7d & ic14d & ic7d & ic14d \\ 
 \midrule
\textbf{c7} & 0.003   \\
 & (0.0025)   \\
\textbf{c14} &  & 0.003  \\
 &  & (0.0025)   \\
\textbf{avrg7} &  &  & -0.502*  \\
 &  &  & (0.2030)  \\
\textbf{avrg14} &  &  &  & -0.506* \\
 &  &  &  & (0.2070)  \\
\textbf{dg7} &  &  &  &  & 1.257**   \\
 &  &  &  &  & (0.2980) &  \\
\textbf{dg14} &  &  &  &  &  & 1.261** \\
 &  &  &  &  &  & (0.3010) \\
\textbf{Number of Obs.} & 1,453 & 1,402 & 1,424 & 1,373 & 1,377 & 1,326 \\
\textbf{R-squared} & 0.001 & 0.001 & 0.093 & 0.093 & 0.169 & 0.170 \\
\bottomrule
\multicolumn{7}{l}{\small Robust standard errors in parentheses; + p$<$0.1, * p$<$0.05, ** p$<$0.01} 
\end{tabular*}
\end{table}
\end{document}

相关内容