On Jun 14, 2012, at 16:10 , Richard Heck wrote:

> On 06/13/2012 07:54 AM, Rainer M Krug wrote:
>> While we are at that subject what is missing in the citation management, I 
>> would like to see two things:
>> 1) the possibility to create a local .bib file (in the directory of the .lyx 
>> file) which contains only the references used. This would make co-operation 
>> between authors much easier. If this file could be embedded in the .lyx 
>> file, this would be brilliant, although this is not necessary, as other 
>> external files also exist.
>> 
> I'm not sure exactly how you want this to work, but it can easily enough be 
> done with aux2bib. The downside to this method, to my mind, is that it's 
> one-off: Once you've created this custom bib file, you've lost the ability to 
> cite anything from your other bib file. So I tend to do this only at the end, 
> or near it.

Here is more precisely the plan.

First, we need a function that gets the active BibTeX insets - i.e. the 
bibliography insets that would be used by a citation at this point of the file. 
This should deal with sectioned bibliographies, but in order to work with 
those, would need to use a LyX inset to separate bibliographies. Once we have a 
list of BibTex insets, we can check for LyX managed BibTeX files (using a 
special header in the .bib file - managed bibs in the following) that LyX has 
the right to modify. 

When we need to update a LyX managed BibTeX file, the process would go a bit 
further, by - if needed - (1) Proposing to create a BibTeX inset at the end of 
the file and (2) creating a managed bib in one of the insets (The first? Ask 
the user?) 

Only one function is really needed for basic functionality, that is a function 
that add/update one BibTeX entry

bibtex-entries-put <entry>

It would either identify a managed file where the entry exists and update it 
(by re-writing only the entry), or add it to one of the managed bib. In order 
to update a BibTeX file, LyX can mostly rely on the BibTeX parsing code already 
present and copy the file up to the entry, replace the entry by the one given, 
and then copy the rest of the file. This does seem to be difficult to achieve.

If you agree on this, I will start (I would like to target 2.1) to work on it 
and post a patch on the list when ready.

Benjamin

Reply via email to