Ling Li wrote:
> Problem:
> While adding .bib files via "BibTeX Database form," they are sorted
> alphabetically. However, sometimes this is not desired. For example, I
> put all "@string" into a abbrev.bib file and would like this file to be
> listed at first. If there is another aaa.bib file which uses those
> @string definitions, auto sorting will result in bibtex error.

Dear Ling, many thanks for this.

Jean-Marc, I think that we should apply his 'simple' fix to both 1.3.x and 
1.4. What think you?

Angus

> Root:
> FormBibtex.C calls eliminate_duplicates(dbase) to remove duplicates in
> dbase. In eliminate_duplicates (defined in lyxalgo.h), dbase is first
> sorted.
> 
> Fix: (src/support/lyxalgo.h)
> A quick patch is to rewrite eliminate_duplicates as
> 
> template<class C>
> void eliminate_duplicates(C & c)
> {
>     for (size_t i = 1; i < c.size(); ++i) {
>         typename C::iterator ci = c.begin() + i;
>         if (std::find(c.begin(), ci, *ci) != ci) {
>             c.erase(ci);
>             --i;
>         }
>     }
> }
> 
> This works fine and is efficient for small size c.

Reply via email to