Stata/LaTeX Workflows

Stata workflows for generating LaTeX output

View the Project on GitHub lukestein/stata-latex-workflows

Packages for generating LaTeX output from Stata code

Stata Table Gallery (sample tables with code; contributions welcome!)

A variety of packages (and manual techniques) are available for programmatically generating LaTeX output using Stata.

Generally, more automated approaches such as estout/esttab make it easy to quickly generate nearly-production-ready output, but make it more difficult (if not impossible) to implement significant customization. (That is, costs may be convex.) Automated approaches may also work best with interactive and exploratory analysis, since attractively formatted results can also be displayed as Stata output or exported as simple text or csv files.

Semi-automated approaches such as json-this/coeftable and stata-tex generally require manually creating LaTeX code to generate even simple tables, but their output is fully customizable. (That is, costs may be concave.)

Semi-automated approaches often involve saving calculated values in an external file before generating LaTeX output. (This is also possible with automated approaches using Stata’s estimates save command.) While slightly more complicated, this separation of analysis from table generation has real advantages. For example, saving calculated values

Automated table creation

These packages generate tex files (and perhaps other formats) with customization via Stata command options.


Package page


Package page


Package page

For descriptive statistics and tabulations, not regression results

Semi-automated table creation

These packages typically fill in a manually created tex template with calculated values.


Package pages: json-this and coeftable

Calculated values are saved as json and then inserted into an external tex template


Package page

Calculated values are saved as csv and then inserted into an external tex template


Package pages: regsave and texsave

Calculated values are saved as Stata datasets and then exported as tex


Package page

Calculated values are inserted directly into a tex template included in the do file


Package page

Calculated values are saved as .ster files, desired values are arranged as a Stata matrix, and then exported as tex


Package page

Tables are set up as a Stata dataset and then exported as tex

“Dynamic Document”-based approaches

These approaches are usually used to more fully integrate analysis into document creation, but can also be used to generate LaTeX output (perhaps requiring a tool like pandoc to convert from markdown or HTML to LaTeX).

Other methods


I created this page in response to Twitter discussions suggesting there’s interest in learning more about the wide range of techniques researchers use to work with Stata and LaTeX. I also wanted to learn more about how to use github (where this page is hosted).

I added the resources I was aware of, and quickly characterized them as best I could. Please feel free to suggest additions or updates, either by submitting pull requests to the github respository (if you know how to do so), or by contacting me directly.