diff --git a/stargazer/stargazer.py b/stargazer/stargazer.py index 7bfd2c1..803726f 100644 --- a/stargazer/stargazer.py +++ b/stargazer/stargazer.py @@ -108,6 +108,8 @@ def reset_params(self): self.custom_notes = [] self.show_stars = True self.table_label = None + self.custom_latex_code = "" + self.font_size = 100 def extract_data(self): """ @@ -274,6 +276,13 @@ def append_notes(self, append): assert type(append) == bool, 'Please input True/False' self.notes_append = append + def add_custom_latex_code(self, code): + assert type(code) in [ list, str ], "Please input custom latex code as a string or list of strings" + if type(code) == list: + assert sum([int(type(n) != str) for n in code]) == 0, "Custom latex code must be strings" + code = " ".join( code ) + self.custom_latex_code += code + def render_html(self, *args, **kwargs): return HTMLRenderer(self).render(*args, **kwargs) @@ -296,6 +305,15 @@ def render_latex(self, *args, escape=False, **kwargs): """ return LaTeXRenderer(self, escape=escape).render(*args, **kwargs) + 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: """ @@ -414,7 +432,7 @@ def generate_header(self): if self.title_text is not None: header += self.title_text + '
' - header += '' if self.dep_var_name is not None: header += '