question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot find LaTeX root file

See original GitHub issue

Describe 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 code_2019-02-09_17-13-03

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:closed
  • Created 5 years ago
  • Comments:22

github_iconTop GitHub Comments

1reaction
funnym0nk3ycommented, Jul 24, 2019

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.

0reactions
AnmolMagocommented, Jan 19, 2020

This error appeared for me when the binaries were not in my path.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found