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
No reasonable way to add MathJax configuration? #8112
Comments
I discussed this issue a bit on SO and should clarify a point. Injecting |
This works for me in
|
@juhasch ???!!! Thanks! That does work... no idea why. Note that the MathJax documentation has no quotes. Also, how does this work when Injecting configurations explicitly with either
MathJax.Hub.Config({
"HTML-CSS": {
availableFonts: ["Neo-Euler"], preferredFont: "Neo-Euler",
webFont: "Neo-Euler",
mtextFontInherit: true,
matchFontHeight: true,
scale: 85, // Euler is a bit big.
},
"SVG": {
font: "Neo-Euler",
},
"TeX": {
Macros: {
d: ["\\mathrm{d}"],
vect: ["{\\vec #1}",1],
abs: ["{\\lvert #1 \\rvert}",1]
}
}
});
<script type="text/javascript">
MathJax.Hub.Config({
"HTML-CSS": {
availableFonts: ["Neo-Euler"], preferredFont: "Neo-Euler",
webFont: "Neo-Euler",
mtextFontInherit: true,
matchFontHeight: true,
scale: 85, // Euler is a bit big.
},
"SVG": {
font: "Neo-Euler",
},
"TeX": {
Macros: {
d: ["\\mathrm{d}"],
vect: ["{\\vec #1}",1],
abs: ["{\\lvert #1 \\rvert}",1]
}
}
});
</script>
3. Include any customizations in a LaTeX style file for latex conversion.
```latex
\usepackage[small]{eulervm}
\newcommand{\vect}[1]{\vec{#1}}
\newcommand{\abs}[1]{\lvert#1\rvert|}
\let\d\relax % \d already defined and there is no \RedeclareMathOperator
\DeclareMathOperator{\d}{d} It would still be nice if there was a solution that worked without having to modify a users The issue about the quotes needs to be addressed somewhere though. Should I open a new ticket? (I really have no idea at this point why it works with quotes.) |
Closing as this issue is not in IPython itself and if still problematic and relevant should be opened on the right repository. This will allow to keep the number of opened issue on the IPython repo under control. Feel free to keep commenting or reopen if necessary. Thanks. |
MathJax seems to be loaded too early to allow for any user customization. Unfortunately, once it is loaded there seems to be no easy way to change the configuration. It is loaded early in
templates/notebook.html
with thedelayStartupUntil=configured
flag which in principle should allow customization, but thenMathJax.Hub.Configured()
is called instatic/notebook/js/mathjaxutils.js
before any hooks are called, so there is no reasonable place to insert ones own customization in time.One suggestion would be to add a hook just before this call in
mathjaxutils.js
:This at least allows one to include MathJax customization in the
custom.js
file.However, there should also be a solution that allows people to include customization from a notebook cell, i.e. so that it can be used by
NBViewer
, or distributed in a notebook cell. Is there a way to delay the call toMathJax.Hub.Configured()
until after the last cell in a notebook so that a customization could be injected with anHTML()
tag, or will that seriously break something?As a simple test, one can try to configure a new macro:
and then see if
$$\vect{x}$$
renders properly with an arrow.The text was updated successfully, but these errors were encountered: