*! version 1.0.3 10Sep2025

Title

reg2tex -- Export regression results to LaTeX using esttab

Syntax

reg2tex [model_names] , SAVing(filename)
[DECimal(#)
STARLevels(numlist)
REPLace
Title(string)
threeline
LANDscape
modelnames("name1" "name2" ...)
label
nodepvar
nonumbers
b(fmt)
se(fmt)
keep(varlist)
drop(varlist)
order(varlist)
stats(stats)
eform(string)
prehead(string)
postfoot(string)
addnotes(string)
esttab_options(string)
]

model_names is a list of stored estimation set names. If omitted, all stored estimates are used.

Description

reg2tex exports regression results from stored estimates to a LaTeX table using the esttab command from the estout package.
It provides a simplified interface to esttab with sensible defaults for academic publications.

Key features:

- Uses the powerful esttab command for LaTeX output

- Supports all stored estimation results

- Provides simplified options for common formatting needs

- Allows passing any esttab option through esttab_options()

- Includes landscape mode and three-line table formatting

Comparison with regtex:

- reg2tex is written based on esttab.ado and uses the e() class to store results

- Outputs LaTeX-compliant tables that can be directly inserted into thesis frameworks generated by art2tex

- Applicable to various regression models compatible with esttab

- regtex outputs LaTeX code for basic OLS regression model tables and can be compiled into PDF documents with one-click

- regtex supports limited regression types and requires manual preamble removal when inserting into art2tex thesis frameworks

- These are two independent ado files - users can choose according to their needs

Options

Required

saving(filename) specifies the output .tex file path.

Main

decimal(#) sets decimal places for numbers (default: 3). This affects both coefficients and standard errors.

starlevels(numlist) sets p-value thresholds for stars (default: 0.10 0.05 0.01). The program automatically converts these to the proper format with symbols (*, **, ***).

replace overwrites existing file.

title(string) adds table caption.

threeline uses three-line table format with booktabs. This option is converted to the booktabs option for esttab.

landscape orients table in landscape mode. This option is converted to the page(landscape) option for esttab.

modelnames("name1" "name2" ...) provides custom model names. Names must be quoted and separated by spaces. This option is converted to the mtitles option for esttab.

label uses variable labels instead of names.

nodepvar suppresses dependent variable header.

nonumbers suppresses model numbers.

Advanced

b(fmt) specifies coefficient format. Overrides decimal option for coefficients.

se(fmt) specifies standard error format. Overrides decimal option for standard errors.

keep(varlist) specifies which variables to include.

drop(varlist) specifies which variables to exclude.

order(varlist) specifies variable order.

stats(stats) specifies which model statistics to include.

eform(string) displays coefficients as exponentiated form.

prehead(string) specifies LaTeX code to put before table.

postfoot(string) specifies LaTeX code to put after table.

addnotes(string) adds notes below the table. The program automatically adds quotes around this option for proper parsing.

esttab_options(string) passes additional options directly to esttab. Outer quotes are automatically removed for proper parsing.

Examples

Basic usage with stored estimates

. sysuse auto, clear

. regress price weight

. estimates store model1

. regress price weight mpg

. estimates store model2

. reg2tex, saving("table1.tex") replace

Specifying model names

. reg2tex model1 model2, saving("table2.tex") replace

Advanced options

. reg2tex, saving("table3.tex") replace ///

decimal(2) ///

starlevels(0.05 0.01) ///

title("Auto Price Regressions") ///

threeline ///

landscape ///

modelnames("Simple" "Extended") ///

stats(r2 N) ///

addnotes("Standard errors in parentheses; * p<0.05, ** p<0.01")

Using esttab options directly

. reg2tex, saving("table4.tex") replace ///

esttab_options("cells(b(star fmt(3)) se(par))")

Using with reghdfe

. sysuse auto, clear

. reghdfe price weight, absorb(foreign)

. estimates store model3

. reghdfe price weight mpg, absorb(foreign)

. estimates store model4

. reg2tex, saving("table5.tex") replace

Authors

Wu Lianghai

School of Business, Anhui University of Technology, Ma'anshan, China

agd2010@yeah.net

Wu Hanyan

School of Economics and Management, Nanjing University of Aeronautics and Astronautics, China

2325476320@qq.com

Acknowledgment

We sincerely appreciate Kit Baum and Christopher F. Baum for their prompt guidance and revision suggestions!

Version

reg2tex version 1.0.3 - 10 September 2025

Updates:

- Added comparison section with regtex

- Added acknowledgment section

- Fixed starlevels conversion to handle any number of levels (1-3)

- Added special handling for addnotes option to ensure proper quoting

- Converted threeline option to booktabs option for esttab

- Converted landscape option to page(landscape) option for esttab

- Improved handling of esttab_options by removing outer quotes

- Enhanced error checking for stored estimates

- Added reghdfe example to documentation

Also see

Related commands: esttab, estout, latex, art2tex, sumtex, corrtex2, regtex, reftex