Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to set latex text size #82

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Added support for numeric font size used in html tables
  • Loading branch information
leogoldman committed Mar 3, 2022
commit 3bdacc9f504ce363897b64ce4bb42f38b8fcb191
8 changes: 6 additions & 2 deletions stargazer/stargazer.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def reset_params(self):
self.show_stars = True
self.table_label = None
self.custom_latex_code = ""
self.font_size = 100

def extract_data(self):
"""
Expand Down Expand Up @@ -308,7 +309,10 @@ def set_font_size( self, size ):
if type( size ) == str:
size = size if size[0]=="\\" else "\\"+size
self.add_custom_latex_code = size + self.add_custom_latex_code

if type( size ) in [ int,float ]:
self.font_size = size
else:
assert False, "Please input font size as a string (for latex sizes) or a number for scaling (default=100)"


class Renderer:
Expand Down Expand Up @@ -428,7 +432,7 @@ def generate_header(self):
if self.title_text is not None:
header += self.title_text + '<br>'

header += '<table style="text-align:center"><tr><td colspan="'
header += '<table style="text-align:center; font-size:{0}%"><tr><td colspan="'.format( str(self.font_size) )
header += str(self.num_models + 1) + '" style="border-bottom: 1px solid black"></td></tr>'
if self.dep_var_name is not None:
header += '<tr><td style="text-align:left"></td><td colspan="' + str(self.num_models)
Expand Down