Closed JohanRibbing closed 3 years ago
Preface: I am very sorry if this issue is incorrectly submitted, just tell me and i will fix it ASAP. Thank you for your patience.
Will do. I took the liberty of cleaning your post a little bit.
Output from :VimtexCompileOutput
Thanks, this is useful information! Notice that :VimtexInfo
will show the command used by \ll
, so can you please do :VimtexInfo
after \ll
and present the output here?
Some comments to your vimrc file (I've refined it and added comments "inline").
" This part shoud preferably come first, and don't apply plugin configuration
" until after plug#end()
call plug#begin('~/.vim/plugged')
Plug 'lervag/vimtex'
call plug#end()
" The following lines are not relevant for the current issue, and thus you
" don't need to include them (I think; feel free to remove them and check if
" you can still reproduce)
inoremap jk <Esc>
autocmd FileType python map <buffer> <F9> :w<CR>:exec '!python' shellescape(@%, 1)<CR>
autocmd FileType python imap <buffer> <F9> <esc>:w<CR>:exec '!python' shellescape(@%, 1)<CR>
let &t_ti.="\e[1 q"
let &t_SI.="\e[5 q"
let &t_EI.="\e[1 q"
let &t_te.="\e[0 q"
set conceallevel=1
" These could be relevant (but probably not)
let g:tex_flavor='latex'
let g:tex_conceal='abdmg'
let g:vimtex_quickfix_mode=0
let g:vimtex_view_general_viewer = 'SumatraPDF'
let g:vimtex_view_general_options
\ = '-reuse-instance -forward-search @tex @line @pdf'
When you've tested the \ll
command, did you do it with vim -u minivimrc mwe.tex
?
First of all, thank you for the quick response! Really awesome.
When you've tested the \ll command, did you do it with vim -u minivimrc mwe.tex?
No, i dont know what the -u flag does, what minivimrc is or what the mwe.tex file is. I only started using vim a few months ago, actually want to get started with vimtex as another way of getting more time in vim.
Running that from the terminal gives
E282: Cannot read from "minivimrc"
Did i misunderstand the question?
Output from :VimtexInfo after running \ll
System info
OS: LAPTOP-KNT77K0P (Microsoft Windows 10 Home)
Vim version: VIM 8.2 (1-869)
Has clientserver: false
vimtex project: test
base: test.tex
root: /c/Users/Johan
tex: /c/Users/Johan/test.tex
out: /c/Users/Johan/test.pdf
log: /c/Users/Johan/test.log
aux: /c/Users/Johan/test.aux
fls: /c/Users/Johan/test.fls
main parser: current file verified
compiler: latexmk
configuration:
continuous: 1
callback: 1
latexmk options:
-verbose
-file-line-error
-synctex=1
-interaction=nonstopmode
latexmk engine: -pdf
job: process 1211 dead
pid: 1211
cmd: max_print_line=2000 latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc -e '$pdf_previewer = "SumatraPDF reuse-instance"' -e '$success_cmd = "echo vimtex_compiler_callback_success"' -e '$failure_cmd = "echo vimtex_compiler_callback_failure"' 'test.tex'
viewer: General
qf: LaTeX logfile
addqflist: 56
fix_paths: 57
set_errorformat: 55
document class: minimal
First of all, thank you for the quick response! Really awesome.
No problem, I'm happy if I'm able to help :)
No, i dont know what the -u flag does, what minivimrc is or what the mwe.tex file is. I only started using vim a few months ago, actually want to get started with vimtex as another way of getting more time in vim.
Ah, I see. Let me try to explain, then:
By default, Vim loads your configuration from the .vimrc
(or _vimrc
) file. With vim -u minivimrc
, you tell Vim to instead load its configuration from the file minivimrc
.
For this to be useful, you must create a file called minivimrc
where you only include the relevant configuration. The most minimal configuration would be something like this:
set nocompatible
let &rtp = '~/.vim/bundle/vimtex,' . &rtp
let &rtp .= ',~/.vim/bundle/vimtex/after'
filetype plugin indent on
syntax enable
let g:tex_flavor = 'latex'
or with vim-plug:
call plug#begin('~/.vim/plugged')
Plug 'lervag/vimtex'
call plug#end()
let g:tex_flavor = 'latex'
Next, create a minimal LaTeX file named e.g. mwe.tex
. Sometimes people have issues related to how vimtex "parses" or understands or works with different parts of a LaTeX project, in which case the mwe.tex
file should include the relevant content. Still, it should be as small as possible, and I think the smallest version is this:
\documentclass{minimal}
\begin{document}
Hello World!
\end{document}
With both minivimrc
and mwe.tex
properly defined, you can now start Vim from your git bash (or whatever) with vim -u minivimrc mwe.tex
. This should work, and should load the mwe.tex
file in Vim with minimal configuration that is essentially "just vimtex" and nothing else. You can now test if you can reproduce your issue. If you can, then this process of creating minimal configuration and example files help exclude possible sources of the problems (e.g. plugin clashes, misconfiguration, etc).
So, I'll leave the above as an exercise. Can you confirm that you still have your problem even when you test with a minimal config/example?
Output from :VimtexInfo after running \ll ... cmd: max_print_line=2000 latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc -e '$pdf_previewer = "SumatraPDF reuse-instance"' -e '$success_cmd = "echo vimtex_compiler_callback_success"' -e '$failure_cmd = "echo vimtex_compiler_callback_failure"' 'test.tex'
You previously tested that latexmk -pdf test.tex
works as expected from you git bash session. Can you test the command used by vimtex as well? That is, run
max_print_line=2000 latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc -e '$pdf_previewer = "SumatraPDF reuse-instance"' -e '$success_cmd = "echo vimtex_compiler_callback_success"' -e '$failure_cmd = "echo vimtex_compiler_callback_failure"' 'test.tex'
It should work. But you could also try this:
latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc 'test.tex'
Ok, so: with minimal config and file, running vim -u minivimrc mwe.tex and then \ll i got the same exact same error message.
Running
max_print_line=2000 latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc -e '$pdf_previewer = "SumatraPDF reuse-instance"' -e '$success_cmd = "echo vimtex_compiler_callback_success"' -e '$failure_cmd = "echo vimtex_compiler_callback_failure"' 'test.tex'
Also gives the same error.
Running
latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc 'test.tex'
Seems to work fine. The file is compiled, opened in SumatraPDF and when changing and writing to test.tex, the visible pdf automatically updates.
EDIT: below So if i understand correctly, \ll makes vimtex run the first version of calling latexmk and that results in the "4 filenames" bug. What is the difference between that and the second version, which worked?
Running
max_print_line=2000 latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc -e '$pdf_previewer = "SumatraPDF reuse-instance"' -e '$success_cmd = "echo vimtex_compiler_callback_success"' -e '$failure_cmd = "echo vimtex_compiler_callback_failure"' 'test.tex'
Also gives the same error.
Ok, this "simplifies" things in that we can look for what in the command is failing and try to fix in from the terminal first.
So if i understand correctly, \ll makes vimtex run the first version of calling latexmk and that results in the "4 filenames" bug.
Yes, correct.
What is the difference between that and the second version, which worked?
The second version was simplified: I removed some of the arguments:
max_print_line=2000 latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc -e '$pdf_previewer = "SumatraPDF reuse-instance"' -e '$success_cmd = "echo vimtex_compiler_callback_success"' -e '$failure_cmd = "echo vimtex_compiler_callback_failure"' 'test.tex'
latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc 'test.tex'
Can you next test with this:
latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc -e '$pdf_previewer = "SumatraPDF reuse-instance"' 'test.tex'
Ok now it got interesting. Running the last version you suggested gives the same error but 2 filenames instead of 4. The first version still gives the 4 filenames error.
Inputs and outputs $ latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc -e '$pdf_previewer = "SumatraPDF reuse-instance"' 'test.tex' Rc files read: NONE Latexmk: This is Latexmk, John Collins, 17 Apr. 2020, version: 4.69a.
Latexmk: Need to specify exactly one filename for preview-continuous mode but 2 were specified Use latexmk -help to get usage information
$ max_print_line=2000 latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc -e '$pdf_previewer = "SumatraPDF reuse-instance"' -e '$success_cmd = "echo vimtex_compiler_callback_success"' -e '$failure_cmd = "echo vimtex_compiler_callback_failure"' 'test.tex' Unquoted string "echo" may clash with future reserved word at (eval 10) line 1. Unquoted string "echo" may clash with future reserved word at (eval 11) line 1. Rc files read: NONE Latexmk: This is Latexmk, John Collins, 17 Apr. 2020, version: 4.69a.
Latexmk: Need to specify exactly one filename for preview-continuous mode but 4 were specified Use latexmk -help to get usage information
Ok now it got interesting. Running the last version you suggested gives the same error but 2 filenames instead of 4. The first version still gives the 4 filenames error.
Yes, I agree. This is quite strange. It seems, for some reason, that the -e
option is not properly "understood". Can you try to switch the quotation types, i.e.:
latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc -e "$pdf_previewer = 'SumatraPDF reuse-instance'" 'test.tex'
Can you also type latexmk -help
and check if it lists the -e
option as a valid option? On my end, it is listed as follows:
> latexmk -help
Latexmk 4.69a: Automatic LaTeX document generation routine
Usage: latexmk [latexmk_options] [filename ...]
Latexmk_options:
-aux-directory=dir or -auxdir=dir
...
...
-dvi- - turn off required dvi
-e <code> - Execute specified Perl code (as part of latexmk start-up
code)
I'll just keep copy pasting from the terminal, that seems clearest.
$ latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc -e "$pdf_previewer = 'SumatraPDF reuse-instance'" 'test.tex'
Latexmk: Stopping because executing following code from command line
= 'SumatraPDF reuse-instance'
gave an error:
syntax error at (eval 9) line 1, near "="
$ latexmk --help
Latexmk 4.69a: Automatic LaTeX document generation routine
Usage: latexmk [latexmk_options] [filename ...]
Latexmk_options:
-aux-directory=dir or -auxdir=dir
- set name of directory for auxiliary files (aux, log)
- Currently this only works with MiKTeX
-bibtex - use bibtex when needed (default)
-bibtex- - never use bibtex
..
...
-dvi- - turn off required dvi
-e <code> - Execute specified Perl code (as part of latexmk start-up
code)
Ok, this is very strange. I'm sorry to say I only barely use Windows, and so I am not able to reproduce this. Did you say you are running this in a git bash terminal? Can you explain more precisely what this means?
Can you try this one?
latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc -e '$success_cmd = "echo vimtex_compiler_callback_success"' 'test.tex'
Does it have the same error?
Ok, this is very strange. I'm sorry to say I only barely use Windows, and so I am not able to reproduce this. Did you say you are running this in a git bash terminal? Can you explain more precisely what this means?
Can you try this one?
latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc -e '$success_cmd = "echo vimtex_compiler_callback_success"' 'test.tex'
Does it have the same error?
This gives the error "... 2 were specified ..."
As for git BASH i think it just emulates BASH for windows. Has worked fine for everything so far.
How about this?
latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -e '$success_cmd = "echo vimtex_compiler_callback_success"' -pvc 'test.tex'
What is the output of this?
echo latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -e '$success_cmd = "echo vimtex_compiler_callback_success"' -pvc 'test.tex'
$ latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -e '$success_cmd = "echo vimtex_compiler_callback_success"' -pvc 'test.tex'
latexmk: security risk: running with elevated privileges
Unquoted string "echo" may clash with future reserved word at (eval 9) line 1.
Rc files read:
NONE
Latexmk: This is Latexmk, John Collins, 17 Apr. 2020, version: 4.69a.
Latexmk: Need to specify exactly one filename for preview-continuous mode
but 2 were specified
Use
latexmk -help
to get usage information
$ echo latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -e '$success_cmd = "echo vimtex_compiler_callback_success"' -pvc 'test.tex'
latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -e $success_cmd = "echo vimtex_compiler_callback_success" -pvc test.tex
How about this?
latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc -e "$success_cmd = \"echo vimtex_compiler_callback_success\"" test.tex
$ latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc -e "$success_cmd = \"echo vimtex_compiler_callback_success\"" test.tex latexmk: security risk: running with elevated privileges Unquoted string "echo" may clash with future reserved word at (eval 9) line 1. Latexmk: Stopping because executing following code from command line = echo gave an error: syntax error at (eval 9) line 1, near "="
No, you must escape the "inner" quotes, i.e. \"echo ... \"
.
Sorry, must have copied wrong
$ latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc -e "$success_cmd = \"echo vimtex_compiler_callback_success\"" test.tex Unquoted string "echo" may clash with future reserved word at (eval 9) line 1. Latexmk: Stopping because executing following code from command line = echo gave an error: syntax error at (eval 9) line 1, near "="
Ok, so this is the output when you write ... -e "$success_cmd = \"echo ...\"" test.tex
? Again, note that the "inner" quotes are escaped: \"
as opposed to just "
.
I'm don't really know what to do next. This is really strange. The command should work, and I have never heard of this issue before. :\
Alright, fair enough, it's probably best for my sake as well to stop pouring time into this. Thank you for all the help anyway! I really did not expect such dedicated attention. I guess at least there is no issue with vimtex right? So that is good at least :D
Alright, fair enough, it's probably best for my sake as well to stop pouring time into this. Thank you for all the help anyway! I really did not expect such dedicated attention.
My pleasure. I'm dissappointed I couldn't be of more help, though. By the way, did you read :help vimtex-faq-windows
? There are some links to older issues that may be helpful. Also, check :help vimtex-faq-wsl
; perhaps you could try to use vim+vimtex inside wsl?
I guess at least there is no issue with vimtex right? So that is good at least :D
Sort of. But you are using the same version of latexmk as me and it "should work". I'm thinking it might be something about the terminal or shell you are using. But as I hinted at earlier, I'm not really a Windows expert, and I don't know specifically what to suggest going forwards.
I guess I never really asked how you use Vim on Windows. That is, are you running Vim inside a git bash? How did you install it? Did you try with standard gVim for Windows?
H! I'm back again. I have got wsl and ubuntu for windows going. Now latexmk works, \ll works and the only thing left is to be able to view pdfs. May I ask if you know a pdf viewer that works with vimtex from within ubuntu for windows? Zathura, okular, and mupdf give errors like cannot open display
May I ask if you know a pdf viewer that works with vimtex from within ubuntu for windows? Zathura, okular, and mupdf give errors like cannot open display
Yes, sure. I think Zathura, okular, and mupdf should all work, but you need to install an X server. I think the current "best practise" is to install VcXsrv. Make sure to start it, then afterwards I think things should work. You might need to specify the DISPLAY
environment variable in your .bashrc
.
Perhaps this blog post can be of help? It was among the first hits when I searched for wsl + vcxsrv
.
Issue Preface: I am very sorry if this issue is incorrectly submitted, just tell me and i will fix it ASAP. Thank you for your patience.
I cannot compile a simple test.tex doucment. I get error
With logs about wrong number of filenames.
Output from :VimtexCompileOutput
vimrc
Additional information If i compile manually from git bash with
Then
\lv
works fine but\ll
still gives the exact same error.minimal.tex
Commands/Input
\ll
Observed Behaviour Compilation does not start succesfully
Expected Behaviour Compilation starts successfully
Output from VimtexInfo
EDIT: added Additional information