lervag / vimtex

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

'bibtex.sty' not found #3035

Open danecross opened 1 week ago

danecross commented 1 week ago

Description

Hello, I seem to be having issues with compiling my latex document with bibtex. Particularly, I find that it can't find the bibtex.sty file. I have seen this issue, but deleting all of the compilation files and recompiling still doesn't do the trick.

Steps to reproduce

I have the issue when I take the public example and add four lines:

\usepackage{bibtex}
\addbibresource{bib.bib}

before the beginning of the document and

\cite{manual-full}
\printbibliography

before the end of the document. The bib.bib file looks like this:

@MANUAL{manual-full,
   author = "Larry Manmaker",
   title = "The Definitive Computer Manual",
   organization = "Chips-R-Us",
   address = "Silicon Valley",
   edition = "Silver",
   month = apr # "-" # may,
   year = 1986,
   note = "A full MANUAL entry",
}

I have just installed nvim and vimtex on my mac M1. Here is my full init.lua file:

require("config.lazy")

vim.g.vimtex_view_method = 'zathura'
vim.g.vimtex_compiler_method = 'latexmk'

and my full plugin file:

return {
    {
        "lervag/vimtex",
        lazy = false,     -- we don't want to lazy load VimTeX
        -- tag = "v2.15", -- uncomment to pin to a specific release
        init = function()
            -- VimTeX configuration goes here, e.g.
            -- vim.g.vimtex_view_method = "zathura"
        end
    }
}

Expected behavior

No response

Actual behavior

When I compile the tex file with \ll, I get the following error:

! LaTeX Error: File `bibtex.sty' not found.
./main.tex:15: Emergency stop.

Do you use a latexmkrc file?

no

VimtexInfo

OS: macOS 14.2 (23C64)
  Vim version: NVIM v0.10.2
  Has clientserver: true
  Servername: /var/folders/j6/86l9x4sx0wv6602d71s4trv00000gn/T/nvim.danecross/BHV5uE/nvim.13938.0

VimTeX project: main
  base: main.tex
  root: /Users/danecross/Dropbox/Mac/Desktop/tex-papers/test
  tex: /Users/danecross/Dropbox/Mac/Desktop/tex-papers/test/main.tex
  main parser: current file verified
  document class: article
  packages: amsbsy amsgen amsmath amsopn amstext
  compiler: latexmk
    engine: -pdf
    options:
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 1
    executable: latexmk
    job:
      jobid: 8
      output: /var/folders/j6/86l9x4sx0wv6602d71s4trv00000gn/T/nvim.danecross/BHV5uE/0
      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"' 'main.tex'
      pid: 13955
  viewer: Zathura
    xwin id: 0
    cmd_start: zathura  -x "/opt/homebrew/Cellar/neovim/0.10.2_1/bin/nvim --headless -c \"VimtexInverseSearch %{line}:%{column} '%{input}'\"" --synctex-forward 1:1:'/Users/danecross/Dropbox/Mac/Desktop/tex-papers/test/main.tex' 'main.pdf'&
  qf method: LaTeX logfile
lervag commented 1 week ago

First things first:

I have just installed nvim and vimtex on my mac M1. Here is my full init.lua file: …

require("config.lazy")

vim.g.vimtex_view_method = 'zathura'
vim.g.vimtex_compiler_method = 'latexmk'

and my full plugin file:

return {
    {
        "lervag/vimtex",
        lazy = false,     -- we don't want to lazy load VimTeX
        -- tag = "v2.15", -- uncomment to pin to a specific release
        init = function()
            -- VimTeX configuration goes here, e.g.
            -- vim.g.vimtex_view_method = "zathura"
        end
    }
}

You should move the VimTeX options inside the init function - notice the comment you've already copied "VimTeX configuration goes here". ;)

So, init.lua should look like this:

require("config.lazy")

and the plugin file:

return {
    {
        "lervag/vimtex",
        lazy = false,
        init = function()
            vim.g.vimtex_view_method = 'zathura'
            vim.g.vimtex_compiler_method = 'latexmk'
        end
    }
}

Now, the problem you are seeing does not have anything to do with VimTeX. It is most likely an incomplete install of LaTeX on your system. My suggestion would be to start with e.g. an example file as you've indicated, perhaps simplified for brevity:

% test.tex
\documentclass{article}
\usepackage{bibtex}
\addbibresource{bib.bib}
\usepackage{amsmath}

\begin{document}

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd
gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

\cite{manual-full}
\printbibliography

\end{document}

And the same bib.bib file. Now, in a terminal, go to the same directory and run latexmk test.tex. What's the output?