Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: LaTeX in variable labels for esttab

 From Christopher Baum To "statalist@hsphsun2.harvard.edu" Subject Re: st: LaTeX in variable labels for esttab Date Sat, 26 May 2012 04:36:07 -0400

<>
On May 26, 2012, at 8:33 AM, Billy wrote:

> I have a question about creating LaTeX tables using esttab (version
>
> I would like to include LaTeX markup in the variable labels. For
> example, suppose I have a variable rho_1 and I would like it to appear
> in the table as a rho symbol with a 1 subscript.
>
> In stata, I create the label as follows"
> label variable rho_1 "$\rho_{1}$"
>
> and call esttab using the label option.
>
> However, esttab protects the underscore character by adding a
> backslash, so the LaTeX code that is created is:
> $\rho\_{1}$
> and what appears in the compiled pdf is a rho symbol, followed by an
> underscore, followed by a 1 (not as a subscript).
>
> Is there a way to turn off this protection? (Which, of course, makes a
> great deal of sense in many contexts.)

No need to resort to -filefilter-, tab delimited, etc.

label var rho_1 "rho_1"
esttab using junk.tex,replace subs("rho_1" "$\rho_1\$") label

Kit

Kit Baum   |   Boston College Economics & DIW Berlin   |   http://ideas.repec.org/e/pba1.html
An Introduction to Stata Programming  |   http://www.stata-press.com/books/isp.html
An Introduction to Modern Econometrics Using Stata  |   http://www.stata-press.com/books/imeus.html

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/