markx icon indicating copy to clipboard operation
markx copied to clipboard

no mathjax result in the exported files

Open fyears opened this issue 12 years ago • 7 comments

As we all know that math formula support by mathjax is just js effect. So if someone export a pdf or docx file from the button, we cannot see any math formula result there.

I will consider it a bug. Hope some smart developer guys can fix it.

And at least there should be some warning.

PS: I found a tricky way, in case anyone need it. Click "change display", and print the page using chrome. It's a "better than never" way to export a "right" pdf file.

fyears avatar Jun 13 '13 16:06 fyears

Hi Pandoc is capable of handling mathjax and convert it to real math. The problem is that: a) Docverter doesn't support this, and b) latexonline API is broken.

So, if you got Pandoc and LaTeX on your machine you can use Markx locally to produce PDFs with math. Otherwise, you got to use workarounds until the latexonlne API comes back (opened issue here: aslushnikov/latex-online#2)

About the "there should be a warning" - Markx is not my work, it's a hobie project. Hopefully it's useful enough so that other people contribute. You are welcome to add a warning and open a pull-request.

Yoav

yoavram avatar Jun 21 '13 07:06 yoavram

OK, latex-online now works.

To convert Markdown with LaTeX to PDF you need to change the converter to Pandoc (by clicking the "D" button) and then convert to PDF (by clicking the Download and Convert menu and choosing PDF).

@fyears, please let me know if this works for you.

yoavram avatar Jun 24 '13 06:06 yoavram

@yoavram I select "pdf" and "word", the files are what we would expect. Cool.

But one more thing, bad news: I select "html", and the file can not deal with the display mode formula properly.

fyears avatar Jun 24 '13 12:06 fyears

@fyears which of the converters ("D" and "P") acts up? "P"? Does the formula appears correctly on the realtime preview? Can you upload the markdown to somewhere (like http://pastebin.com/)?

yoavram avatar Jul 09 '13 11:07 yoavram

@yoavram

Lets' make sure we are talking about the same thing at first: I have NEVER installed markx by myself. I ALWAYS use markx at https://markx.herokuapp.com/# .So you should be able to get the same result as mine easily. Maybe you were talking about the latest code in github, and I was talking about the not-updated version in the website?

Again, now I am using https://markx.herokuapp.com/# . I select "P". I convert the text in the website. The texts are below. The formula appears correctly on the realtime preview. The exported .docx and .pdf files are fine and as expected. But the formula in the exported .html is wrong.

The original markdown:

You can use $LaTeX$. Just write it between `$`s or `\\(` and `\\)` for inline equations and `$$`s or `\\[` and `\\]` for display mode:

- Inline mode $\frac{df(x)}{dt}=lim_{x \to 0}{\frac{f(x+h)-f(x)}{h}}$
- Display mode: $$\frac{df(x)}{dt}=lim_{x \to 0}{\frac{f(x+h)-f(x)}{h}}$$

The full rendered html code in the exported markx.html file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Style-Type" content="text/css" />
  <meta name="generator" content="pandoc" />
  <title></title>
</head>
<body>
<p>You can use <span class="math"><em>L</em><em>a</em><em>T</em><em>e</em><em>X</em></span>. Just write it between <code>$</code>s or <code>\\(</code> and <code>\\)</code> for inline equations and <code>$$</code>s or <code>\\[</code> and <code>\\]</code> for display mode:</p>
<ul>
<li>Inline mode <span class="math">$\frac{df(x)}{dt}=lim_{x \to 0}{\frac{f(x+h)-f(x)}{h}}$</span></li>
<li>Display mode: <br /><span class="math">$\frac{df(x)}{dt}=lim_{x \to 0}{\frac{f(x+h)-f(x)}{h}}$</span><br /></li>
</ul>
</body>
</html>

Hope it helps.

fyears avatar Jul 09 '13 13:07 fyears

Some additional tips:

I did some search, and found that <span class="math"> is usually used by jsmath . However the pandoc converter can't convert the formula with correct html, js and css code. It's not an easy job to fix the bug.

fyears avatar Jul 09 '13 13:07 fyears

@fyears The online version is the most updated AFAIK. And I didn't think you installed markx. So we are on the same page :+1:

From what you wrote I think that the problem may be solved by inserting the --mathjax option (see Pandoc Guide) in the pandoc function in server.py.

I'll try it and will update - it may take some time, though, because I'm a bit busy these days.

Thanks a lot for helping out debugging this!

yoavram avatar Jul 11 '13 14:07 yoavram