Skip to content

main file detection strictness #2557

@shuber2

Description

@shuber2

Description

Issue.
Commit e5de00e adds more strict mainfile detection and with commit fa5cbe4 an error is emitted when mainfile detection fails.

I have a use case where I produce lecture note slides; each lecture unit is a beamer presentation. The preamble for each lecture-xx.tex is almost the same and hence hence each file starts with an \input{slides.inc} to reduce code duplication. In particular, the \documentclass line is contained in the slides.inc.

This now breaks the mainfile detection, because a \documentclass line became necessary. (Actually, having a \documentclass is not sufficient: It cannot be certain documentclass variants and the document-environment is also necessary.)

Proposal.
I would like to propose two things:

  1. Add the required properties for the mainfile detection logic into the documentation (:help). I reverse engineered the properties through git bisect and the corresponding vimscript code.
  2. Maybe rethink whether the existence of \begin{document}…\end{document} would not be a sufficient property for a file to be a mainfile.

Steps to reproduce

No response

Expected behavior

No response

Actual behavior

No response

Do you use a latexmkrc file?

Yes

VimtexInfo

System info:
  OS: Debian GNU/Linux 11 (bullseye)
  Vim version: NVIM v0.7.0
  Has clientserver: true
  Servername: /tmp/nvimqvrkzB/0

VimTeX project: foo
  base: foo.tex
  root: /tmp
  tex: /tmp/foo.tex
  main parser: fallback current file
  document class: 
  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