Automatical update for new reference in bib file?

I just repeat it once more. All experiments step by step:

  1. My tm file uses ref.bib file. I print \cite, then right-click and select search in database and see all references in file ref.bib
  2. I open ref,bib file with xed, and add a new reference in bib format and save it.
  3. I print \cite, then right-click and select search in database and see that a new reference does not appear.
  4. Then I make Document - Update - All 3 times
  5. I repeat item 3) and note a new reference does not appear.
  6. Then Data - Open bibliography and I see the content of ref.bib file without a new reference.
  7. Again Data - Import and select ref.bib.
  8. Vu a la - a new reference appears!

In my case, I have to make steps 6-7 after adding each new reference in bib file. I expected that new reference will appear automatically.

I use Linux Mint Mate 20 (based on the Ubuntu 20). Version on Texmacs 1.99.19.

Another experiment.

  1. Data - Open bibliography. I see content of the ref.bib file.
  2. Copy reference in the bib format and then insert as Bibtex and save.
  3. The reference appears in data base and I can see it in \cite right-click search in database.

This way is shorter because I do not need to open ref.bib by an external editor.

Let us close this thread. My wishes I will put in Savannah as suggestions.

1 Like

This is expected behavior due to the differences between the TeXmacs’ internal bibliographic database and an external .bib file (see the earlier posts by @mgubi). search in database only searches the internal database.

In step 2 of experiment 1 you are adding the reference to an external .bib file, while in step 3 you are searching the internal database. Since you did not add the new element to the internal database, it is not found there by TeXmacs. Once you insert them in the internal database in step 7, it does work, because now the new element has been imported.

In the second experiment you import the new bibliography to the internal database in step 2, so then its contents are also searchable. Note that in step 1 of experiment 2, you are not seeing the contents of ref.bib. You are seeing the contents of the internal database, which in this case just happen to mirror ref.bib.

Thank you for the detailed explanation. I understand now. What is the reason for two databases - internal and external? Occam’s razor - “entities should not be multiplied without necessity”. It is difficult to find this explanation in the guide.

I am not sure about the reason. We’d have to ask the author. One reason may be convenience: the internal database is always activated, so you don’t need to first select a .bib file for every new document.

I guess the menu items could be made clearer to indicate when the internal or external bibliography is searched.

1 Like

BTW thanks a lot for the detailed description, before this discussion I did not know that there is a bibliographic database, I had used only the external BibTeX (will probably continue to do so at least until I figure how to have multiple bibliographic databases).

1 Like

Thanks to @jeroen for the clear explanation of the situation. TeXmacs has two ways to deal with bibliography (as I’ve also written in a previous post in this thread). The reason is flexibility wrt. to the user: any particular solution has technical tradeoffs. The internal database can be managed easily from within TeXmacs while external bib files could change without notice, being incorrect, etc… I agree however that we should be able to autocomplete from external bib files also, maybe monitoring them or just reading all the definitions when we scan them for typesetting the bibliography. I think the current behaviour is that (like in TeX, the only relevant bibliography items used from a bib file are those explicitly mentioned in the document). However if the user ask for autocompletion we should be able to rapidly scan eventual bib files mentioned in the document to find suitable matches.

1 Like

As for me - it is very useful functionality for valuable work. I have already written above that it is better to have your own collection of references and use them in Texmacs and after work by single click create the bib file with references used for this paper. I will write this suggestion in Savannah. It will be better if you will write your suggestion, too.

@JoePass I come back to this issue to make some comments:

  1. You can have a global .bib file and keep in sync with the internal database. For this you just import the .bib file in the database using the appropriate menu item. Every time you change the .bib file you can update the database, TeXmacs will import only the changes. This is how I use this functionality. The internal database has the advantage that you can lookup the entries from within TeXmacs when you use \cite.

  2. The generation of a .bib file with the local references could be a useful feature, I agree. But then, does a LaTeX system provides you with such a feature? If yes, which one? I’m not aware of any (but I do not know this area very well). When I submit papers to editors in LaTeX format I always include the generated bibliography by hand, so that I do not need to transmit also the .bib file. This is even better for archiving since if I loose the bib file I cannot retypeset the LaTeX document again.

1 Like

I guess that what Joe really wants is TeXmacs to be a bit more aggressive in rereading bibfiles from disk. In principle, when we are inside a \cite, TeXmacs could regularly check whether the bibfile was changed on disk and undertake some action if this is the case.

Unfortunately, I have not had time yet to implement such a thing, but I think that it might be a useful feature. A similar remark can be made about linked images. If you change them on disk, then it would be nice to refresh them as early as possible inside TeXmacs.

1 Like

This seems to be OS-dependent. I remember that some part of gvfs could automatically inform the updates of files, for example.

We could use this:

via Qt to keep track of interesting files and trigger some action upon changes.

A related subject: something that is quite dangerous is when you move via the filesystem a file which is open in TeXmacs. I’m not sure in this case we handle the thing correctly.