-
Notifications
You must be signed in to change notification settings - Fork 391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
main file detection strictness #2557
Comments
I'm sorry for breaking your workflow, but I hope you can understand how these changes are actually an improvement. From VimTeX perspective, it is important to clearly specify the requirements that allow a robust "understanding" of a given project. Before the said commit, VimTeX did work in many cases, but this was coincidental. The changes were made to ease the maintenance burden for myself and to help users avoid situations that are difficult to handle from VimTeX and that may cause unexpected consequences.
The error message should already point in the right direction: vimtex/autoload/vimtex/compiler.vim Lines 191 to 198 in 06c47ed
If you read
I've thought this through quite a lot, actually. The existence of % main.tex
\documentclass{minimal}
\input{content}
% content.tex
\begin{document}
Hello world
\end{document} I believe it would be quite safe to say that the |
While improving the docs, I realize there may be a relatively simple solution that have escaped me. I'll look into it and see if I may relax the strictness. |
Wow, I am just amazed by your elaborate and quick response. Thank you very much and thank you for You minimal counter example of my proposal is of course right. Interestingly – and ironically – it is just the complementary example of my now broken workflow: % slides.inc --- the common preamble for all slides
\documentclass{beamer}
% lecture-42.tex --- one of many main files
\input{slides.inc}
\begin{document}
\end{document} Knowing about this two symmetric counter examples, I totally understand if either one will just not work. But I am quite curious about your new idea. Regarding documentation: From the implementation of
(In either cases there can be some whitespace between tokens.) This I did not find in the documentation. Did I overlook it? |
Thank you for the kind words and feedback!
I'll have to admit I mixed that up. I intended to give an example precisely like the one you provided. In fact, the one I provided actually works.
No, you were correct. I pushed an update that I believe should clarify: Lines 450 to 462 in 0bbd6b2
Of course, this may probably still be improved, and suggestions are more than welcome.
Yes, so: the vimtex/autoload/vimtex/state.vim Lines 490 to 495 in 0bbd6b2
I was thinking that I could use that same function instead of |
@shuber2 I've implemented the said fix and I think it works. Please see @2558. Let's continue the discussion there. (If you happen to have some large and complex projects (e.g. books or similar) in LaTeX, it would be useful if you could test whether the PR introduces a lag during startup, as I mention in the PR description.) |
The PR #2558 is now merged, which means mainfile detection for cases like this will now work as expected: % preamble.tex
\documentclass{minimal}
% main.tex
\input{preamble}
\begin{document}
\end{document} |
Description
Issue.
Commit e5de00e adds more strict mainfile detection and with commit fa5cbe4 an error is emitted when mainfile detection fails.
I have a use case where I produce lecture note slides; each lecture unit is a beamer presentation. The preamble for each
lecture-xx.tex
is almost the same and hence hence each file starts with an\input{slides.inc}
to reduce code duplication. In particular, the \documentclass line is contained in theslides.inc
.This now breaks the mainfile detection, because a \documentclass line became necessary. (Actually, having a \documentclass is not sufficient: It cannot be certain documentclass variants and the document-environment is also necessary.)
Proposal.
I would like to propose two things:
:help
). I reverse engineered the properties through git bisect and the corresponding vimscript code.\begin{document}…\end{document}
would not be a sufficient property for a file to be a mainfile.Steps to reproduce
No response
Expected behavior
No response
Actual behavior
No response
Do you use a latexmkrc file?
Yes
VimtexInfo
The text was updated successfully, but these errors were encountered: