clayh53 / tufte-jekyll

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

The latest version renders `&` in aligned env as `amp;` #14

Closed quxiaofeng closed 9 years ago

quxiaofeng commented 9 years ago

The latest config of mathjax does not render <, >, & well. The < and > can be replaced by \lt and \gt respectively. However, there is no alternative solution for &.

The code:

{% math %}
D = \left(\begin{matrix}
1 & -1 & &      &   & \\
  &    & \cdots &   & \\
  &    &        & 1 & -1
\end{matrix}
\right)
{% endmath %}

line 35-41 of this markdown

will be rendered as this:

image

(This may be due to the mathjax env is set to centered ???)

quxiaofeng commented 9 years ago

Eh, the master branch of this repo is not working. For example, the lata_font_load should be lato_font_load in line 14 this page.

clayh53 commented 9 years ago

Fixed the typo. Will look into Mathjax

quxiaofeng commented 9 years ago

Thank you for your fix. If you want, you may take one of my posts as a test page (as a continuous test).

The mathjax is very tricky. There could be many errors there. The upgrading of the theme took much effort. One may not be willing to take the risk without a strong evidence (a post including various long and complex equations).

clayh53 commented 9 years ago

I have made some changes that should fix the Mathjax block problems with matrices and some symbols. Bottom line is that the Kramdown parser is very sensitive to these custom tags. In particular, if you want your matrix notation to display properly, you must surround the {% math %}...{%endmath%} with blank lines above and below the block. Also, the Mathjax documentation I referenced recommended that angle brackets should be written as |lt and |gt. One problem I have not solved is the inline matrix notation issue when using the inline tags. It simply doesn't work properly and displays the unwanted ampersands. I tried escaping them, but that just printed the ampersand and the html code entity!

clayh53 commented 9 years ago

fixed all but inline matrix notation in Mathjax content

ghost commented 9 years ago

fixed all but inline matrix notation in Mathjax content

If you're referring to display of ampersands for in-line equations... isn't this happening because in Latex the & symbol is used for aligned formula? Are ampersands used in-line for equations? Perhaps they are not being processed because they have no function for in-line equations.

Also, the Mathjax documentation I referenced recommended that angle brackets should be written as |lt and |gt

I think that's meant to be \lt and \gt since I read that literal pipes can screw up Mathjax. I think that it's recommended to use command \vert instead of the actual pipe symbol of | but I might be wrong about this.