TeX - LaTeX Asked by countercyclical24 on May 22, 2021
I used outreg command to get the following tex code, yet I cannot find how to make the coefficients and their standard errors as close as possible.
The code goes as follows:
The preamble:
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}
The code:
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}
From your question, I assume you want the linespacing to only affect the text, while keeping a smaller linespacing while inside of a table. If that's the correct assumption, using the setspace
package, that automatically takes care of that, might be interesting for you. In the following MWE, I also made some more changes to the preamble and the table code itself to further improve the output:
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}
Correct answer by leandriis on May 22, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP