TransWikia.com

BibTeX does not work with relative path, but using absolute path, it works

TeX - LaTeX Asked by Camford Oxbridge on June 1, 2021

What should I do to run bibtex with relative path?

I put a .tex file and a .bib file in same directory.

I use the following two cases to run bibtex, one is described with relative path and the other is absolute path. I am not sure, but I guess relative path is required for submission. When I submit my paper, I guess, compilation on web is required and if I use the absolute path, it dose not success. I reinstalled tex of ver. 2020, but it did not change anything.

Even if I put .bib file in path C:texlivetexmf-localbibtexbiblocal, the code bibliography{} with ralative path did not work.

1. relative path

bibliography{hoge}

2. absolute path

  bibliography{C:/Users/81909/Desktop/SeptFinalWork2020Sept/hoge}

If I use the former (1. relative path), then the following error occurred.

This is BibTeX, Version 0.99d (TeX Live 2020/W32TeX)
The top-level auxiliary file: test.aux
The style file: elsarticle-num-names.bst
I couldn't open database file hoge.bib
---line 26 of file test.aux
 : bibdata{hoge
 :              }
I'm skipping whatever remains of this command
I found no database files---while reading file test.aux
Warning--I didn't find a database entry for "Villani"
Warning--I didn't find a database entry for "Burago"
Warning--I didn't find a database entry for "Gromov"
Warning--I didn't find a database entry for "Flores"
(There were 2 error messages)

According to Where should I put bibfile.bib to use it directly in bibliography{bibfile}?,
I inserted the line BIBINPUTS = .;$TEXMF/bibtex/bib// in the file texmf.cnf located in C:texlive2020texmf.cnf and then run the code mktexlsr on command prompt to reflect the modification of texmf.cnf.

Contents of my texmf.cnf is the following which is in the pathC:texlive2020texmf.cnf

 % (Public domain.)
% This texmf.cnf file should contain only your personal changes from the
% original texmf.cnf (for example, as chosen in the installer).
%
% That is, if you need to make changes to texmf.cnf, put your custom
% settings in this file, which is .../texlive/YYYY/texmf.cnf, rather than
% the distributed file (which is .../texlive/YYYY/texmf-dist/web2c/texmf.cnf).
% And include *only* your changed values, not a copy of the whole thing!
%
OSFONTDIR = $SystemRoot/fonts//
BIBINPUTS = .;$TEXMF/bibtex/bib//

% Prefer external Perl for third-party TeXLive Perl scripts
% Was set to 1 if at install time a sufficiently recent Perl was detected.
TEXLIVE_WINDOWS_TRY_EXTERNAL_PERL = 0

I have struggled for several days, but I cannot get any solution. I am a beginner of TeX.

One Answer

Here are some suggestions for bibtex (putting it here because too big for comment).

  1. Use biber as your default biblatex compiler
  2. Keep usepackage{biblatex} in your preamble (you may want to use options for customizations such as sorting)
  3. Add your bibliography information in the preamble with something like bibliography{filename.bib}
  4. Use printbibliography
  5. Make sure your TeXlive version is updated (mine is 2020)

Hopefully you will not face the same issue if all the steps are taken. Also, try not to make the filename same as the parent tex filename.

Answered by Masum on June 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP