-
Notifications
You must be signed in to change notification settings - Fork 54
Escape LaTeX special characters #61
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
Conversation
This is a subtle issue, see pandas-dev/pandas#21673 (comment) . In short, if we escape automatically we do fix the table.rename_covariates({'bi' : '$b_i$') ... and while this has a workaround (take the table.rename_covariates({'sepal_lenght' : 'sepal\_lenght') (which on the other hand has the obvious inconvenience that this table wouldn't look as good in html, or other formats). I think the long term solution is to create a In the short term, I'm OK with the feature you propose, but it should be disabled by default, its documentation should mention the problem above (e.g. the |
Ok, I can see you have given this a lot of thought already. My thinking was that the simplest and probably most common usage would be variable names as text without formatting – where I would expect Stargazer to escape all characters, so that the table looks the same in HTML and LaTeX – and that users would turn off escaping if they apply “render-specific” formatting ( Anyway, I have added an BTW, the render arguments are currently passed on to the |
The fact that an attribute is set outside of |
In turn, this can be done either by overriding |
Okay, I implemented the second solution. I also added a test and docstrings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, just one comment left
Thanks @csemken ! |
Just for the records, the newly introduced |
Fixes #60.
Uses the list of LaTeX special characters in pandas.io.formats.latex.
Currently escapes special characters in variable names and table notes. Later, the method could be applied to all cells in a
_gen_row
method, as suggested in #41 and #46.