lervag / vimtex

VimTeX: A modern Vim and neovim filetype plugin for LaTeX files.
MIT License
5.4k stars 388 forks source link

Compile with Okular in Windows 10 #2922

Closed 777uliahshafar closed 3 weeks ago

777uliahshafar commented 4 months ago

Description

I use Okular (I changed from SumatraPdf which is work) for compilation in Windows with Powershel in Windows Terminal. I use the basic configuration to set Okular, but I encounter two windows after run compilation.

The first window said there is already a unique Okular instance running. This instance won't be the unique one. The second window shows an error Could not open file:D:%5Ckarakter/karakter.pdf/%5C%23src:4D:%5Ckarakter%5Ckarakter.tex. After this, it didn't show the pdf. or back to dashboard of Okular.

I Installed Okular using chocolatey, because only chocolatey put the file location on program files like SumatraPdf which has worked previously. So I could refrence them on env. variable path.

For env. variabel path, I use C:\Program Files\Okular\bin, without bin it won't execute. I think it is usual.

Steps to reproduce

  1. Open file tex. Then run compilation with the config :

    cmd "syntax on"
    vim.api.nvim_command "filetype plugin indent on"
    g.vimtex_compiler_latexmk_engines = {
      _ = "-lualatex",
    }
    
    g.vimtex_compiler_latexmk = {
      options = {
        "-shell-escape",
        "-verbose",
        "-file-line-error",
        "-synctex=1",
        "-interaction=nonstopmode",
      },
    }
    
    vim.g.vimtex_view_general_viewer = "okular"
    vim.g.vimtex_view_general_options = "--unique file:@pdf\\#src:@line@tex"

Expected behavior

No response

Actual behavior

No response

Do you use a latexmkrc file?

No

VimtexInfo

System info:
  OS: DESKTOP-1FGACVB (Microsoft Windows 10 Home Single Language)
  Vim version: NVIM v0.9.5
  Has clientserver: true
  Servername: \\.\pipe\nvim.3380.0

VimTeX project: karakter
  base: karakter.tex
  root: D:\karakter
  tex: D:\karakter/karakter.tex
  main parser: current file verified
  document class: simart
  packages: arabicnumbers array atbegshi-ltx atveryend-ltx auxhook bigintcalc bitset booktabs calc caption caption3 ctablestack enumitem epstopdf-base etoolbox expl3 fancyhdr fontenc fontspec fontspec-luatex geometry gettitlestring graphics graphicx hijrical hycolor hyperref iftex ifvtex import infwarerr intcalc kvdefinekeys kvoptions kvsetkeys l3keys2e letltxmacro lipsum listings lstmisc ltxcmds luatexbase makecmds microtype nameref natbib paralist pdfescape pdftexcmds polyglossia refcount rerunfilecheck setspace stringenc subfiles tabularx titlesec trig uniquecounter url xkeyval xparse
  compiler: latexmk
    engine: -lualatex
    options:
      -shell-escape
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 1
    executable: latexmk
  viewer: General
  qf method: LaTeX logfile
lervag commented 4 months ago

The first window said there is already a unique Okular instance running. This instance won't be the unique one. The second window shows an error Could not open file:D:%5Ckarakter/karakter.pdf/%5C%23src:4D:%5Ckarakter%5Ckarakter.tex. After this, it didn't show the pdf. or back to dashboard of Okular.

The settings for Okular will work on Linux. However, I have no idea if it works on Windows - your issue indicates it does not work. I don't mind to have VimTeX support for Windows, but it is only as a result of user contributions. I don't use Windows and I have no way of investigating what may be wrong in this particular case.

Based on your issue report, it seems you are doing things "correctly". My suggestion would be to start Okular with the same options as we are using from VimTeX, but from a Powershell terminal. You can see the actual command VimTeX uses with \li after VimTeX has tried to start the viewer.

  1. Open file tex. Then run compilation with the config : …

The config you provide here is very incomplete. For instance, how is VimTeX even loaded?

Notice that syntax on and filetype plugin indent on is usually not necessary if you are using a plugin manager, so you can probably remove those.

lervag commented 3 weeks ago

Closing due to inactivity.