Open olrenso opened 2 years ago
Hi @Lorenzoss ! I pushed up a potential fix, can you update Typomagical to see if it's resolved for you?
Hi, thank you! Unfortunately, it still increases the line spacing a little bit. It's very subtle and probably most of the time you'll hardly notice it.
I also noticed that sometimes it happens even without any superscript - for example by adding a space and certain letters.
I guess it'll be quite tricky to fix. It may be some strange handling by mathjax (?)
Hi @Lorenzoss ! Just wanted to let you know that I haven't forgotten this problem. I don't understand mathjax, but I pushed up a potential fix for the wobbliness. Could you update Typomagical and give it another try?
Hi @hungsu, thank you for your time!
It seems that it works just fine:
The only remark I noticed is that it also affects the block equations (as you can see in the "H2O" at the bottom) - I'm not sure if it's a stylistic choice, anyway, to fix that, I just added .math-inline
to the CSS.
I'd also suggest, if it's possible and it's not too time-consuming, to add that as an option to the style settings plugin. Someone maybe wants to leave the default LaTex font.
Edit:
I did some tests with more complex equations and I noticed that sometimes it change the font to some parts outside the mhchem environment. mjx-texatom
seems to be used also for some LaTex formatting not related to mhchem.
I would say to change the font for all the LaTex environments - eventually as an option with the style settings plugin - or to revert back to the default font.
Thanks for the detailed reply and screencast @Lorenzoss ! I'm a bit worried by it though - you mentioned adding .math-inline
to the CSS, but that should have already been there.
This is what the fix should look like. Do you mean to say you added .math-inline
to this line again?
I think the suggestion to leave the default font (called "MJXZERO" and "MJXTEX") is a good one. I've filed a new issue for that concern. https://github.com/hungsu/typomagical-obsidian/issues/20
Sorry, I wasn't clear. I meant in the code you added in the commit 55dcbcf8fd86ceeb76fe7fd5bac45d573b024243:
mjx-container mjx-math mjx-texatom{
font-family: var(--default-font);
}
Thanks so much for your patience with me @Lorenzoss - one of these days it seems I'll have to learn LateX and MathJax! I've added a style setting, does this suit you? 🙂
Thank you for the update! Unfortunately, there are still some issues.
On the style setting you wrote that it should change the font for all MathJax, but currently, it only affects mhchem (so only the text inside \ce{}
) and some other elements as I said yestarday:
Edit: I did some tests with more complex equations and I noticed that sometimes it change the font to some parts outside the mhchem environment.
mjx-texatom
seems to be used also for some LaTeX formatting not related to mhchem.
For example, in the below image it uses both fonts, the default LaTeX font (CMU - Formally MJXZERO and MJXTEX in MathJax) as you would expect, and Plairfair Display when you add a \text{}
as a subscript of something, with is odd. As you can see in "soluzione" and "solvente".
$$\Delta T_{eb} = T_{eb \text{ soluzione}} - T_{eb \text{ solvente}} = i\cdot K_{eb} \cdot m$$
I tried to play around a little bit and I was able to change the font globally with:
.mathjax-font-typomagical mjx-container mjx-math{
font-family: var(--default-font);
}
.mathjax-font-typomagical mjx-mi mjx-c{
font-family: var(--default-font);
font-style: italic;
}
However, I've to say that it's not so eyeing pleasing as I expected 😅. The spacing seems off and some symbols (for example Δ) are strange.
Otherwise, if you only meant to edit the inline mhchem font, as the original issue was about, I managed to fix the bug I cited at the top of the post by adding another time mjx-texatom
, and of course .math-inline
to affect only the inline blocks.
By changing the mhchem font also for the centered equations you get odd results when you use both mhchem and classic LaTeX where the chemical formulas and LaTeX elements have two different fonts.
.mathjax-font-typomagical .math-inline mjx-container mjx-math mjx-texatom mjx-texatom {
font-family: var(--default-font);
}
Inline block: $\ce{CO2}$
Inline block: $ABC_{Test \text{ test}}$
Sorry for the long message and probably full of English errors. I really appreciate the time you are dedicating to me.
As the title says
Like this:
Instead of:
Mhchem equation:
$$\ce{Ca(OH)2 + K2CO3 → CaCO3 + 2 KOH}$$
To obtain the first result I created the following CSS Snippet:
However when there is a number as superscript it slightly increases the line spacing with the previous line:
$\ce{Ca^2+}$