benjann / estout

Stata module to make regression tables
http://repec.sowi.unibe.ch/stata/estout/index.html
MIT License
70 stars 17 forks source link

labcol2 causes incorrect @span in erepeat #12

Closed NilsEnevoldsen closed 8 years ago

NilsEnevoldsen commented 8 years ago

Input:

sysuse auto
eststo: quietly reg price weight
estout using "example.tex", style(tex) replace drop(_cons) ///
  mgroups("mgroup", span erepeat(\cmidrule(lr){@span})) ///
  mlabels("mlabel", span erepeat(\cmidrule(lr){@span})) ///
  collabels("collabel", span erepeat(\cmidrule(lr){@span})) ///
  labcol("Qux", title("Foo" "Bar" "Baz"))
eststo clear

Expected:

            &    Foo     &mgroup      \\\cmidrule(lr){3-3}
            &    Bar     &mlabel      \\\cmidrule(lr){3-3}
            &    Baz     &collabel    \\\cmidrule(lr){3-3}
weight      &    Qux     &    2.044063\\

Actual:

            &    Foo     &mgroup      \\\cmidrule(lr){2-2}
            &    Bar     &mlabel      \\\cmidrule(lr){2-2}
            &    Baz     &collabel    \\\cmidrule(lr){2-2}
weight      &    Qux     &    2.044063\\

When compiled with…

\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{lcc}
\input{example}
\end{tabular}
\end{document}

…the expected result is…

screen shot 2016-07-10 at 12 42 17 pm

…and the actual result is:

screen shot 2016-07-10 at 12 40 41 pm

Originally reported as “Issue with -@span- in -estout-” by Albert Sfredo, Statalist

benjann commented 8 years ago

Yes, bug. @span does not take into account the extra column created by labcol(). I'll try to post a fix.

benjann commented 8 years ago

This should now be fixed.