Skip to content

ENH: Styler.to_latex conversion from CSS #40731

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

Merged
merged 150 commits into from
Jun 16, 2021

Conversation

attack68
Copy link
Contributor

@attack68 attack68 commented Apr 1, 2021

This is an extension PR to #40422 (most of this code is included there), and must be committed after it.
This PR only adds the _parse_latex_css_conversion function and associated convert_css argument.

Below is the relevant section added to the user guide:

Screen Shot 2021-04-01 at 16 37 12

@attack68 attack68 marked this pull request as ready for review May 24, 2021 16:58
@simonjayhawkins
Copy link
Member

@attack68 there are some mypy errors.

@attack68
Copy link
Contributor Author

@attack68 there are some mypy errors.

thanks didn't spot, fixed now.

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add this on to an existing whatsnew note the issue number

@@ -480,6 +481,10 @@ def to_latex(
Set to ``True`` to structure LaTeX compatible with the {siunitx} package.
encoding : str, default "utf-8"
Character encoding setting.
convert_css : bool, default False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need an option for this? why wouldn't we always do this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We wouldn't want to convert if different settings for html and latex are wanted or if more control over the latex formatting is needed. But in that case, a new styler instance could easily be used, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right this is by-definition on .to_latex so i think its clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Styler now allows styling to be coded in LaTeX or HTML-CSS format. In each separate case, which are completely flexible in each format, you don't want to convert.
But, if you have created an HTML-CSS Styler and it contains the limited attr-values that can now be converted to LaTeX then you should use the convert option. Shouldn't be set to default though.

@jreback jreback added this to the 1.3 milestone Jun 16, 2021
@jreback jreback merged commit 450c29e into pandas-dev:master Jun 16, 2021
@jreback
Copy link
Contributor

jreback commented Jun 16, 2021

thanks @attack68

@jreback
Copy link
Contributor

jreback commented Jun 16, 2021

@meeseeksdev backport 1.3.x

@lumberbot-app
Copy link

lumberbot-app bot commented Jun 16, 2021

Something went wrong ... Please have a look at my logs.

simonjayhawkins pushed a commit that referenced this pull request Jun 16, 2021
@attack68 attack68 deleted the latex_css_conversion branch June 16, 2021 13:25
JulianWgs pushed a commit to JulianWgs/pandas that referenced this pull request Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement IO LaTeX to_latex Styler conditional formatting using DataFrame.style
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants