Open leanhdung1994 opened 4 months ago
That textopdfshorterror setting doesn't look like it does anything at all, which I would guess is why you're not getting any details about the error. What is the output if you run the pdflatex from a shell prompt?
I can't really provide help for Windows users, however.
The command pdflatex.exe "C:\Users\Akira\Documents\LaTex\test.tex"
runs perfectly fine in Windows PowerShell
:
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows
PS C:\Users\Akira\Documents\LaTex> pdflatex.exe "C:\Users\Akira\Documents\LaTex\test.tex"
This is pdfTeX, Version 3.141592653-2.6-1.40.26 (TeX Live 2024) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(c:/Users/Akira/Documents/LaTex/test.tex
LaTeX2e <2023-11-01> patch level 1
L3 programming layer <2024-05-08>
(c:/texlive/2024/texmf-dist/tex/latex/base/article.cls
Document Class: article 2023/05/17 v1.4n Standard LaTeX document class
(c:/texlive/2024/texmf-dist/tex/latex/base/size10.clo))
(c:/texlive/2024/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def)
No file test.aux.
[1{c:/texlive/2024/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./test.aux)
)<c:/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on test.pdf (1 page, 16107 bytes).
Transcript written on test.log.
PS C:\Users\Akira\Documents\LaTex>
The resulted files are
@frabjous I totally understand that you do not use Windows, but thank you so much for reading my issue.
@leanhdung1994 Have you tried running the pdflatex
command exactly as it is in the textpdf
field in gknapsettings
? Does your latex
file compile with this command?
Another possibility: have you already installed the sioyek
pdf reader? Was the executable for this reader included in the path? My configuration uses this reader.
@andregpss I followed the instructions to install it and after pressing F5,F6,F7,F8 respectively, nothing reflects. Can you show your init.lua, thanks!
The shell command you showed isn't exactly what you have set in your settings. Try the exact command there at the shell (replacing %docroot% with the filename, run from the folder containing the file).
@andregpss
pdflatex -interaction=batchmode -halt-on-error -synctex=1 test.tex
runs well in the terminal:Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows
PS C:\Users\Akira\Documents\LaTex> pdflatex -interaction=batchmode -halt-on-error -synctex=1 test.tex
This is pdfTeX, Version 3.141592653-2.6-1.40.26 (TeX Live 2024) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
PS C:\Users\Akira\Documents\LaTex>
PATH
https://github.com/frabjous/knap/assets/28704090/a184c960-57b3-42ba-ad3b-f9218f504493
In Windows, Neovim can't find Knap, you need to set system variables: XDG_CONFIG_HOME=C:\Users\yourusername\.config XDG_DATA_HOME=C:\Users\yourusername\AppData\Local XDG_STATE_HOME=C:\Users\yourusername\AppData\Local XDG_CACHE_HOME=C:\Users\yourusername\AppData\Local\temp I made a portable setup (see attachment) and modified the paths to Neovim and TeXLive in StartNeovim.bat to run it. https://www.mediafire.com/file/rv2zd1ungtzuf2b/PortableNeovim.zip/file
@mathlab08 Could you explain where in Windows I should put such commands?
XDG_CONFIG_HOME=C:\Users\yourusername\.config
XDG_DATA_HOME=C:\Users\yourusername\AppData\Local
XDG_STATE_HOME=C:\Users\yourusername\AppData\Local
XDG_CACHE_HOME=C:\Users\yourusername\AppData\Local\temp
It seems you attachment has not been uploaded yet...
@mathlab08 I think it's not necessary to set these environment variables. I didn't need to do that. I installed knap
through Plug.
@leanhdung1994 My neovim
configuration can be found here. Pay attention to knap.vim
and pluglist.vim
.
I recorded the video below to show how the knap works. First I test sioyek
, then pdflatex
, and then run neovim
. Next, I call the toggle_autopreviewing()
command using the F7
key. Note that a message appears at the bottom of the video with the commands that knap
runs. Ultimately, I call close_viewer()
through F6
.
(I used these shortcut keys to make it easier to understand as they are the default knap
keys, but in my configuration, I changed these keys to F2
and Ctrl-F2
, respectively).
https://github.com/frabjous/knap/assets/24927386/f97ad47d-d114-4e55-b4db-9aaa0a2fe469
I'm using windows 7, without setting system variables, and neovim can't find Knap. also, there is an error with sioyek, and I can only preview with SumatraPDF renamed to sioyek.
The whole point of having configurable settings is so you can use whatever programs you want. You shouldn't have to rename something externally, and I'd definitely expect breakage if you did. Check if the windows version of Sioyek uses different command line arguments. If you don't know how command line arguments work to reconfigure it, I don't recommend that you use KNAP.
NeoVim not finding KNAP has nothing to do with KNAP. That's a problem with your Neovim package manager or whatever you used to install it.
@mathlab08 Can you use knap
on Windows 7
by configuring these systems variables and using Sumatra
?
What version of Sioyek
did you install? Maybe it is an old version.
Microsoft
has discontinued mainstream support for Windows 7
; unsurprisingly, Knap
and other plugins do not work.
Operating Environment: Windows 7 Professionall Neovim v0.9.0 sioyek v2.0.0 SumatraPDF v3.4.6 Git-2.45.1-64-bit
Install knap and pag. $ mkdir -p ~/AppData/local/nvim-data/site/pack/plugins/start $ cd ~/AppData/local/nvim-data/site/pack/plugins/start $ git clone --depth 1 https://github.com/frabjous/knap.git $ git clone --depth 1 https://github.com/savq/paq-nvim.git
Configured the system variables, and then follow your method of configuring init.lua, can be compiled correctly and synchronous preview PDF , but with sioyek v2.0.0 error.
@andregpss, as your configuration, in Windows, modify Knap.lua directly by changing the
local dsettings = {
--
texoutputext = "pdf",
textopdf = "pdflatex -interaction=batchmode -halt-on-error -synctex=1 %docroot%",
textopdfviewerlaunch = "sioyek --inverse-search 'nvim --headless -es --cmd \"lua require('\"'\"'\"'knaphelper'\"'\"').relayjump('\"'\"'\"'\"'\"'% servername%'\"'\"','\"'\"'\"'%1'\"'\"', %2,%3)\"' --new-window %outputfile%",
textopdfviewerrefresh = "none",
textopdfforwardjump = "sioyek --inverse-search 'nvim --headless -es --cmd \"lua require('\"'\"'\"'knaphelper'\"'\"').relayjump('\"'\"'\"'% servername%'\"'\"','\"'\"'%1'\"'\"',%2,%3)\"' --reuse-window --forward-search-file %srcfile% --forward-search-line %line% %outputfile%",
textopdfshorterror = "A=%outputfile% ; LOGFILE=\"${A%.pdf}.log\" ; rubber-info \"$LOGFILE\" 2>&1 | head -n 1"
--
}
Modify to
local dsettings = {
--
texoutputext = "pdf",
textopdf = "pdflatex -interaction=batchmode -halt-on-error -synctex=1 %docroot%",
textopdfviewerrefresh = "none",
textopdfviewerlaunch = "sioyek --inverse-search \"nvim --headless -es\" --new-window %outputfile%",
-- textopdfviewerlaunch = "sioyek --inverse-search \"nvim --headless --cmd \"lua require('\"'\"'knaphelper'\"'\"').relayjump('\"'\"'%servername%'\"'\"','\"'\"'%1'\"'\"',%2,%3)\"\" --new-window %outputfile%",
textopdfviewerrefresh = "none",
textopdfforwardjump = "sioyek --inverse-search \"nvim --headless -es\" --reuse-window --forward-search-file %srcfile% --forward-search-line %line% %outputfile%",
-- textopdfforwardjump = "sioyek --inverse-search \"nvim --headless -c \"lua require('\"'\"'knaphelper'\"'\"').relayjump('\"'\"'%servername%'\"'\"','\"'\"'%1'\"'\"',%2,%3)\"\" --reuse-window --forward-search-file %srcfile% --forward-search-line %line% %outputfile%",
textopdfshorterror = "A=%outputfile% ; LOGFILE=\"${A%.pdf}.log\"" ,
--
}
At this point, sioyek v2.0.0 can be previewed.
@mathlab08 Pretty cool! From what I understand, you changed fieldpdfviewerlaunch
field by replacing the single quotes with \"
and omitted the parameter that contains knaphelper
. I don't really know if knaphelper
is needed in this command. Anyway, I'm glad it worked!
I am using:
Neovim verison 0.10.0.
My
init.lua
(for Windows as suggested by @andregpss in his comment) is the following:I have a tex file
C:\Users\Akira\Documents\LaTex\test.tex
and open it in Neovim by:e C:\Users\Akira\Documents\LaTex\test.tex
:I press
F7
to launch the viewer. The messagesknap routine started
and thenERR
show up:Could you elaborate on how to solve this issue? @andregpss please help me...