Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward search during background compilation unexpectedly triggers copy #2819

Closed
rolandherzog opened this issue Oct 28, 2023 · 4 comments
Closed
Labels

Comments

@rolandherzog
Copy link

Description

With g:vimtex_view_use_temp_files = 1, vimtex - upon completion of the compile process - copies the fresh file (e.g., test.pdf) to test_vimtex.pdf, which is the file the viewer is told to open. However, executing a forward search while LaTeX is compiling, incorrectly appears to also trigger this copy process. Consequently, there is a high probability that the half-baked test.pdf is copied over to test_vimtex.pdf in the middle of the compile process, causing the viewer to refresh on a broken file and naturally failing.

Steps to reproduce

No response

Expected behavior

I expect the copy of test.pdf to test_vimtex.pdf to trigger only when the compile process finishes successfully. In particular, not as part of a forward search.

Actual behavior

Forward search appears to trigger test.pdf to be copied over to test_vimtex.pdf, regardless of whether or not a compile process is in progress.

Do you use a latexmkrc file?

No

VimtexInfo

System info:
  OS: Ubuntu 22.04.1 LTS
  Vim version: NVIM v0.9.0-dev-1218+gb466e1d28
  Has clientserver: true
  Servername: /run/user/1000/nvim.240979.0

VimTeX project: lineare-algebra
  base: lineare-algebra.tex
  root: /home/roland/Work/Teaching/lineare-algebra
  tex: /home/roland/Work/Teaching/lineare-algebra/lineare-algebra.tex
  main parser: current file verified
  document class: scoop-lecture-notes
  packages: abidir abjad aboxes acmd aconfig afonts afonts2 afoot alatex algorithmicx algpseudocode aligs alists alocal alphalph amsbsy amsfonts amsgen amsmath amsopn amssymb amstext amsthm anyfontsize aoutput aparse apatch arabaux arabchrs arabskel arabtex arabtoks array ascan asect atabg atbegshi atbegshi-ltx atrans atveryend atveryend-ltx auxhook awrite babel biblatex bigintcalc bitset blx-case-expl3 bookmark booktabs calc catchfile ccicons centernot changes chngcntr cleveref color csquotes enumitem environ epstopdf-base etexcmds etoolbox exercisepoints expl3 fancyvrb fcnumparser fcprefix float fmtcount fontaxes fontenc footmisc framed fvextra gettitlestring graphics graphicx grfext hycolor hyperref ifluatex ifmtarg ifplatform iftex ifthen ifxetex inconsolata infwarerr inputenc intcalc isodate keyval kvdefinekeys kvoptions kvsetkeys l3keys2e lastpage letltxmacro libertine lineno listofitems logreq longtable ltxcmds makeidx marginnote mathrsfs mathtools mhsetup microtype minted moreenum mweights nameref newtxmath nicefrac pdfescape pdftexcmds pgf pgfcomp-version-0-65 pgfcomp-version-1-18 pgfcore pgffor pgfkeys pgfmath pgfrcs pgfsys polynom refcount rerunfilecheck scoop-all scoop-cls-commons scoop-colors scoop-local scoop-packages scoop-semantic scoop-style scoop-syntax scoop-teaching scoop-theorems scoop-translations scoop-uncolorizeHyperrefIfChanges scrbase scrdate scrkbase scrlayer scrlayer-scrpage scrlfile scrlfile-hook scrlogo shellesc siunitx stackengine stmaryrd substr tasks textcomp tikz titletoc tocbasic todonotes translations trig trimspaces truncate typearea ulem uniquecounter upquote url utf8 utfcode xarbskel xarbsymb xcolor xifthen xkeyval xparse xpatch xr xspace xstring xtemplate
  source files:
    lineare-algebra.tex
    main.tex
  compiler: latexmk
    engine: -pdf
    options:
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 1
    executable: latexmk
    job: 
      jobid: 1661
      output: /tmp/nvim.roland/n22goA/1
      cmd: max_print_line=2000 latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc -pvctimeout- -view=none -e '$compiling_cmd = ($compiling_cmd ? $compiling_cmd . " ; " : "") . "echo vimtex_compiler_callback_compiling"' -e '$success_cmd = ($success_cmd ? $success_cmd . " ; " : "") . "echo vimtex_compiler_callback_success"' -e '$failure_cmd = ($failure_cmd ? $failure_cmd . " ; " : "") . "echo vimtex_compiler_callback_failure"' 'lineare-algebra.tex'
      pid: 265879
  viewer: General
    job: 
      pid: -
      cmd: okular file:'/home/roland/Work/Teaching/lineare-algebra/lineare-algebra_vimtex.pdf'\#src:4247'/home/roland/Work/Teaching/lineare-algebra/main.tex'
  qf method: LaTeX logfile
@lervag
Copy link
Owner

lervag commented Oct 29, 2023

With g:vimtex_view_use_temp_files = 1, vimtex - upon completion of the compile process - copies the fresh file (e.g., test.pdf) to test_vimtex.pdf, which is the file the viewer is told to open. However, executing a forward search while LaTeX is compiling, incorrectly appears to also trigger this copy process. Consequently, there is a high probability that the half-baked test.pdf is copied over to test_vimtex.pdf in the middle of the compile process, causing the viewer to refresh on a broken file and naturally failing.

Thanks; this seems to be a relatively hard issue to be honest. The copying is currently performed when you are viewing the file, not when it is compiled. I realize the documentation is probably not consistent with the current behaviour, though.

I'll look into this. It will probably require some work, so I won't promise to deliver very fast, but I'll try.

In the meantime, I would recommend to disable this option.

lervag added a commit that referenced this issue Oct 29, 2023
The old implementation was not working properly and the docs were
inconsistent with the implementation. The docs should now be properly
consistent and the implementation should be better and more robust.

refer: #2819
@lervag
Copy link
Owner

lervag commented Oct 29, 2023

I believe I've fixed it - please update and test.

@lervag lervag closed this as completed Oct 29, 2023
@rolandherzog
Copy link
Author

Yes, that fixed it, excellent, thanks!

@lervag
Copy link
Owner

lervag commented Oct 30, 2023

Glad to hear it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants