stargazer icon indicating copy to clipboard operation
stargazer copied to clipboard

Feature: add Threepart LaTeX renderer

Open jpweytjens opened this issue 1 year ago • 3 comments

Add ThreePartRenderer for improved LaTeX table output

Adds a new LaTeX renderer that produces publication-quality regression tables using threeparttable, booktabs, and siunitx LaTeX packages. This implementation offers several improvements over the standard LaTeX output:

  • Uses threeparttable environment for better organization of table notes and star explanations
  • Leverages booktabs package for professional-looking horizontal rules
  • Implements siunitx for proper alignment of numerical values and significance stars
  • Adds ability to generate standalone LaTeX documents with configurable preamble
  • Includes a helper method to save tables directly to file

Key Features

  • Proper alignment of coefficients and standard errors using siunitx's S column type
  • Clean table rules from booktabs (toprule, midrule, bottomrule)
  • Structured notes section under the table using threeparttable
  • Optional standalone document generation with customizable packages and margins
  • Direct file output support via save_to_file() method

The new renderer maintains full compatibility with existing Stargazer functionality while providing enhanced LaTeX output suitable for academic publications.

jpweytjens avatar Jan 14 '25 13:01 jpweytjens

An example of the LaTeXRenderer on the left versus the ThreepartRenderer on the right.

CleanShot 2025-01-14 at 14 41 45

jpweytjens avatar Jan 14 '25 13:01 jpweytjens

Thanks @jpweytjens , looks great!

I will check more in depth next week.

toobaz avatar Jan 14 '25 15:01 toobaz

Hey @toobaz , have you found any time to have a look at this PR?

jpweytjens avatar Mar 03 '25 09:03 jpweytjens