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

cannot show the svg but the pure text link #4

Open
shelper opened this issue Dec 8, 2020 · 11 comments
Open

cannot show the svg but the pure text link #4

shelper opened this issue Dec 8, 2020 · 11 comments

Comments

@shelper
Copy link

shelper commented Dec 8, 2020

did i miss anything ?
many thanks!
image

@yangsheng6810
Copy link
Owner

This seems an empty SVG. Could you type a few more characters in the math area to see if it updates correctly?

If that does not work, could you elaborate what's your platform, Emacs version, mathjax-node-cli version? And what's your configuration.

@shelper
Copy link
Author

shelper commented Dec 9, 2020

windows 10, emacs 27.1, with RSVG support, mathjax-node-cli @1.0.1,
configuration is as simple as your suggestion, but i have mathjax-node-cli installed in my develop folder as below:

(use-package org-latex-impatient
  :defer t
  :hook (org-mode . org-latex-impatient-mode)
  :init
  (setq org-latex-impatient-tex2svg-bin "~/Develop/node_modules/mathjax-node-cli/bin/tex2svg") ; first location
  (setq org-latex-impatient-tex2svg-bin "~/Develop/node_modules/.bin/tex2svg")  ; second location
)

i found i have two locations has this tex2svg. if i use the first location, i got error:
Error running timer ‘org-latex-impatient-start’: (error "Variable org-latex-impatient-tex2svg-bin is not set correctly")
if i use second location, i got the above output of empty SVG

@yangsheng6810
Copy link
Owner

Could you try invoking tex2svg directly? E.g.

~/node_modules/mathjax-node-cli/bin/tex2svg "\frac{x}{x^4}" > 1.svg

And open 1.svg to see if tex2svg works by itself?

@shelper
Copy link
Author

shelper commented Dec 9, 2020

since i am under windows, i have to run something like this:
node tex2svg "\frac{x}{x^4}" > 1.svg , and it worked

i also tried to run the tex2svg.cmd without node as a prefix and it also worked
tex2svg.cmd "\frac{x}{x^4}" > 1.svg

@yangsheng6810
Copy link
Owner

I am not familiar with how Emacs calls external processes on Windows. Could you try setting org-latex-impatient-tex2svg-bin to the cmd file you tried? Like (setq org-latex-impatient-tex2svg-bin "~/Develop/node_modules/mathjax-node-cli/bin/tex2svg.cmd") if that is where the file is located.

@shelper
Copy link
Author

shelper commented Dec 9, 2020

i did try that , and that is how i saw the popup with that empty svg...

anyway, thanks for the help!

@yangsheng6810
Copy link
Owner

I suspect it may have something to do with how make-process is handled in Windows. Unfortunately, I do not really have much experience of running Emacs in Windows, and there is not much I can help.

BTW, did you try removing the tests with executable-find, and see if your first location works?

@shelper
Copy link
Author

shelper commented Dec 9, 2020

executable-find finds the bin file, and the bin file executes and creates svg correctly under CMD ...

nevermind, i will try to debug little bit if i have time, thanks!

@exilsteira
Copy link

I was able to solve similar issues on Windows 10.

  1. In org-latex-impatient-start, I removed the linebreaks when joining org-latex-impatient-user-latex-definitions. I did this because I wasn't able to handle multiline arguments to tex2svg.
  2. In org-latex-impatient-start, I needed to replace all carets with four (!) carets using (setq tex-string (s-replace-all '(("^" . "^^^^")) tex-string)). Carets are used in Windows to mask the following characters.
  3. In org-latex-impatient--add-color, I replaced color with org-latex-impatient-border-color since the color value returned by (face-foreground 'default) was not recognized by my MiKTeX installation.
  4. Since I didn't install node, I needed to write a batch script. Within this script, I first create a pdf using pdflatex, then converting it to svg with dvisvgm which is part of my MiKTeX installation. It is far from being perfect, but it fits my basic needs.

@dian-yu-luo
Copy link

after two years, windows still have this problem

@yangsheng6810
Copy link
Owner

Unfortunately, there is not much that I can do. I am not familiar with programming on Windows, and the solution by @exilsteira suggests some non-trivial steps, e.g. carets for escaping and MiKTeX setup. My impression is that make-process might cause further trouble on Windows.

On the other hand, maybe it is a good idea to try Emacs in WSL2 (WSL1 should also be fine, but I/O for small files sucks). It is much faster, reliable, and less problematic than a Windows build. I am running org-latex-impatient on Emacs in WSL2 with no issue.

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

4 participants