Skip to content

CSS: Restrict center-alignment to nested <p> in "math" class #686

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mgeier
Copy link
Contributor

@mgeier mgeier commented Oct 9, 2018

This is how the built-in Sphinx themes do it:

https://github.com/sphinx-doc/sphinx/blob/eb44c73b81ff4e603d9452018d145ff3c204f71f/sphinx/themes/basic/static/basic.css_t#L642-L644

I hope this is actually correct SASS ...

In case you are wondering, one example where the unrestricted centering of the math class has unintended consequences is here: https://nbsphinx.readthedocs.io/en/latest/code-cells.html#Math.

@jessetan
Copy link
Contributor

jessetan commented Oct 9, 2018

What is the unintended consequence in the link you provided? That the formula is left-aligned rather than centered?

@mgeier
Copy link
Contributor Author

mgeier commented Oct 9, 2018

@jessetan Sorry, I should have clarified that, it's not obvious ...

The example uses an extension that uses additional CSS to left-align class MathJax_Display, but that's not the point of this PR.

It's about the third output with mixed text and math. This should be left-aligned instead of centered.
And in all other Sphinx templates that I tried it was.

@jessetan
Copy link
Contributor

Math is centered everywhere in this theme. Do you feel that left aligning math is always better than centering? Or are you more bothered by the inconsistent look in your output?
Since that is caused by an extension that left aligns MathJax output, would an adjustment to that extension or some custom CSS be enough for your use?

@mgeier
Copy link
Contributor Author

mgeier commented Oct 18, 2018

Do you feel that left aligning math is always better than centering?

No, that's not what I'm saying. I'm just suggesting that the RTD theme should do the same as the default Sphinx themes and all 3rd party themes. Display math will still be centered, as it was intended.

I'm sorry about my example above, it's really not obvious, but you shouldn't worry too much about it. Just forget it.

The point is: The default themes and all 3rd party themes are using this CSS, so there is no reason not to do the same.

There is really no downside, so what are you worried about?

@mgeier
Copy link
Contributor Author

mgeier commented Nov 15, 2018

@jessetan Do you still have doubts?

Can this please be merged?

@jessetan
Copy link
Contributor

jessetan commented Dec 7, 2018

In the current state of the theme, this left-aligns the equation label instead of centering it for display math.
I suggest we prioritize #383, then see what needs to be done for this PR.

@mgeier
Copy link
Contributor Author

mgeier commented Dec 8, 2018

@jessetan OK, I see. This is because right now the math CSS is completely broken, and I agree that it is important to fix #383 ASAP.

Once it is fixed, my suggestion here will also work.

I've left a comment over there (#383 (review)), probably everything can be fixed in one go.

mgeier added a commit to spatialaudio/nbsphinx that referenced this pull request Dec 14, 2018
mgeier added a commit to spatialaudio/nbsphinx that referenced this pull request Feb 3, 2019
@Blendify Blendify added this to the 1.1 milestone Mar 23, 2021
@benjaoming
Copy link
Contributor

I like the suggestion to simply include this in the work combined effort in #383

@benjaoming benjaoming modified the milestones: 1.1, 2.0 Aug 26, 2022
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.

4 participants