The estout command in Stata will always escape underscores if a variable label has such a character. For example, running this after a simple regression and then
qui sum res, d
estadd scalar test = r(mean)
and outputting to a tex file:
esttab using "filename.tex", stats(r2 test, labels("\$R^2\$" "\$T_i\$")) se r2
star(* 0.10 ** 0.05 *** 0.01) label replace fragment nomtitles
coeflabels(_cons "$\alpha\$") nonumbers tex
will create a string $T\_i$
in the filename.tex
output. Trying a label \$\beta
=char(95)'{HML}\$` results in the same behavior. Apparently, the 'outreg2' command is smart enough to not escape this character if it sees it is in math mode, but estout did not inherit such behavior. Is there a smart way to stop the escape of the underscore?