scripts icon indicating copy to clipboard operation
scripts copied to clipboard

latex-math runs wrong on my mac. I set the path to klatexformula correctly, but it still doesn't work.

Open jwli6 opened this issue 3 years ago • 10 comments

@r00tr4v3n, @Aganel hello, latex-math runs wrong on my mac. I set the path to klatexformula correctly, but it still doesn't work. I debugged myself and found that the command generated by the script bash -c "kalatexformula" -f xxx; I can generate the file when I run it in the terminal, but the script runs correctly and does not generate the corresponding image file.

Originally posted by @jwli6 in https://github.com/qownnotes/scripts/issues/154#issuecomment-1153428986

jwli6 avatar Jun 14 '22 00:06 jwli6

Maybe something with #2299?

pbek avatar Jun 14 '22 13:06 pbek

Where is #2299? Can you give me a link? Thanks!

jwli6 avatar Jun 15 '22 02:06 jwli6

Ah, sorry. I fixed the link.

pbek avatar Jun 15 '22 06:06 pbek

Thank u very much! I have checked it, and found that execute open /bin/bash --args -c xxx on the terminal, where bash cannot receive arguments, but only open -a /bin/bash --args -c xxx can work. In addition, the --args parameter of command open in macOS12.3.1 has not changed. So how to make script.startDetachedProcess execute with open -a?

jwli6 avatar Jun 15 '22 07:06 jwli6

So the image generation works with different parameters? You could make a pull request to differentiate arguments between operating systems or just modify it in your script folder for a quick fix.

r00tr4v3n avatar Jun 15 '22 08:06 r00tr4v3n

So how to make script.startDetachedProcess execute with open -a

I don't think there currently still is a real solution for https://github.com/pbek/QOwnNotes/issues/2299.

pbek avatar Jun 15 '22 08:06 pbek

You could make a pull request to differentiate arguments between operating systems or just modify it in your script folder for a quick fix.

Yes, I downloaded the script file and added the log to debug locally.

So the image generation works with different parameters?

No, I replaced the print log with log(`exec:${exec} param:${param}`), then its output is exec:zsh param:-c,'"/Applications/klatexformula.app/Contents/MacOS/klatexformula" -f "#RRGGBB" -b "-" --base64arg --preamble="XHVzZXBhY2thZ2V7YW1zbWF0aH1cdXNlcGFja2FnZXthbXNzeW1ifVx1c2VwYWNrYWdle2Ftc2ZvbnRzfQ==" --base64arg --latexinput="XGJmICB4X2kgPSBcZnJhY3sxfXsyfQ==" --dpi 400 --quiet 1 --output /Users/UserMe/Library/Caches/PBE/QOwnNotes/scripts/latex-math/34a904272f48aae2fa7b8ce61c157228.png'.

The whole process did not report any errors, but the latex image could not be displayed, and no image files were seen in the corresponding path/to/scripts/latex-math. I tried to enter the command zsh -c '"/Applications/klatexformula.app/Contents/MacOS/klatexformula" -f "#RRGGBB" -b "-" --base64arg --preamble="XHVzZXBhY2thZ2V7YW1zbWF0aH1cdXNlcGFja2FnZXthbXNzeW1ifVx1c2VwYWNrYWdle2Ftc2ZvbnRzfQ==" --base64arg --latexinput="XGJmICB4X2kgPSBcZnJhY3sxfXsyfQ==" --dpi 400 --quiet 1 --output /Users/UserMe/Library/Caches/PBE/QOwnNotes/scripts/latex-math/34a904272f48aae2fa7b8ce61c157228.png' in the terminal, and then check that there are corresponding image files in the path/to/scripts/latex-math folder, and the latex images are also displayed normally.

Why use zsh instead of bash, because I found that the above command on the command line will prompt if bash is used: getcwd cannot access the parent directory: No such file or directory

jwli6 avatar Jun 15 '22 08:06 jwli6

I don't think there currently still is a real solution for pbek/QOwnNotes#2299.

Maybe as @ckayr said, let the developer decide how to open other programs?😊

jwli6 avatar Jun 15 '22 08:06 jwli6

@r00tr4v3n And, do you thinking this is a bug? 😉

jwli6 avatar Jun 15 '22 09:06 jwli6

Could be. I cannot test it though.

r00tr4v3n avatar Jun 16 '22 09:06 r00tr4v3n

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Apr 04 '23 15:04 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Apr 19 '23 02:04 github-actions[bot]