@@ -1595,19 +1595,24 @@ def config_inited(app, config):
15951595 # this only works if mathjax_config or mathjax2_config is specified.
15961596 if config .mathjax3_config is None :
15971597 config .mathjax3_config = {}
1598- mathjax3_config = config .mathjax3_config
1598+ mathjax_config = config .mathjax3_config
1599+ if not mathjax_config and hasattr (config , 'mathjax4_config' ):
1600+ # mathjax4_config was added in Sphinx 9
1601+ if config .mathjax4_config is None :
1602+ config .mathjax4_config = {}
1603+ mathjax_config = config .mathjax4_config
15991604 tex = {
16001605 'inlineMath' : mathjax_inline_math ,
16011606 'processEscapes' : True ,
16021607 }
1603- tex .update (mathjax3_config .get ('tex' , {}))
1604- mathjax3_config ['tex' ] = tex
1608+ tex .update (mathjax_config .get ('tex' , {}))
1609+ mathjax_config ['tex' ] = tex
16051610 options = {
16061611 'ignoreHtmlClass' : mathjax_ignore_class ,
16071612 'processHtmlClass' : mathjax_process_class ,
16081613 }
1609- options .update (mathjax3_config .get ('options' , {}))
1610- mathjax3_config ['options' ] = options
1614+ options .update (mathjax_config .get ('options' , {}))
1615+ mathjax_config ['options' ] = options
16111616 else :
16121617 if hasattr (config , 'mathjax2_config' ):
16131618 # Sphinx >= 4.0
0 commit comments