I'm having a problem with vimtex on a Windows machine when spaces are in the path. The callback is not triggered successfully (so success/failure is never indicated). None of my settings in my vimrc file affect this. However, I have managed to correct for this problem by modifying latexmk.vim. The change I made to latexmk.vim is below.
call vimtex#util#set_default('g:vimtex_latexmk_progname',
\ get(v:, 'progname', get(v:, 'progpath')))
"should" become
call vimtex#util#set_default('g:vimtex_latexmk_progname',
\ get(v:, 'progpath', get(v:, 'progname')))
in order that the callback is able to message gvim. Note that, in my case, performing the above change modifies the default value of g:vimtex_latexmk_progname from C:\Users\John Rinehart\Programs\vim_64\gvim.exe to gvim.exe for me.
This seems related to #297.
Hi! I'll look into this later, I'm currently working on a pretty big refactoring (cf. #651), and it will be easier to address this problem after rather than before.
In the meantime, it seems you have a workaround that works. There was a reason I used progpath instead of progname, but I see now that I should properly escape it.
No stresses, @lervag. It's good to see you're still hard at work. I want you to know that I've been a vimtex advocate for ~2 years, now. gvim + vimtex is my sole LaTeX IDE (and I do all of my Ph.D. and personal write-ups using LaTeX).
Happy to hear that you like vimtex :)
I'm curious, could you not just set the option to solve this issue? There is a reason I use progpath, and I don't really want to change the default. It should work. You should be able to just do set g:vimtex_latexmk_progname = v:progname.
Another thing you could do that would be helpful: Could you open the compiler output :VimtexOutput or \lo and see if it says anything related to this for the case where the callback does not work?
Yeah, I can change the option. That's a good idea.
The issue I'm having is on my work computer. I'm not going into work until tomorrow. I'll try to remember to check the :VimtexOutput tomorrow. Are you hoping to see something like "could not execute callback - bad program name"?
Yes, or at least something that might hint at why the callback does not
work.
Den tir. 28. mar. 2017, 22.06 skrev John Rinehart <[email protected]
:
Yeah, I can change the option. That's a good idea.
The issue I'm having is on my work computer. I'm not going into work until
tomorrow. I'll try to remember to check the :VimtexOutput tomorrow. Are
you hoping to see something like "could not execute callback - bad program
name"?—
You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub
https://github.com/lervag/vimtex/issues/736#issuecomment-289888304, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AA898gkp8aILMKtJdk-aavaD6A7wyOaJks5rqWg6gaJpZM4Ml9im
.
There's been a ton of updates the last week. Could you test on the most recent version? I think I have the same problem, and since gvim is not in my path on windows, I was not able to get callbacks working. I know too little about windows and the cmd stuff to fix it, though :(
Note the new option: g:vimtex_compiler_progname, and also g:vimtex_compiler_latexmk for setting latexmk related options. See updated docs.
Hey, @lervag, you've been busy! No problem. I'll make some time to do this tonight/tomorrow. Give me 24 hours.
Yes, the last two weeks have been quite heavy on vimtex. I've restructured and refactored quite abit, and I'm currently continuing this. The goal is to support the new jobs api in Vim (and perhaps also neovim), and I also hope this will make it easier to get things working properly on windows.
I think things should now have improved. The callbacks should work. The Vim jobs api is enabled, if available. Etc. I don't think you need to change the g:vimtex_compiler_progname option any longer, either. Please test, I'd be happy to get some feedback, be it positive or negative. :)
Okay, "24 hours later" I'm back with some information. It still seems that compilation is broken on Windows when the path to vim/gvim has spaces. I'm on commit ddaa9bc6ba5406a5bba9890e49dcd64c877398b7 and below I've included the output from :VimtexInfo, latexmk, and I've also included the settings I've used to modify vim for use with vimtex (my vimtex.vimrc).
vimtex project: test
base: test.tex
root: C:\Users\John Rinehart
tex: C:\Users\John Rinehart\test.tex
out: C:\Users\John Rinehart/test.pdf
log: C:\Users\John Rinehart/test.log
aux: C:\Users\John Rinehart/test.aux
compiler: latexmk
backend: jobs
output: C:\Users\JOHNRI~1\AppData\Local\Temp\VIAEFF2.tmp
configuration:
continuous: 1
callback: 1
latexmk options:
-verbose
-pdf
-file-line-error
-synctex=1
-interaction=nonstopmode
job: process 7072 dead
cmd: set max_print_line=2000 & latexmk -verbose -pdf -file-line-error -synctex=1 -interaction=nonstopmode -pvc -e "$pdf_previewer = 'SumatraPDF'" -e "$success_cmd = '""""C:\Users\John Rinehart\Programs\vim_64\gvim.exe"""" --servername GVIM2 --remote-expr \"vimtex\#compiler\#callback\\(1\\)\"'" -e "$failure_cmd = '""""C:\Users\John Rinehart\Programs\vim_64\gvim.exe"""" --servername GVIM2 --remote-expr \"vimtex\#compiler\#callback\\(0\\)\"'" "test.tex"
viewer: General
qf: LaTeX logfile
config:
fix_paths: 1
packages:
default: 1
default: 1
Latexmk: Stopping because executing following code from command line
$success_cmd = '"C:\Users\John
gave an error:
Can't find string terminator "'" anywhere before EOF at (eval 11) line 1.
C:\texlive\2016\bin\win32\runscript.tlu:679: command failed with exit code 2:
perl.exe c:\texlive\2016\texmf-dist\scripts\latexmk\latexmk.pl -verbose -pdf -file-line-error -synctex=1 -interaction=nonstopmode -pvc -e "$pdf_previewer = 'SumatraPDF'" -e "$success_cmd = '""""C:\Users\John Rinehart\Programs\vim_64\gvim.exe"""" --servername GVIM2 --remote-expr \"vimtex\#compiler\#callback\\(1\\)\"'" -e "$failure_cmd = '""""C:\Users\John Rinehart\Programs\vim_64\gvim.exe"""" --servername GVIM2 --remote-expr \"vimtex\#compiler\#callback\\(0\\)\"'" "test.tex"
nmap <F9> <plug>(vimtex-compile)
if has("win32")
let g:vimtex_view_general_viewer = 'SumatraPDF'
" let g:vimtex_latexmk_progname='gvim'
elseif has("unix")
let g:vimtex_view_general_viewer = 'mupdf'
"let g:vimtex_latexmk_progname='vim'
endif
How strange. This works for me with similar options on Windows. My path to gvim is C:\Program Files (x86)\Vim\Vim80\gvim.exe, which does contain spaces.
Could you try to set g:vimtex_view_automatic = 0? I dont expect it to make a difference, but as far as I can see it is the only thing that is different...
I'm on Windows 10. I don't know what makes a difference on Windows systems. :\
Just to make sure: If you do let g:vimtex_compiler_progname = 'gvim', things work as expected?
Putting let g:vimtex_view_automatic = 0 in my vimtex.vimrc file and then sourcing it doesn't fix the callback.
However, placing let g:vimtex_compiler_progname = 'gvim' in my vimtex.vimrc does allow for successful compilation (no more "string terminator" error). However, a successful compilation (or toggling off/on of compilation) triggers a pop-up in gvim claiming
.
The tmp file output and the :VimtexInfo output are supplied below. My PDF viewer is not loaded (due to failed callback, probably) once a compilation is successful. However, I do get notified regarding changes in the compilation status when I toggle compilation ("compiler: stopped (test.tex)" <-> "compiler: started continuous mode"). I only get the pop-up when compilation is toggled to the started state (when compilation is started), not when it's toggled to the stopped state (when compilation is stopped).
I am also on Windows 10. But, I wouldn't expect this issue to be related to particular version of Windows.
Latexmk: All targets (test.pdf) are up-to-date
2017, version: 4.52c.
Not using a previewer
------------
Running '"gvim" --servername GVIM --remote-expr "vimtex\#compiler\#callback\(1\)"'
------------
vimtex project: test
base: test.tex
root: C:\Users\John Rinehart
tex: C:\Users\John Rinehart\test.tex
out: C:\Users\John Rinehart/test.pdf
log: C:\Users\John Rinehart/test.log
aux: C:\Users\John Rinehart/test.aux
compiler: latexmk
backend: jobs
output: C:\Users\JOHNRI~1\AppData\Local\Temp\VIA87F2.tmp
configuration:
continuous: 1
callback: 1
latexmk options:
-verbose
-pdf
-file-line-error
-synctex=1
-interaction=nonstopmode
job: process 11524 run
cmd: set max_print_line=2000 & latexmk -verbose -pdf -file-line-error -synctex=1 -interaction=nonstopmode -pvc -view=none -e "$success_cmd = '""""gvim"""" --servername GVIM --remote-expr \"vimtex\#compiler\#callback\\(1\\)\"'" -e "$failure_cmd = '""""gvim"""" --servername GVIM --remote-expr \"vimtex\#compiler\#callback\\(0\\)\"'" "test.tex"
viewer: General
qf: LaTeX logfile
config:
fix_paths: 1
packages:
default: 1
default: 1
Does the error contain more information than that? If so, could you paste the entire message here? Note that you can see old messages with :messages. I think we should solve that problem.
Btw, could you try this:
let g:vimtex_compiler_latexmk = {
\ 'backend' : 'process',
\}
I.e., use the "old" backend instead of the new. Perhaps we get more understandable error messages, or perhaps it even works..?
I'm not sure which error you are asking about. There is the gvim pop-up error message regarding the send expression and the error message generated by latex regarding the string terminator. But, I included the full text of both error messages. So, there is no more information for either message.
Including
let g:vimtex_compiler_latexmk = {
\ 'backend' : 'process',
\}
in my vimtex.vimrc does not change the behavior of vimtex with regards to my most recent comment.
I want to note that I was mistaken in my earlier post in that I claimed the PDF viewer is not loaded. Removing let g:vimtex_compiler_progname = 'gvim' from my vimtex.vimrc file results in the PDF viewer being loaded upon successful compilation. Including this line prohibits the PDF viewer from loading (which makes sense).
I meant the pop-up message, but it doesn't matter if there was no more info.
But ok, I checked the error message, and I understand: The problem is that I've added \\ infront of the parantheses for the callback function on windows. I needed this for things to work on my end on Windows, and so I thought this was a general windows thing. apparently not. :(
So, what to do..??? Things will work for you with no error if you have the progname set and if you remove the \\s in the code (see line 175 in compiler/latexmk.vim). But I need to understand exactly when we need those slashes.
So: What's your latexmk version?
Could you test with the same test that I use? I've just pushed an example as you should see above in the thread. At VIMTEX/test/issues/736. If you open a terminal/cmd window/whatever, and write gvim -u minivimrc, it should automatically start compilation.
I have two Windows machines at my disposal: one is proving troublesome with vimtex and the other is functional. The troublesome one is my work machine (PC). The functional one is my laptop. Both use Windows 10 and similar OS configuration and installed software. The major difference between these two computers is that one has spaces in its paths (starting at C:\Users\John Rinehart) and the other has no spaces in paths to either gvim.exe or the test LaTeX file.
I ran some tests using the same vimtex.vimrc file on both machines (all of my vim settings are network-synchronized between them). Below I document some of that work. There are four use cases that I studied before I tried your recommendation at the end of the last message (at the bottom of this message). I only adjusted two things: 1) let g:vimtex_compiler_progname and 2) the double slashes in the callback. I describe those test conditions below.
| Test Number | g:vimtex_compiler_progname | Double Slashes |
| -------------- | ------------- | ------------- |
| 1 (desired) | unset (set by vimtex automatically) | Present |
| 2 (least invasive) | gvim.exe | Present |
| 3 | unset (set by vimtex automatically) | Removed |
| 4 (most invasive) | gvim.exe | Removed |
For clarity, and ease of entry, I have included the results of these tests using 4 later comments. I perform your requested test on the last comment.
Again, each test was run on each machine. The results are described below.
_vimtex.vimrc_
nmap <F9> <plug>(vimtex-compile)
if has("win32")
let g:vimtex_view_general_viewer = 'SumatraPDF'
endif
_line 175(ish)_
let l:func = l:cb . ' --remote-expr '
\ . (has('win32')
\ ? '\"vimtex\#compiler\#callback\\(' . l:val . '\\)\"'
\ : '\"vimtex\#compiler\#callback(' . l:val . ')\"')
_latexmk temporary file output_
Latexmk: Stopping because executing following code from command line
$success_cmd = '"C:\Users\John
gave an error:
Can't find string terminator "'" anywhere before EOF at (eval 11) line 1.
C:\texlive\2016\bin\win32\runscript.tlu:679: command failed with exit code 2:
perl.exe c:\texlive\2016\texmf-dist\scripts\latexmk\latexmk.pl -verbose -pdf -file-line-error -synctex=1 -interaction=nonstopmode -pvc -e "$pdf_previewer = 'SumatraPDF'" -e "$success_cmd = '""""C:\Users\John Rinehart\Programs\vim_64\gvim.exe"""" --servername GVIM --remote-expr \"vimtex\#compiler\#callback\\(1\\)\"'" -e "$failure_cmd = '""""C:\Users\John Rinehart\Programs\vim_64\gvim.exe"""" --servername GVIM --remote-expr \"vimtex\#compiler\#callback\\(0\\)\"'" "test.tex"
_:VimtexInfo output_
vimtex project: test
base: test.tex
root: C:\Users\John Rinehart
tex: C:\Users\John Rinehart\test.tex
out: C:\Users\John Rinehart/test.pdf
log: C:\Users\John Rinehart/test.log
aux: C:\Users\John Rinehart/test.aux
compiler: latexmk
backend: jobs
output: C:\Users\JOHNRI~1\AppData\Local\Temp\VIA8CA4.tmp
configuration:
continuous: 1
callback: 1
latexmk options:
-verbose
-pdf
-file-line-error
-synctex=1
-interaction=nonstopmode
job: process 9644 dead
cmd: set max_print_line=2000 & latexmk -verbose -pdf -file-line-error -synctex=1 -interaction=nonstopmode -pvc -e "$pdf_previewer = 'SumatraPDF'" -e "$success_cmd = '""""C:\Users\John Rinehart\Programs\vim_64\gvim.exe"""" --servername GVIM --remote-expr \"vimtex\#compiler\#callback\\(1\\)\"'" -e "$failure_cmd = '""""C:\Users\John Rinehart\Programs\vim_64\gvim.exe"""" --servername GVIM --remote-expr \"vimtex\#compiler\#callback\\(0\\)\"'" "test.tex"
viewer: General
qf: LaTeX logfile
config:
fix_paths: 1
packages:
default: 1
default: 1
latexmk starts and quickly exits without producing any output (neither log files nor PDF).
PDF viewer does not open automatically.
_latexmk temporary file output_
Latexmk: Stopping because executing following code from command line
$success_cmd = '"gvim
gave an error:
Can't find string terminator "'" anywhere before EOF at (eval 13) line 1.
_:VimtexInfo output_
vimtex project: test
base: test.tex
root: C:\Users\JohnRinehart
tex: C:\Users\JohnRinehart\test.tex
out: C:\Users\JohnRinehart/test.pdf
log:
aux:
compiler: latexmk
backend: jobs
output: C:\Users\JOHNRI~2\AppData\Local\Temp\VIADDD3.tmp
configuration:
continuous: 1
callback: 1
latexmk options:
-verbose
-pdf
-file-line-error
-synctex=1
-interaction=nonstopmode
job: process 5748 dead
cmd: set max_print_line=2000 & latexmk -verbose -pdf -file-line-error -synctex=1 -interaction=nonstopmode -pvc -e "$pdf_previewer = 'SumatraPDF'" -e "$success_cmd = '""""gvim"""" --servername GVIM2 --remote-expr \"vimtex\#compiler\#callback\\(1\\)\"'" -e "$failure_cmd = '""""gvim"""" --servername GVIM2 --remote-expr \"vimtex\#compiler\#callback\\(0\\)\"'" "test.tex"
viewer: General
qf: LaTeX logfile
config:
fix_paths: 1
packages:
default: 1
default: 1
latexmk starts and quickly exits without producing any output (neither log files nor PDF).
PDF viewer does not open automatically.
_vimtex.vimrc_
nmap <F9> <plug>(vimtex-compile)
if has("win32")
let g:vimtex_view_general_viewer = 'SumatraPDF'
let g:vimtex_compiler_progname = 'gvim'
endif
_line 175(ish)_
let l:func = l:cb . ' --remote-expr '
\ . (has('win32')
\ ? '\"vimtex\#compiler\#callback\\(' . l:val . '\\)\"'
\ : '\"vimtex\#compiler\#callback(' . l:val . ')\"')
_latexmk temporary file output_
Latexmk: applying rule 'pdflatex'...
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016/W32TeX) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2017/01/01> patch level 3
Babel <3.9r> and hyphenation patterns for 83 language(s) loaded.
(c:/texlive/2016/texmf-dist/tex/latex/base/minimal.cls
Document Class: minimal 2001/05/25 Standard LaTeX minimal class
) (./tesLatexmk: Log file says output to 'test.pdf'
Rule 'pdflatex': File changes, etc:
Changed files, or newly in use since previous run(s):
'test.aux'
------------
Run number 2 of rule 'pdflatex'
------------
------------
Running 'pdflatex -file-line-error -synctex==== TeX engine is 'pdfTeX'
Latexmk: applying rule 'pdflatex'...
Latexmk: Log file says output to 'test.pdf'
Latexmk: I have not found a previewer that is already running.
So I will start it for 'test.pdf'
------------
------------
Running 'start SumatraPDF "test.pdf"'
------------
------------
Running '"gvim" --servername GVIM --remote-expr "vimtex\#compiler\#callback\(1\)"'
------------
minimal 2001/05/25 Standard LaTeX minimal class
) (./test.aux) [1{c:/texlive/2016/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./test.aux) )<c:/texlive/2016/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on test.pdf (1 page, 9468 bytes).
SyncTeX written on test.synctex.gz.
Transcript written on test.log.
=== TeX engine is 'pdfTeX'
Latexmk: All targets (test.pdf) are up-to-date
For rule 'view', running '&if_source( )' ...
_:VimtexInfo output_
vimtex project: test
base: test.tex
root: C:\Users\John Rinehart
tex: C:\Users\John Rinehart\test.tex
out: C:\Users\John Rinehart/test.pdf
log: C:\Users\John Rinehart/test.log
aux: C:\Users\John Rinehart/test.aux
compiler: latexmk
backend: jobs
output: C:\Users\JOHNRI~1\AppData\Local\Temp\VIABDF1.tmp
configuration:
continuous: 1
callback: 1
latexmk options:
-verbose
-pdf
-file-line-error
-synctex=1
-interaction=nonstopmode
job: process 10372 run
cmd: set max_print_line=2000 & latexmk -verbose -pdf -file-line-error -synctex=1 -interaction=nonstopmode -pvc -e "$pdf_previewer = 'SumatraPDF'" -e "$success_cmd = '""""gvim"""" --servername GVIM --remote-expr \"vimtex\#compiler\#callback\\(1\\)\"'" -e "$failure_cmd = '""""gvim"""" --servername GVIM --remote-expr \"vimtex\#compiler\#callback\\(0\\)\"'" "test.tex"
viewer: General
qf: LaTeX logfile
config:
fix_paths: 1
packages:
default: 1
default: 1
latexmk works great and all auxiliary/log/PDF files are generated.
Error window pops up complaining about invalid send expression.
_latexmk temporary file output_
Latexmk: Stopping because executing following code from command line
$success_cmd = '"C:\Users\John
gave an error:
Can't find string terminator "'" anywhere before EOF at (eval 11) line 1.
C:\texlive\2016\bin\win32\runscript.tlu:679: command failed with exit code 2:
perl.exe c:\texlive\2016\texmf-dist\scripts\latexmk\latexmk.pl -verbose -pdf -file-line-error -synctex=1 -interaction=nonstopmode -pvc -e "$pdf_previewer = 'SumatraPDF'" -e "$success_cmd = '""""C:\Users\John Rinehart\Programs\vim_64\gvim.exe"""" --servername GVIM --remote-expr \"vimtex\#compiler\#callback(1)\"'" -e "$failure_cmd = '""""C:\Users\John Rinehart\Programs\vim_64\gvim.exe"""" --servername GVIM --remote-expr \"vimtex\#compiler\#callback(0)\"'" "test.tex"
_:VimtexInfo output_
vimtex project: test
base: test.tex
root: C:\Users\John Rinehart
tex: C:\Users\John Rinehart\test.tex
out: C:\Users\John Rinehart/test.pdf
log: C:\Users\John Rinehart/test.log
aux: C:\Users\John Rinehart/test.aux
compiler: latexmk
backend: jobs
output: C:\Users\JOHNRI~1\AppData\Local\Temp\VIABB16.tmp
configuration:
continuous: 1
callback: 1
latexmk options:
-verbose
-pdf
-file-line-error
-synctex=1
-interaction=nonstopmode
job: process 9012 dead
cmd: set max_print_line=2000 & latexmk -verbose -pdf -file-line-error -synctex=1 -interaction=nonstopmode -pvc -e "$pdf_previewer = 'SumatraPDF'" -e "$success_cmd = '""""C:\Users\John Rinehart\Programs\vim_64\gvim.exe"""" --servername GVIM --remote-expr \"vimtex\#compiler\#callback(1)\"'" -e "$failure_cmd = '""""C:\Users\John Rinehart\Programs\vim_64\gvim.exe"""" --servername GVIM --remote-expr \"vimtex\#compiler\#callback(0)\"'" "test.tex"
viewer: General
qf: LaTeX logfile
config:
fix_paths: 1
packages:
default: 1
default: 1
_vimtex.vimrc_
nmap <F9> <plug>(vimtex-compile)
if has("win32")
let g:vimtex_view_general_viewer = 'SumatraPDF'
endif
_line 175(ish)_
let l:func = l:cb . ' --remote-expr '
\ . (has('win32')
\ ? '\"vimtex\#compiler\#callback(' . l:val . ')\"'
\ : '\"vimtex\#compiler\#callback(' . l:val . ')\"')
_latexmk temporary file output_
Latexmk: Stopping because executing following code from command line
$success_cmd = '"C:\Users\John
gave an error:
Can't find string terminator "'" anywhere before EOF at (eval 11) line 1.
C:\texlive\2016\bin\win32\runscript.tlu:679: command failed with exit code 2:
perl.exe c:\texlive\2016\texmf-dist\scripts\latexmk\latexmk.pl -verbose -pdf -file-line-error -synctex=1 -interaction=nonstopmode -pvc -e "$pdf_previewer = 'SumatraPDF'" -e "$success_cmd = '""""C:\Users\John Rinehart\Programs\vim_64\gvim.exe"""" --servername GVIM --remote-expr \"vimtex\#compiler\#callback(1)\"'" -e "$failure_cmd = '""""C:\Users\John Rinehart\Programs\vim_64\gvim.exe"""" --servername GVIM --remote-expr \"vimtex\#compiler\#callback(0)\"'" "test.tex"
_:VimtexInfo output_
vimtex project: test
base: test.tex
root: C:\Users\John Rinehart
tex: C:\Users\John Rinehart\test.tex
out: C:\Users\John Rinehart/test.pdf
log: C:\Users\John Rinehart/test.log
aux: C:\Users\John Rinehart/test.aux
compiler: latexmk
backend: jobs
output: C:\Users\JOHNRI~1\AppData\Local\Temp\VIA816.tmp
configuration:
continuous: 1
callback: 1
latexmk options:
-verbose
-pdf
-file-line-error
-synctex=1
-interaction=nonstopmode
job: process 14836 dead
cmd: set max_print_line=2000 & latexmk -verbose -pdf -file-line-error -synctex=1 -interaction=nonstopmode -pvc -e "$pdf_previewer = 'SumatraPDF'" -e "$success_cmd = '""""C:\Users\John Rinehart\Programs\vim_64\gvim.exe"""" --servername GVIM --remote-expr \"vimtex\#compiler\#callback(1)\"'" -e "$failure_cmd = '""""C:\Users\John Rinehart\Programs\vim_64\gvim.exe"""" --servername GVIM --remote-expr \"vimtex\#compiler\#callback(0)\"'" "test.tex"
viewer: General
qf: LaTeX logfile
config:
fix_paths: 1
packages:
default: 1
default: 1
latexmk starts briefly then crashes. No LaTeX output is generated.
The PDF viewer is not opened.
No error pop-up occurs.
_latexmk temporary file output_
Latexmk: Stopping because executing following code from command line
$success_cmd = '"C:\Users\JohnRinehart\Programs\vim_64\gvim.exe
gave an error:
Can't find string terminator "'" anywhere before EOF at (eval 13) line 1.
_:VimtexInfo output_
vimtex project: test
base: test.tex
root: C:\Users\JohnRinehart
tex: C:\Users\JohnRinehart\test.tex
out:
log:
aux:
compiler: latexmk
backend: jobs
output: C:\Users\JOHNRI~2\AppData\Local\Temp\VIA8FFE.tmp
configuration:
continuous: 1
callback: 1
latexmk options:
-verbose
-pdf
-file-line-error
-synctex=1
-interaction=nonstopmode
job: process 7524 dead
cmd: set max_print_line=2000 & latexmk -verbose -pdf -file-line-error -synctex=1 -interaction=nonstopmode -pvc -e "$pdf_previewer = 'SumatraPDF'" -e "$success_cmd = '""""C:\Users\JohnRinehart\Programs\vim_64\gvim.exe"""" --servername GVIM1 --remote-expr \"vimtex\#compiler\#callback(1)\"'" -e "$failure_cmd = '""""C:\Users\JohnRinehart\Programs\vim_64\gvim.exe"""" --servername GVIM1 --remote-expr \"vimtex\#compiler\#callback(0)\"'" "test.tex"
viewer: General
qf: LaTeX logfile
config:
fix_paths: 1
packages:
default: 1
default: 1
latexmk starts briefly then crashes. No LaTeX output is generated.
The PDF viewer is not opened.
No error pop-up occurs.
_vimtex.vimrc_
nmap <F9> <plug>(vimtex-compile)
if has("win32")
let g:vimtex_view_general_viewer = 'SumatraPDF'
let g:vimtex_compiler_progname = 'gvim'
endif
_line 175(ish)_
let l:func = l:cb . ' --remote-expr '
\ . (has('win32')
\ ? '\"vimtex\#compiler\#callback(' . l:val . ')\"'
\ : '\"vimtex\#compiler\#callback(' . l:val . ')\"')
_latexmk temporary file output_
Latexmk: All targets (test.pdf) are up-to-date
For rule 'view', running '&if_source( )' ...
have not found a previewer that is already running.
So I will start it for 'test.pdf'
------------
------------
Running 'start SumatraPDF "test.pdf"'
------------
------------
Running '"gvim" --servername GVIM --remote-expr "vimtex\#compiler\#callback(1)"'
------------
_:VimtexInfo output_
vimtex project: test
base: test.tex
root: C:\Users\John Rinehart
tex: C:\Users\John Rinehart\test.tex
out: C:\Users\John Rinehart/test.pdf
log: C:\Users\John Rinehart/test.log
aux: C:\Users\John Rinehart/test.aux
compiler: latexmk
backend: jobs
output: C:\Users\JOHNRI~1\AppData\Local\Temp\VIAC2D8.tmp
configuration:
continuous: 1
callback: 1
latexmk options:
-verbose
-pdf
-file-line-error
-synctex=1
-interaction=nonstopmode
job: process 6928 run
cmd: set max_print_line=2000 & latexmk -verbose -pdf -file-line-error -synctex=1 -interaction=nonstopmode -pvc -e "$pdf_previewer = 'SumatraPDF'" -e "$success_cmd = '""""gvim"""" --servername GVIM --remote-expr \"vimtex\#compiler\#callback(1)\"'" -e "$failure_cmd = '""""gvim"""" --servername GVIM --remote-expr \"vimtex\#compiler\#callback(0)\"'" "test.tex"
viewer: General
qf: LaTeX logfile
config:
fix_paths: 1
packages:
default: 1
default: 1
Starting and stopping latexmk works fine. The pop-up error happens, though. Also, the PDF viewer is lauched automatically.
_latexmk temporary file output_
Latexmk: Stopping because executing following code from command line
$success_cmd = '"gvim
gave an error:
Can't find string terminator "'" anywhere before EOF at (eval 13) line 1.
_:VimtexInfo output_
vimtex project: test
base: test.tex
root: C:\Users\JohnRinehart
tex: C:\Users\JohnRinehart\test.tex
out:
log:
aux:
compiler: latexmk
backend: jobs
output: C:\Users\JOHNRI~2\AppData\Local\Temp\VIA9EE0.tmp
configuration:
continuous: 1
callback: 1
latexmk options:
-verbose
-pdf
-file-line-error
-synctex=1
-interaction=nonstopmode
job: process 9756 dead
cmd: set max_print_line=2000 & latexmk -verbose -pdf -file-line-error -synctex=1 -interaction=nonstopmode -pvc -e "$pdf_previewer = 'SumatraPDF'" -e "$success_cmd = '""""gvim"""" --servername GVIM --remote-expr \"vimtex\#compiler\#callback(1)\"'" -e "$failure_cmd = '""""gvim"""" --servername GVIM --remote-expr \"vimtex\#compiler\#callback(0)\"'" "test.tex"
viewer: General
qf: LaTeX logfile
config:
fix_paths: 1
packages:
default: 1
default: 1
latexmk is launched but crashes briefly. No LaTeX output is generated. No PDF viewer is launched automatically.
While waiting for all test results: Thanks for being this thorough! I hope we'll find the problem! Btw, I recently (earlier today) pushed a minor change that could impact the results. That is, I don't really think so, but it's worth testing.
No problem. I'm on commit 41ee011. Let me know if you think that that's too outdated.
No, that's perfect. :)
So, analyzing these above tests, there were only a couple of cases that "worked" in that latexmk compiled the document and the PDF viewer was opened: Tests 2 and 4 using the work machine. However, in each of these cases we get that nasty pop-up. Tests 2 and 4 are only common in the setting of the vimtex variable. Thus, it seems that the slashes in latexmk.vim don't play a role in the success/failure of compilation.
Also interesting to note is the difference in parse error between the laptop's and the work machine's latexmk output. The prior hung at "gvim" the latter hung at "C:\Users\John".
The latexmk version on my work machine is 4.52c (released January 19, 2017).
The latexmk version on my work machine is 4.52 (released January 16, 2017).
I performed your test. On my work machine the results resemble that for tests 2 and 4.
_latexmk temporary file output for the work machine_
Latexmk: All targets (minimal.pdf) are up-to-date
7, version: 4.52c.
Not using a previewer
------------
Running '"gvim" --servername GVIM3 --remote-expr "vimtex\#compiler\#callback\(1\)"'
------------
On my laptop the result was similar to that of test 2.
_latexmk temporary file output for the laptop_
Latexmk: Stopping because executing following code from command line
$success_cmd = '"C:\Users\JohnRinehart\Programs\vim_64\gvim.exe
gave an error:
Can't find string terminator "'" anywhere before EOF at (eval 11) line 1.
:VimtexInfo isn't available with minivimrc.
Ok, I have to admit that I'm at a loss here. I can't figure out what is wrong. :(
Could you perhaps experiment with line 168 of latexmk.vim: Remove the shellescape functions and try different number of surrounding "s, for instance?
I'm sorry that I can't be more helpful. :\
Hey, no problem, @lervag. I'll definitely play around. I'll let you know what I find.
Okay, I'm back with an update. I managed to form a command line expression that, when pasted into the command line, manages to interact with a running instance of gvim. The functioning expression looks like
latexmk -verbose -pdf -file-line-error -synctex=1 -interaction=nonstopmode -pvc -e "$pdf_previewer = 'SumatraPDF'" -e "$success_cmd = '\"C:\Users\John Rinehart\Programs\vim_64\gvim.exe\" --servername GVIM --remote-expr vimtex#compiler#callback(1)'" -e "$failure_cmd = '\"C:\Users\John Rinehart\Programs\vim_64\gvim.exe\" --servername GVIM --remote-expr vimtex#compiler#callback(0)'" "test.tex"
The key was the \" before and after the path to the progname. I'll push a commit, briefly, that fixes this issue.
I'm happy to hear it! I'll look at it after easter when I have my Windows computer available. Let's continue the discussion at #789.