Failed to read .bib file from TeXstudio (Win7 64bit) -> absolute path worked / + how to compile every .aux file when using chapterbib


  • What had worked: placing a .bib file in the same directory as the source file (.tex) and calling the BibTeX from TeXstudio
  • What didn't work: placing a .bib file in a different directory as the source file
  • How I (partly) solved: writing the absolute path to the .bib file in \bibliography{ here }


At first I wrote


in a source file for calling a library.bib file generated from Mendeley. This worked fine when the library.bib was placed in the same directory as the source file (e.g. main.tex).

But when I moved the library.bib file to somewhere else, say, "E:/Dropbox/tex/" for convenience, it didn't work.

The massage in TeXstudio was like:
Citation `Tobalske2007a' on page  19 undefined
No file main.bbl.
There were undefined references

Sometimes (I forgot when. I tried many settings) the log file was generated by BibTeX. The file (.blg) said something like:
I couldn't open database file library.bib
---line 11 of file main.aux
: \bibdata{library
: }
I'm skipping whatever remains of this command

So I googled for a while and found some people claiming you need to create a new Environment variable BIBINPUTS pointing the directory of you choice: now "E:/Dropbox/tex/". I did that but it didn't work, even with mktexlsr.

So finally I tried to write the absolute path pointing the library.bib as


which solved the problem, though not quite beautifully. Note you need to use slashes rather than backslashes (backslashes result in errors).

UPDATE 2014-01-12

The current solution has a drawback, i. e. the source cannot be compiled on a Mac as it is. Therefore, for the time being I write the portion as

% \bibliography{/Users/maz/Dropbox/tex/library}

when compiling on a Windows PC and

% \bibliography{E:/Dropbox/tex/library}

when compiling on a Mac, which did work fine (% is for comment out).

UPDATE 2014-01-12 v2

I had a trouble using chapterbib. With the default settings, TeXstudio wouldn't make BibTeX compile each .aux file; instead, only the main .aux file is compiled. I googled for several hours and finally found the workaround (for me, at least):

Go to the Command menu from Option. Find BibTeX. Replace what is now with

bibtex ?*.aux

Note this works only for the case that all the source files are in the same directory as master. I tried hiding a chapter into a directory, but so far unable to find the appropriate command to compile the .aux file in the folder with bibtex via TeXstudio (somehow the .aux file itself was successfully made). But for now I'm happy with this and maybe later I'll try this issue again.

FYI: this was the closest to my problem
And they seem to understand how to use the commands with slashes.


TeXstudio @ Win 7, 64bit。ソース (.tex) とは別のディレクトリに置いた .bib ファイルを呼ぶのがうまく行かなかった→絶対パスにしたら通った。つまり、



いちおう、このへん ( http://oku.edu.mie-u.ac.jp/tex/mod/forum/discuss.php?d=1131 ) とか見て、環境変数にBIBINPUTSを新規登録してmktexlsrとかはしたんだけどダメだった。

追記 2014-01-12


% \bibliography{E:/Dropbox/tex/library}


追記 2014-01-12 v2

chapterbib を使った場合、デフォルトの設定では個別の .aux ファイルがBibTeXでコンパイル(?)されなかった。数時間もググりながら色々試した結果、Option の Command で BibTeX のところを

bibtex ?*.aux

に変えるとどうやらうまくいった。数時間もかかってたったこれだけで解決…orz。ただ、これは「全てのソース (.tex) ファイルが同じディレクトリにある」状態じゃないとうまくいかない。適切なコマンドを選べばフォルダ分けはできそうなんだけど、よくわからなかった。あとでやるかも。

No comments: