Skip to content

Vimtex can't recognize the main.tex file #2483

@Yorkwn

Description

@Yorkwn

Description

For some reason the last 2 weeks or so i've been unable to compile the main file of my latex project. I've explained the general issue also in the neovim subreddit so i won't repeat what i explained there. On the minimal directory,

main.tex includes:

\input{preamble.tex}

\begin{document}
Hello World
\end{document}

and preamble.tex:

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}

Steps to reproduce

  1. vim minimal.vim same as the example file but with plugged/ instead of bundle/
  2. mkdir Documents/minimal
  3. cd Documents/minimal/
  4. touch main.tex
  5. touch preamble.tex
  6. vim -u ~/minimal.vim main.tex

Expected behavior

The expected behavior would be to recognize the main.tex file and compile the document.

Actual behavior

Instead i get this error:

VimTeX: Compilation error due to failed mainfile detection!
Please ensure that VimTeX can locate the proper main .tex file.
Read ":help vimtex-multi-file" for more info.

Do you use a latexmkrc file?

No

VimtexInfo

System info:
  OS: Fedora release 36 (Thirty Six)
  Vim version: VIM 9.0 (1-348)
  Has clientserver: false

VimTeX project: main
  base: main.tex
  root: /home/gk/Documents/minimal
  tex: /home/gk/Documents/minimal/main.tex
  main parser: fallback current file
  document class: article
  packages: inputenc
  source files:
    main.tex
    preamble.tex
  compiler: latexmk
    engine: -pdf
    options:
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 1
    executable: latexmk
  viewer: General
  qf method: LaTeX logfile

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions