Skip to content

Conversation

@jpweytjens
Copy link

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
Copy link
Author

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

CleanShot 2025-01-14 at 14 41 45

@toobaz
Copy link
Collaborator

toobaz commented Jan 14, 2025

Thanks @jpweytjens , looks great!

I will check more in depth next week.

@jpweytjens
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants