James-Yu / LaTeX-Workshop

Boost LaTeX typesetting efficiency with preview, compile, autocomplete, colorize, and more.
MIT License
10.42k stars 519 forks source link

Error when \documentclass is inside an \input file #4310

Closed dgomezcastro closed 1 week ago

dgomezcastro commented 1 week ago

Pre-checks*

Environment*

The Issue*

The MWE is the following: a main.tex file

\input{header.tex} 

\begin{document}
a
\end{document}

and the header.tex file

\documentclass{article}

When trying to run LaTeX Workshop on main.tex, it tries to compile header.tex

In more complicated cases, it may randomly choose some other .tex file.

Reproduction Steps

  1. Create the two files for the MWE and try to compile main.tex

Expected Behavior

I would expect it to compile main.tex

James-Yu commented 1 week ago

latex-workshop.latex.rootFile.indicator

dgomezcastro commented 1 week ago

Yes, this solved it. Thanks!