On Monday 16 March 2009 04:59:18 Guenter Milde wrote:
> On 2009-03-15, Stefano Franchi wrote:
> > 3. The preamble of the master document calls the \bibliography commands
> >    with 4 .bib files
>
> As the preamble is "free LaTeX source" (like ERT), lyx is not aware of
> the \bibliography call there.
>
> Where are your .bib files?
>
> > launching lyx from console and looking at the output reveals that the
> > problem is that bibtex cannot find the bib files:
> >
> > However, If I export to the whole manuscript to latex (plain) and
> > compile from the command line everything works fine, all the bib
> > references are found, etcetera.
>
> LyX uses a temporary directory. This might be the cause. You can try to
> disable the temporary directory (I don't know how exactly but guess
> that giving an empty path for the TempDir in Tools>settings helps).
>
> > 2. I tried creating soft links to the actual files in the local
> >    directory and substituting just file names for absolute paths.  No
> >    difference.
>
> I would try to put (or link) the *.bib files into a directory in the
> BIBINPUTS path, so it is found by LaTeX/BibTeX from everywhere.
>
> .. and substituting just file names for absolute paths.
>
>
> Günter

Problem solved. It tuned out to be two small problems, actually, which is why 
I was lost. I am typing what I found out for future reference and general 
posterity:

1. Thanks to Richard's and Gunter's explanations I know now what LyX does 
behind the scene when it compiles a .lyx to .pdf
Result: LyX will not find the bib files if both these conditions are true (Of 
course they both were in my case...):

a-  BibLatex is used for the bib references
b- the bib files are located in the document's directory and referred to by 
relative pathnames

This is because LyX does its behind the scene work by copying all the files it 
needs to a remote directory (/tmp/.... on Linux) and doing the latex 
compilation there. If b is true and a is false, LyX strategy will work: the 
bib files declared within LyX will be copied as well, and everything is fine. 
When using BibLatex, however, the files are declared in the preamble, which LyX 
ignores, and will not get copied. BibTex will then use the relative pathnames 
from a remote directory and fail

Exporting to Latex, on the other hand, will work, because the exported .tex 
files are located in the original directory alongside the .bib files.

Moral of the story: never use relative pathnames with BibLatex unless you want 
to export to Latex everytime you want your references to come out right.

2. Second problem: It turns out that the preamble command needed to specify 
.bib files in Biblatex can accept comma-separated multiple files ONLY IF there 
are no spaces separating them. Otherwise BibteX will fail with a rather 
cryptic error message which it took me a while to decode. Of course, the 
"comma space" sequence is so deeply engrained in my fingers that I hadn't even 
noticed I was typing extra spaces. 
Moral of the story: Never put spaces in the \bibliography command


Cheers,

S.



 



______________________________________________________________
Stefano Franchi
Department of Philosophy          Ph:  (979) 862-2211
Texas A&M University              Fax: (979) 845-0458
305B Bolton Hall                  fran...@philosophy.tamu.edu
College Station, TX 77843-4237

Reply via email to