piever / Remark.jl

Create markdown presentations from Julia
Other
94 stars 14 forks source link

Math rendering #25

Open dpsanders opened 5 years ago

dpsanders commented 5 years ago

Very nice package, thanks!

I'm having some trouble with rendering of math -- it doesn't seem to be rendering nicely. E.g. \begin{align} blocks don't work at all. Is there some option I need to use for this?

piever commented 5 years ago

You're welcome!

There may be two separate issues. If things "look bad" it may be a problem with KaTeX fonts which is fixed on master. Just updating to Remark#master (and maybe deleting the "build" folder, to make sure things get redone properly) should fix it. I'll try to tag a release soonish.

Concerning multiline environment, see also #16. If you are using the default option of running Documenter on the output (to include julia code), your best bet is something like:

```math
\begin{aligned}
e^{i\pi} + 1 &= 0 \\\\
\sum_{n=0}^\infty \alpha^n &= \frac{1}{1-\alpha}
\end{aligned}
``` % Documenter syntax for math block

It seems weird but can be explained as follows:

Hope that helps, sorry if it's a bit confused!

I'll keep this issue open because, even if things stay as they are, this could be better documented.

dpsanders commented 5 years ago

With master the math rendering looks great, thanks!

It would really be great to get everything working just as is. I'm using Weave syntax; it feels like between Weave.jl and Remark.jl it should be possible to automate the transformations necessary for everything to just work!

~What about inline math by the way?~ Inline math works fine, it's mainly the align blocks that are the issue now.

Thanks!

ericphanson commented 4 years ago

In case anyone else is running into this now too, I'll add that you need to escape underscores too!

tbeason commented 4 years ago

I'm actually having considerable trouble with math rendering. It seems like the parsing is completely off at times. Small pieces of my expression can render correctly, but when I type the whole thing it fails.

expression:

$$W_T = \sum_{t=0}^T C_t \prod_{s=t+1}^T R_s$$

These work

$$\sum_{t=0}^T C_t$$ 

$$\prod_{s=t+1}^T R_s$$

but in combination they fail.

ericphanson commented 4 years ago

Try escaping the underscores, that’s what helped for me.

tbeason commented 4 years ago

I did try and that did not help. I also tried putting it in a math environment.

tbeason commented 4 years ago

Ah. Update: I had missed escaping some underscores. It does work now.

This is obviously not the ideal solution though as it prevents copy-paste from LaTeX (and is prone to error I guess!).

piever commented 4 years ago

Having to escape underscore in LaTeX is definitely not ideal. OTOH, there is not much that can be done for that here. That is an upstream issue in Remark.js https://github.com/gnab/remark/issues/336.

danilo-bc commented 3 years ago

This issue doesn't seem to be properly fixed yet. Can it be solved by Julia? We have LaTeXStrings.jl, since Remark.jl can plot using Plots, could we show these math bits using Julia like that?

It would be a nice workaround for the time being.