mathjax for Anki \oiint

314 views
Skip to first unread message

foy.se...@gmail.com

unread,
Jul 10, 2020, 12:04:49 PM7/10/20
to MathJax Users
Hello,
I'd like to use Anki to help my students. I teach Physics.
I need to write the \oiint. It is easy with Latex but not very nice in anki.
MathJax is much lore beautiful but unfortunatly \oiint is not recognized...
I imagine it's because a package lefts (I've just forgotten his name but no matter, that's not the problem ;) ). But I do not know how to figure out  it in Anki...
Thanks for your help.
Sébastien


Davide Cervone

unread,
Jul 21, 2020, 2:39:51 PM7/21/20
to mathja...@googlegroups.com
The glyph for \oiint is not in the MathJax TeX fonts, and so there is no macro for it by default.  If you are using MathJax v2, you can load the mediawiki-texvc extension, which defines it (and a number of other similar macros).  If you are using version 3 of Mathjax, you can use

<script>
MathJax = {
  tex: {
    macros: {
      unicodeInt: ['\\mathop{\\vcenter{\\mathchoice{\\huge\\unicode{#1}}{\\unicode{#1}}{\\unicode{#1}}{\\unicode{#1}}}}\\nolimits', 1],
      oiint: '\unicodeInt{x222F}'
  }
}
</script>

to define \oiint.  Note that the character used for the integral will be taken from a system font installed on the user's computer, so it may or may not look like you would want it to.  The quality will depend on the fonts available on the user's system, and they likely will not match the other integrals in your expressions.

In version 2, you can select the STIX fonts if you are using SVG or HTML-CSS output for better consistency, as the STIX fonts do include the needed character.

Davide



--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mathjax-users/5e7302e4-a9bb-41d3-80d4-ea1d9e5407f3o%40googlegroups.com.

Sébastien Foy

unread,
Jul 22, 2020, 4:58:42 AM7/22/20
to mathja...@googlegroups.com
Thanks u Davide. I try it as soon as I can reach my computer... Unfortunately it seems a bit complicated for me. I don't even know whet I can get the version of math Jax. The script is to be written each time or has it to be save somewhere? Thanks u a lot. 

You received this message because you are subscribed to a topic in the Google Groups "MathJax Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mathjax-users/1BJk5Ij3HOI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mathjax-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mathjax-users/C556B5CF-734F-4476-A5BB-42078C4A74CD%40mathjax.org.

Davide Cervone

unread,
Jul 22, 2020, 9:13:50 AM7/22/20
to mathja...@googlegroups.com
 I don't even know whet I can get the version of math Jax. The script is to be written each time or has it to be save somewhere?

I assume Anki allows you to customize the HTML that it uses.  A quick Google search found me this:


that suggest that there is customization for the template for the cards that you could use to add MathJax and your own configuration.  The picture


suggests that the "Front Template" may be the right location for it.  Try adding

<script>
MathJax = {
  tex: {
    inlineMath: [['$','$'], ['\\(','\\)']],
    macros: {
      unicodeInt: ['\\mathop{\\vcenter{\\mathchoice{\\huge\\unicode{#1}}{\\unicode{#1}}{\\unicode{#1}}{\\unicode{#1}}}}\\nolimits', 1],
      oiint: '\unicodeInt{x222F}'
  }
}
</script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>

at the top of that text box and see if that works for you.  Use $x+y$ for in-line math and $$\frac x y$$ for displayed math expressions.

Davide

Sébastien Foy

unread,
Jul 23, 2020, 10:29:37 AM7/23/20
to mathja...@googlegroups.com
OK Davide. As I am not fluent I may have understand I. The wrong way what you wrote. I did have personalize the ccs in Anki. It should be at the same place? I'll see and tell you back. But $$ already works in math Jax. As soon as I am back from mountain! A great tkx u

Reply all
Reply to author
Forward
0 new messages