Skip to article
Documentation

Main files and document dependencies

Resolve chapter roots and inspect shared, missing, or cyclic inputs.

On this page

Choose a document root#

A chapter usually cannot compile alone: the root supplies its document class, packages, macros, and bibliography. In the workshop, main.tex owns the chapters:

\documentclass{article}
\usepackage{amsmath,longtable,hyperref}
\begin{document}
\input{chapters/introduction}
\input{chapters/results}
\bibliographystyle{plain}
\bibliography{references}
\end{document}

Use Mark as LaTeX Main File on the intended root and Show LaTeX Main File to inspect the active choice. An explicit project selection is helpful in a repository containing an article and a presentation.

Root comments and precedence#

A chapter can declare % !TeX root = ../main.tex near its beginning. The path is relative to that chapter and must remain inside the project. Explicit project settings take precedence over comments; comments take precedence over inference and application defaults.

Use Tools → LaTeX → Project settings to specify project root, main file, and output directory. Relative paths are constrained to the project. By default the build works from the main file’s directory; an explicit project root changes that base.

Inspect the dependency tree#

Choose Tools → LaTeX → LaTeX: Document Dependencies. The LaTeX Dependencies window provides Refresh, Open File, Show Declaration, Expand All, and Collapse All.

Expand the root to inspect included chapters, bibliography files, local packages, and referenced assets. Open File follows the dependency; Show Declaration opens the command that introduced it. Shared dependencies and cycles are shown without endlessly expanding them.

Diagnose an unresolved edge#

Check spelling, path base, main root, and unsaved edits. Refresh reads current editor content. A distribution package marked not resolved locally is not necessarily missing from the compiler installation; compare with kpsewhich/compiler output.

Use separate roots for independent documents. If two documents both include a shared chapter, do not assume the plugin can infer which root you want; mark the intended one explicitly.

Manual for version 2026.1.14 · Reviewed