clayh53 / tufte-jekyll

Minimal Jekyll blog styled to resemble the look and layout of Edward Tufte's books
MIT License
620 stars 206 forks source link

Math in marginnote (and change of MathJax id) #36

Closed ekstroem closed 8 years ago

ekstroem commented 8 years ago

Hi.

This may just be a liquid problem (or rather a user problem of not understanding the liquid tags) but I'd like to add a wee bit of inline math to a margin note with the following code

{% marginnote 'ID9' 'Yada yada yada. A {% m %} X^2 {% em %} test for this table yada yada yada' %}

However, that results in an error

Liquid Exception: Unmatched double quote:

and I'm guessing that I cannot nest liquid tags inside one another.

One option is to change the math start and end tags to $ (for inline) and $$ (for block) as is possible with other configurations of MathJax. Would doing that break a lot of things (and if no: can anyone point me in the right direction for this)?

clayh53 commented 8 years ago

let me look into it. The issue may be a 'tags within tags' thing. But if we can just use the default '$' and '$$' tags that are baked into Mathjax, that may be the way to go.

On Mar 9, 2016, at 10:44 AM, Claus Ekstrøm notifications@github.com wrote:

Hi.

This may just be a liquid problem (or rather a user problem of not understanding the liquid tags) but I'd like to add a wee bit of inline math to a margin note with the following code

{% marginnote 'ID9' 'Yada yada yada. A {% m %} X^2 {% em %} test for this table yada yada yada' %} However, that results in an error

Liquid Exception: Unmatched double quote:

and I'm guessing that I cannot nest liquid tags inside one another.

One option is to change the math start and end tags to $ (for inline) and $$ (for block) as is possible with other configurations of MathJax. Would doing that break a lot of things (and if no: can anyone point me in the right direction for this)?

— Reply to this email directly or view it on GitHub.

ghost commented 8 years ago

So I hadn't looked into this before, but now that I do, it turns out Jekyll's default Markdown renderer has built-in MathJax support http://kramdown.gettalong.org/math_engine/mathjax.html

So @ekstroem either of these snippets work great!

{% marginnote 'ID9' 'Yada yada yada. A $$X^2$$ test for this table yada yada yada' %}
{% marginnote 'ID9' 'Yada yada yada. A \\(X^2\\) test for this table yada yada yada' %}

@clayh53 Apparently there is no need for the mathjaxtag.rb plugin.

So using $ and $$ for equations is easy to setup by how you load mathjax into the page. See http://docs.mathjax.org/en/latest/start.html#tex-and-latex-input

clayh53 commented 8 years ago

Oh, snap! I do remember reading some documentation about Kramdown having this ability. That makes it easy!

On Mar 10, 2016, at 4:04 AM, Nick notifications@github.com wrote:

So I hadn't looked into this before, but now that I do, it turns out Jekyll's default Markdown renderer has built-in MathJax support http://kramdown.gettalong.org/math_engine/mathjax.html

So @ekstroem either of these snippets work great!

{% marginnote 'ID9' 'Yada yada yada. A $X^2$ test for this table yada yada yada' %} {% marginnote 'ID9' 'Yada yada yada. A (X^2) test for this table yada yada yada' %} @clayh53 There is no need for the mathjaxtag.rb plugin! Using $ and $$ for equations is easy to setup by how you load mathjax into the page. See http://docs.mathjax.org/en/latest/start.html#tex-and-latex-input

— Reply to this email directly or view it on GitHub.

ekstroem commented 8 years ago

Great! I can confirm that

{% marginnote 'ID9' 'Yada yada yada. A $X^2$ test for this table yada yada yada' %}

works. I previously had some problems with $ signs in the main text (in the sense that they were rendered as dollar signs and not starting/ending math blocks) - I'll try to see if I can reproduce this. In any case: this works!

Cheers

ghost commented 8 years ago

Using $ for inline equations is disabled by default in mathjax See https://github.com/clayh53/tufte-jekyll/issues/38 for how to enable it.

ekstroem commented 8 years ago

Hmm. It works out of the box here at my end (what I really mean is that I cannot remember what I've tinkered with previously but I cannot see a change like fix #38 anywhere. In any case there's a good solution, and I'm happy :)

ghost commented 8 years ago

Ok cool.