Jonathan-LeRoux / IguanaTex

A PowerPoint add-in allowing you to insert LaTeX equations into PowerPoint presentations on Windows and Mac
http://www.jonathanleroux.org/software/iguanatex/
Other
902 stars 62 forks source link

Allow for custom LaTeX command, not just folder #64

Open francescoboc opened 6 months ago

francescoboc commented 6 months ago

Hi, I would like to tell Iguanatex to use my LaTeX installation in WSL (Windows Subsystem for Linux), but I cannot find this option. There is the option to specify a custom folder for the LaTeX installation under Windows, but that is not what I need.

Basically, instead of calling the command pdflatex, I would like it to call wsl -e pdflatex. I am confident that this would work because I am already using this approach for Texstudio for Windows:

image

Moreover, manually compiling the IguanaTex_tmp.tex with wsl -e pdflatex -output-format dvi -shell-escape -interaction=batchmode, which is the command called by Iguanatex preceeded by wsl -e, successfully produces the corresponding dvi file:

image

Thank you very much.

Jonathan-LeRoux commented 6 months ago

I think simply commenting out this line which adds a trailing slash to the path specified in the settings may work for your case. You would then just have to write wsl -e (with a trailing space) instead of a folder. I just tried and got the right string. Here is a version with the change.

Instead of that box being used to specify a folder, it's now used to specify more generally a "prefix". I simply warn the user that it's their responsibility to add a trailing slash or backslash (it's automatically fixed depending on the platform) if their prefix is a folder.

francescoboc commented 5 months ago

Thank you very much for the quick response! Unfortunately, this still throws an error:

image

I suspect that the problem might be in the quotes ", as if I try to manually re-run the command without them, it compiles:

image

Jonathan-LeRoux commented 5 months ago

Argh, that would have been too easy. I'm trying to think about the best way to solve this. Maybe check if wsl is part of the string and if so just not add quotes... Do you expect to use WSL also for Ghostscript and/or ImageMagick?

Jonathan-LeRoux commented 5 months ago

Here is a version that checks if the prefix starts with wsl and if so does not add quotes: IguanaTex_v1_61_1.zip

francescoboc commented 5 months ago

Here is a version that checks if the prefix starts with wsl and if so does not add quotes: IguanaTex_v1_61_1.zip

Thank you, this works like a charm! Even the dvisvgm command works!

Do you expect to use WSL also for Ghostscript and/or ImageMagick?

Yes, possibly. But I'm ok just with the basic functionality that I have now.

One comment: are quotes necessary at all? Wouldn't the pdflatex command in Windows work without them?

Jonathan-LeRoux commented 5 months ago

Great! I think it might also work for GS and ImageMagick if you set the corresponding command in the respective settings, as long as that command starts with wsl and includes the program being executed.

Quotes are only there in case there's a space in the path name. That being said, there may be a better way to handle this, such as only adding quotes to the path part (that would be assuming there's no space in the file name... Maybe that's always true?), or letting users add their own quotes in the settings if needed. I need to make sure there are no unintended consequences.