Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Outreg2 and Frmttable Variable Names Not Compatible with LaTex?

    I'm having issues passing my variable names to tables in a way that LaTex can read (without me manually making edits to the .tex output). I am having this issue both with regression tables (that I export using outreg2) and with summary stats tables that I create using frmttable (both user-written packages). Specifically, I thought outreg2 should automatically insert a "" before underscores in variable names when exporting to a .tex file, but I'm not finding that to be the case when I run my code. I'm an example below. For me, this code produces a .tex file that includes variable names such as "pct_black" without inserting a "" to before the underscore character. If anyone has an idea of what the issue is or how to fix it, please let me know!

    Thanks.

    Code:
    reg std_gr4m lnppcurexp pctlowinc pctlep pctsped pct_black pct_hispanic totstu pctlep_flag
    outreg2 using tab2_part2, tex(frag) se dec(2) label replace title("Table 2: Regressions of 4th Grade Test Scores on Other Variables")

  • #2
    outreg2 is from SSC (FAQ Advice #12). Why do you expect quotation marks before an underscore? In LaTeX, you want a backslash before the underscore for it to be rendered correctly, and that is exactly what you get.

    Code:
    sysuse auto
    rename rep78 rep_78
    regress mpg weight rep_78
    outreg2 using tab2_part2, tex(frag)
    Res.:

    Code:
    \begin{tabular}{lc} \hline
     & (1) \\
    VARIABLES & mpg \\ \hline
     &  \\
    weight & -0.00568*** \\
     & (0.000583) \\
    rep\_78 & 0.564 \\
     & (0.467) \\
    Constant & 36.59*** \\
     & (2.841) \\
     &  \\
    Observations & 69 \\
     R-squared & 0.656 \\ \hline
    \multicolumn{2}{c}{ Standard errors in parentheses} \\
    \multicolumn{2}{c}{ *** p$<$0.01, ** p$<$0.05, * p$<$0.1} \\
    \end{tabular}

    Comment

    Working...
    X