LaTeX-Box-Team / LaTeX-Box

Lightweight Toolbox for LaTeX - New Official repository
http://www.vim.org/scripts/script.php?script_id=3109
GNU General Public License v3.0
396 stars 66 forks source link

latexmk related functions don't work on MS windows #4

Open urob opened 12 years ago

urob commented 12 years ago

Currently the calls to latexmk and the viewer don't seem to work on Windows. Not sure whether that is something that can be fixed easily. I am hoping to find some time to look into that myself, but maybe you can give me a few hints what kind of adjustments would be necessary and which functions are affected. Great plugin otherwise! Would like to be able to use it for my work.

urob commented 12 years ago

To avoid a misunderstanding, latexmk itself is working seamlessly using newer versions of Miktex. It's just the wrappers in this script that need to be adjusted.

mvy commented 12 years ago

Yeah I noticed that too. And debug is not easy since all the window close so fast you can't read anything. I'll try to work on it thought. Keep me updated if you have more clue. We need to include the LICENSE too, I'll try to remind David if he has not done it til now.

urob commented 12 years ago

The problem with the fast closing windows can be circumvented by temporarily deleting the "silent" in front of the functions calling the compiler (line 85 in latexmk.vim).

There are apparently more than one problem that need to be addressed. The first one, which is easy to fix is that piping to /dev/null cannot be interpreted by the windows cmd. I just ended up deleting ">&/dev/null" in all the commands.

After this is fixed, I get the following error: "The system cannot find the file specified".

To narrow down this mistake further, I changed line 85 to just execute only the first part of the function (vimsetpid). Running this call to the VIM server, I still get the same mistake. One can replicate by typing on the command line:

( "C:\Program Files (x86)\Vim\vim73\gvim.exe" --server GVIM1 --remote-expr '47_LatexmkSetPID'(\"C:/paper\",$$)

From here on, I am pretty much stuck. I tried deleting "" which leads for the command to actually make the call to the VIM-Server. So maybe "<" and ">" need to be escaped on windows or one needs to change the naming of the functions?

mvy commented 12 years ago

Seems like many things are not accepted within cmd.exe, even with msys/mingw support. There is actually a call to ps with an option that is unrecognised, a cmd1; (cmd2); cmd3 where the parenthesis creates problems.

I don't think the project were intended to be used on win. I created a branch for win32-dev and will try some things.

Also, I think that there is use of some bashism like $$ and $? that are not understandable in win32 environment.

rubioz commented 12 years ago

I know this is an old issue, but how did this end?. I'm interested in using this plugin on Windows and I'm now facing the same problem.

Thanks

mvy commented 12 years ago

No progress. I have a lot of work at the moment.

mvy commented 12 years ago

Status update:

C:\Users\mvyonline>sh -c 'gvim.exe --servername GVIM --remote-expr "<SNR>34_LatexmkSetPID"\(\"These\",`echo $$`\)'

Fails to display the correct PID. Pops a error box saying : 0

brdann commented 11 years ago

I want to use this under Windows too. Been experiencing the same issues. I've tweaked the parameter send to cmd a bit and ended up with this:

C:\Windows\system32\cmd.exe /c (gvim.exe --servername GVIM1 --remote-expr "34_LatexmkSetPID(""E:\test\lozh"",$$)" & ( cd "E:\test" & set max_print_line=2000 & latexmk -pdf -quiet -e '$pdflatex =~ s/ / -file-line-error /' -e '$latex=~ s/ / -file-line-error /' "E:\test\lozh.tex" ) & gvim.exe --servername GVIM1 --remote-expr "34_LatexmkCallback(""E:\test\lozh"",$?)")

It seems to work, but generates an error saying "E449: Invalid expression received: Send expression failed." Any ideas how to fix this?

P.S. BTW, on Windows parenthesis does work, but you need to separate commands with '&' instead of semicolon.

Oberon00 commented 10 years ago

Works for me. Only the async option is broken ("Compiling to PDF..." is displayed but nothing happens). When I replace !start /b with !start /min in latexmk.vim:265, it works too.

lervag commented 10 years ago

Feel free to open a pull request. Since I don't use vim on windows, I am not able to test.

Oberon00 commented 10 years ago

I would have to try to reproduce this on another machine since it could eaily be a configuration issue/installation problem on my side.

salviati6 commented 9 years ago

I was on the same boat and confirmed the findings by @Oberon00: disabling g:LatexBox_latexmk_async or replacing !start /b with !start /min in ftplugin/latex-box/latexmk.vim:270 solves the problem. However, neither solution is flawless: the former solution disables the useful async compiling and the latter will keep a terminal window (minimized) on the taskbar.

Environment: Windows 7 SP1 64-bit, VIM 7.4.589 64-bit, latest version of LaTeX-Box.