-
Notifications
You must be signed in to change notification settings - Fork 386
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
Path to bib file in a command #1745
Comments
Could you explain exactly what you mean with "does not detect", here? Are you referring to the ToC? Or other features?
Well, everything is possible. But this does present a new and quite hard challenge, and I'm not sure I'm up to it. So far, vimtex has not added any support for actually parsing the TeX macros, and it seems a very complicated problem (indeed, this is what TeX itself is supposed to do, right?!). However, I'm curious if it is possible to circumvent it by reading the aux file or something similar, in which perhaps the parsing is already done. Could you provide a minimal example of this on which I could try things out?
Yes, I do find this sort of abstraction somewhat a bad practice. But that's my personal opinion, and does not necessarily represent a good opinion. The reason I think it is bad practice is because you are adding complexity/abstraction for no apparant reason. What are you really trying to accomplish? When you do things like this, you are making the life much more difficult for tools that try to help you (e.g. vimtex). Sometimes, things like this is necessary e.g. for parametrized, automatic documents. Or perhaps for documents that include a common part, or whatnot. Still, I've actually never used methods like this for anything, and I don't think I'm "missing out". |
ToC and auto-completion. I find it handy to have '\GraphicsFolder' and '\MyPackagesFolder' globally defined when working on subfiles. As for '\BibliographyFile', I use to have one subfile 'notes.tex' which uses a bib file generated by Mendeley containing all my references whereas the main document uses a local polished bibliography. I achieve this by redefining '\BibliographyFile'. It is probably an obscure solution which can be imitated in other ways but it somehow evolved spontaneously. Below is a test document: If you use the aux file then it will work first after a compilation ... I understand if you don't want to spend time on this and will close the ticket if you wish. Thanks for the great work anyway! |
I don't think that making it work in my situation would require more than writing down a correct regex and applying simple recursion. If further expansion requires the TeX engine, i.e., if a command is not defined in the current files, then an error message could be displayed in ToC instead. |
Ok, I see. I'm not sure I will be able to change vimtex to support your (at the least semi obscure) solutions, but let's see.
Happy you like it! I will check if it is possible to parse the aux file for bib locations. If so, then I think that may be a possible improvement. If it is not possible, then I am afraid I don't really have the capacity to address such a complex task as of now. Sorry.
But I don't want to make things work in just "your situation", I want to improve vimtex in a more general manner. I try to avoid "hacks" that may lead to unexpected problems. Thus, if I were to look into a proper solution, it would include:
Again, I'm not saying this is impossible, but I think it is complicated and it will need quite some time to implement properly. I will be very glad to consider PRs for this (and will gladly help in reviewing and so on). Looking at your test files: Again I don't quite see the benefit of using the custom path macros instead of just typing them out. Can you not simply add a second |
Yes, it seems to behave in the same way. |
I've responded in length, so it is unclear what you are now replying to. What is behaving in the same way? |
Sorry, It is the very last question that I don't have to use my definitions and can just write |
Ok, it seems it is possible to parse auxiliary files for the bib files, and I believe it will be more efficient than the current method. However, it will only be possible as a solution for completion, not for the ToC, since the ToC parses the latex files. I will keep the issue open until I've looked into this. It might be better to parse e.g. the |
Ok, I've now implemented a minor change where the |
Thanks @RiMillo for the heads up and good description. I think it is fixed now. |
Description
I have a document structure with the main file 'text.tex' and several subfiles. The preamble of 'text.tex' contains the following definitions:
If I want to include bibliography, I have the following command either in 'text.tex' or in one of the subfiles:
In this setting, VimTex does not detect the bibliography file 'bibliography.bib'.
Question
Would it be possible for VimTex to recursively unfold '\BibliographyFile' to the actual path to 'bibliography.bib' or do you find this sort of abstraction a bad practice in general? Of course, if I replace '\BibliographyFile' with the actual path to 'bibliograph.bib', then VimTex detects it. Thanks!
The text was updated successfully, but these errors were encountered: