Cannot find LaTeX root file
See original GitHub issueDescribe the bug
LaTeX Workshop does not build the document on save of a subfile.
To Reproduce
Create main file test.tex
with:
\documentclass{book}
\begin{document}
\mainmatter
\include{./file}
\end{document}
Subfile file.tex
with:
% !TEX root = ./test.tex
\chapter{Second file}
test test asdf bla bal asdfa
\endinput
Expected behavior Document is being built on save of the subfile.
Logs
[17:03:52] File watcher: responding to change in d:\Demo\file.tex
[17:03:52] Parsing d:\Demo\file.tex
[17:03:52] Auto-build d:\Demo\file.tex upon save.
[17:03:52] BUILD command invoked.
[17:03:53] Cannot find LaTeX root file.
Screenshots
Desktop (please complete the following information):
- OS: Windows 10
- VS Code version: 1.31
- Extension version: 5.21.0
Additional context
In my actual document I also got the error message:
extension-output-#3 is not a valid LaTeX file.
but I couldn’t reproduce that. The bug first appeared today when the tex symbol in the very left sidebar appeared for the first time. Yesterday the same document worked even without the magic comment.
EDIT: Now I also sometimes get ACTIONS command invoked.
after which the Build symbols circles endlessly without result.
Issue Analytics
- State:
- Created 5 years ago
- Comments:22
Top Results From Across the Web
Specify the file to be compiled in VSCode Latex Workshop
My personal issue was that my b.tex file does not contain \begin{document} which Latex Workshop look for when automatically finding the root ......
Read more >What is a LaTeX root document? - TeX
I could reproduce the problem with Kile 4.14.9: Kile expects the root document to contain the \documentclass command.
Read more >VScode配置latex时出现“Cannot find LaTeX root file”且文本无 ...
直接安装vscode的插件latex workship即可。 要是有同学需要,可以出一个VCcode+latex配置过程。
Read more >A brand new website interface for an even better experience!
"Cannot find LaTeX root file" error occurs - not importing anything.
Read more >Multi-file LaTeX projects - Overleaf, Online LaTeX Editor
bib files etc.—we strongly recommend that you only compile files contained in the root directory of your project. The subfiles package.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m having a similar issue. It seems to appear when the current focus is not on a .tex file. E.g. when editing my .gitignore in a divided window parallel to my main.tex file and then press latexmk I get the error. But when bringing focus to my main.tex it works. Maybe that’s the reason.
This error appeared for me when the binaries were not in my path.