ajshort / vscode-latex-preview

Compilation and embedded preview of LaTeX documents for Visual Studio Code
MIT License
32 stars 11 forks source link

support for main file #6

Closed mchwalisz closed 7 years ago

mchwalisz commented 7 years ago

It is usual that bigger latex documents are split into smaller files with one main document that needs to be built. Currently the extension gets lost in such environment. I can select my main document e.g. report.tex, compile and preview it. It is even able to point back from pdf to included files (which is good).

However when I try to preview any included file, it always tries to compile it and not the main report.tex file.

I use latexmk for compilation. I even have .latexmkrc config in my folder that points it to

@default_files = ('report.tex');

which usually tells latexmk to only build that file.

In such setup extension is too helpful as it tries to specifically compile a file:

latexmk -jobname=preview -synctex=1 -interaction=nonstopmode -file-line-error -pdf -output-directory="/tmp/tmp-12444xMpHuHL4sftP" "/home/user/docs/./background.tex"

In my opinion it clearly relates to #3 but gives much more focus on the actual problem. Feel free to mark it as duplicate and close (I'm actually only interested on solving an issue). I'm just starting with VS code so cannot help in implementation.

ajshort commented 7 years ago

Do you think a good fix would be to add a VSCode config option allowing you to specify the file to compile?

mchwalisz commented 7 years ago

In the ideal solution I would like it to be automatically detected. There are multiple ways latex solves it internally (which might be a nightmare to implement). Sublime LaTeXTools solves it somehow.

On the other hand, as the first step the option to select a main file is a good solution for now (LaTeX Compile does that).