Skip to content

Conversation

@mgeier
Copy link
Contributor

@mgeier mgeier commented Apr 13, 2021

This is a draft for an alternative to #8940 and #8971, and it might eventually close #8195 (or not!).

The limitation (for me) is that this still doesn't solve my problem mentioned in #8195 (comment).

Let me describe the problem in more detail:

In nbsphinx I would like to provide default values for both mathjax2_config and mathjax3_config, in order for users to be free to choose whichever version they want with mathjax_path and always get my defaults.

If I provide defaults for both mathjax2_config and mathjax3_config, the current logic in this PR will not raise a warning.
This may sound OK, but if a user previously (and correctly) used mathjax_config, their custom config will stop working and there will be no warning!

I could instead only provide a default in nbsphinx for mathjax3_config (and leave mathjax2_config/mathjax_config untouched), but this wouldn't help in the previous case where a user uses mathjax_config, because the warning would still not be shown.

Any ideas how to make this work?

Feature or Bugfix

Something in-between.

Purpose

Provide a way to specify MathJax v3 settings.

Details

If both mathjax2_config and mathjax3_config are given, both configurations will be written to the HTML output.

@tk0miya
Copy link
Member

tk0miya commented Apr 22, 2021

I also don't have a magical bullet for this problem. But I think this would help for Sphinx users who have their own mathjax_config for v2. So I'd like to merge this to Sphinx-4.0. What do you think?

@mgeier mgeier marked this pull request as ready for review April 23, 2021 20:07
@mgeier
Copy link
Contributor Author

mgeier commented Apr 23, 2021

It's not perfect, but I think we can use this!

Thanks to the new explicit config names mathjax2_config and mathjax3_config, I was able to make this work with nbsphinx, see spatialaudio/nbsphinx#558.
In this, I'm only providing default values for one of the MathJax versions and there is only one very little edge case where my default values get lost, but I can live with that.

@mgeier
Copy link
Contributor Author

mgeier commented Apr 23, 2021

@tk0miya Should I add a type and subtype for the warning? If yes, which one?

If you decide to merge this, I can add some documentation (either here or in a separate PR).

@tk0miya
Copy link
Member

tk0miya commented Apr 24, 2021

To suppress the warning is meaningless to me. If my understanding correct, the math configuration would not work when the warning is shown. Users should update their configuration instead of suppressing. So it's not needed.

If you decide to merge this, I can add some documentation (either here or in a separate PR).

I'll merge this after a while (maybe 3-4 hours later). If you have time until then, please add a document and CHANGES entry. It's helpful to me.

@mgeier
Copy link
Contributor Author

mgeier commented Apr 24, 2021

OK, I'm on it ...

@mgeier
Copy link
Contributor Author

mgeier commented Apr 24, 2021

OK, done, I've added some docs: https://sphinx--9094.org.readthedocs.build/en/9094/usage/extensions/math.html#confval-mathjax3_config

I didn't know a good example value for mathjax3_config. I you know one, please let me know or feel free to add it yourself.

@tk0miya tk0miya added extensions type:proposal a feature suggestion labels Apr 24, 2021
@tk0miya tk0miya added this to the 4.0.0 milestone Apr 24, 2021
@tk0miya
Copy link
Member

tk0miya commented Apr 24, 2021

Thank you for your update! Merging now.

@tk0miya tk0miya merged commit 2ef86c9 into sphinx-doc:4.x Apr 24, 2021
@tk0miya
Copy link
Member

tk0miya commented Apr 24, 2021

Oops. I wrongly merged this into the 4.x branch. I'll cherry-pick this into the 4.0.x branch manually.

@mgeier mgeier deleted the mathjax3_config branch April 24, 2021 09:36
@mgeier
Copy link
Contributor Author

mgeier commented Apr 24, 2021

Thanks @tk0miya!

@choldgraf
Copy link
Contributor

This looks great, thanks very much @mgeier - many will benefit from this!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 12, 2021
@AA-Turner AA-Turner added extensions:mathematics The `sphinx.ext.imgmath`, `sphinx.ext.jsmath`, or `sphinx.ext.mathjax` extensions and removed extensions labels Jan 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

extensions:mathematics The `sphinx.ext.imgmath`, `sphinx.ext.jsmath`, or `sphinx.ext.mathjax` extensions type:proposal a feature suggestion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The configuration format for MathJax v3 is changed

4 participants