Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Math rendering #25

Open
dpsanders opened this issue Sep 30, 2019 · 9 comments
Open

Math rendering #25

dpsanders opened this issue Sep 30, 2019 · 9 comments

Comments

@dpsanders
Copy link

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
Copy link
Owner

piever commented Sep 30, 2019

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:

  • Documenter needs to know it's a math block to not mess with it
  • Remark plus KaTeX needs \\\\ instead of \\ for escaping reasons (I may report a bug at Remark.js though, one shouldn't need to do this, maybe there is an option to fix it and as soon as I have time I can investigate)
  • the KaTeX environment is already an equation environment, so you cannot do an align block but you can do aligned.

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
Copy link
Author

dpsanders commented Oct 2, 2019

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
Copy link

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

@tbeason
Copy link

tbeason commented Aug 9, 2020

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
Copy link

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

@tbeason
Copy link

tbeason commented Aug 9, 2020

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

@tbeason
Copy link

tbeason commented Aug 9, 2020

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
Copy link
Owner

piever commented Aug 10, 2020

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 gnab/remark#336.

@danilo-bc
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants