It is nice that LaTeX-Workshop has support for subfiles, but it is tiresome that when in a subfile the build command asks you which file to build every time when you are building often (for instance when designing graphics). It would be nice if there was either on of the following equivalent solutions
build that would make it just build the current tex file, regardless of its root/subfile statusbuild_subfile or build_current_fileautobuild since it already has a similar optionUntil the last update using the subfile document class with no .tex extension for the root file made LaTeX-Workshop behave as it were not a subfile (which was not perfect, but at least worked) but this has been fixed :-)
Why cannot you directly use autobuild?
Because for most files it triggers too often, for instance I don't want it to build my root file every time I modify it.
Oh, and I just noticed that the pdf viewer also asks which file I want to see :-(
Oh, and I just noticed that the pdf viewer also asks which file I want to see :-(
Yes, but you typically only call the viewer once as it gets updated automatically after each build.
Ah, not in my current workflow for long documents I usually summon it right after I build, do a few back-and-forth with SyncTeX to see if the specific part I have changed render correctly, then close it because it takes too much space, but I guess I could drop it in a tab instead.
(Note to potential readers: for now I simply disable the subfile management using a % !TEX root = mysubfile.tex magic comment)
I am also looking forward to having a command build_current_file in the sidebar.
Going back to the original post, three options were considered
- A “don't ask” setting for
buildthat would make it just build the current tex file, regardless of its root/subfile status- A dedicated
build_subfileorbuild_current_file- An option to manually trigger
autobuildsince it already has a similar option
After a bit of thought and to avoid adding extra commands in the sidebar that only make sense in specific frameworks, here is what I plan to implement
build and view commands prompt the user for selecting the proper filelatex-workshop.latex.rootFile.useSubFile to decide which file to consider.I guess everybody should be happy with this.
That would fit perfectly :-)
Just set latex-workshop.latex.rootFile.doNotPrompt to true.
The default value for this new setting is false. Il will update the wiki.
Thank you very much, that was quick!
How can I only build the current subfile section1.tex with Build with recipe. I don't want to build the main.tex everytime.

set latex-workshop.latex.rootFile.doNotPrompt to true seems not work for me.
You also need to set latex-workshop.latex.rootFile.useSubFile to true.
From your screenshot, you need to replace \documentclass[main.tex]{subfiles} by \documentclass[../main.tex]{subfiles}. If you need more help, open a new issue and fill all the required information.
Most helpful comment
Just set
latex-workshop.latex.rootFile.doNotPrompttotrue.The default value for this new setting is
false. Il will update the wiki.