Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document with biblatex bibliography "Failed to compile bibliography" #46

Closed
ChrisLane opened this issue Oct 14, 2017 · 15 comments
Closed
Labels

Comments

@ChrisLane
Copy link
Contributor

Expected behaviour

Expect the plugin to compile successfully and display the PDF.

Actual behaviour

Vim displays "Failed to compile bibliography".
From looking at the files in /tmp, everything seems to have compiled fine and the PDF looks correct.

Steps to reproduce

  1. Create these files "test.tex": https://paste2.org/BjB2YcEs and "test.bib": https://paste2.org/Zhhnyngc
  2. Try to run :LLPStartPreview

System configuration

@badouralix
Copy link
Collaborator

badouralix commented Oct 14, 2017

Hi @ChrisLane! Thank you very much for your clear bug report!

Running the bib compiler by hand, I got it failing with this error message:

This is BibTeX, Version 0.99d (TeX Live 2017/Arch Linux)
The top-level auxiliary file: test.aux
I found no \citation commands---while reading file test.aux
I found no \bibdata command---while reading file test.aux
I found no \bibstyle command---while reading file test.aux
(There were 3 error messages)

According to Google, these are bibtex related errors. Running biber instead compiles correctly. Unfortunately, changing bibtex to biber in vim-llp#L195 leads to a bunch of new errors, that need to be fixed... IMHO, the proper way to handle such an edge case would be to rewrite the plugin to use latexmk, but it is still WIP.

For now, a workaround for you is to change the second line of your test.tex to \usepackage[style=authoryear,backend=bibtex]{biblatex}, in order to make it compliant with the tools this plugin uses.

@badouralix badouralix added the bug label Oct 14, 2017
@ChrisLane
Copy link
Contributor Author

Thanks for your response. I do typically use latexmk when I want to actually output a PDF and so I look forward to that work that's underway.

What I find strange is that a PDF is generated but the plugin doesn't open it in the viewer. I tried making the line change that you mentioned but am still getting the same "Failed to compile bibliography".

@badouralix
Copy link
Collaborator

Okay, actually the backend=bibtex only works if some test-blx.bib exists in the main directory. It roughly looks like:

@Comment{$ biblatex control file $}
@Comment{$ biblatex version 2.8 $}
Do not modify this file!

This is an auxiliary file used by the 'biblatex' package.
This file may safely be deleted. It will be recreated as
required.

@Control{biblatex-control,
  options = {2.8:0:0:1:0:1:1:0:0:1:0:2:3:1:79:+:nyt},
}

It can be created by running pdflatex test in the main directory once (dirty workaround, but still).

I couldn't get the PDF properly generated in the tmp directory. There is one (first pdflatex compilation), but bibliography is missing (bib compilation fails and further pdflatex compilations are aborted).

@ChrisLane
Copy link
Contributor Author

Hopefully there will be a clean solution to this soon 😄

@badouralix
Copy link
Collaborator

ASAP ( but I didn't have enough time to fix it yet 🙈 )

@s2-t2
Copy link

s2-t2 commented Mar 14, 2018

I have a similar issue. Trying to preview the document using :LLPStartPreview gives the error:
failed to compile bibliography.
Compiling with \ll works fine and a dvi file is created which looks right that can be opened with okular.
I am trying to compile this latex template available here:
https://www.overleaf.com/latex/templates/wppm-thesis-template/npxqzncsmsch#.Wqk6tUso9hF

I tried using pdflatex BasicDoc.tex which generates BasicDoc-blx.bib and changed the line in Preamble.tex to have backend=bibtex but get the same error.
Is there a workaround for this or some very obvious thing i am missing probably ?

@smilesun
Copy link

smilesun commented Apr 6, 2018

same problem

@renan-eccel
Copy link

same here

1 similar comment
@kevinalexmathews
Copy link

same here

@Iddingsite
Copy link

Same here !

@leikoilja
Copy link

Oh, sadly still a problem in 2019

@AnonymousSnake
Copy link

Still a problem 11/28/2019

@Soar-Sir
Copy link

Soar-Sir commented Feb 8, 2020

Still a Problem 2020

@changmg
Copy link

changmg commented Mar 5, 2020

Still a problem 3/5/2020. I have an alternative trick to skip this bug in Ubuntu 18.04.
First, rename the "bibdata.bib" to "bibdata_bib_bk".
Second, manually compile the project. "pdflatex main.tex; bibtex main".
Third, open vim and type "LL", a pdf preview file without references will be generated.
Finally, rename "bibdata_bib_bk" to "bibdata.lib". The pdf preview file will include the references and then you can use it as usual.

@sunwukonga
Copy link
Contributor

sunwukonga commented Apr 3, 2020

I don't have time for a pull request right this minute, but to get this going with bibtex (what the code is already using), you'd need to change your tex file as mentioned above

\usepackage[style=authoryear,backend=bibtex]{biblatex}

and make the following adjustments to how bibtex is called:

        " Update compile command with bibliography                              
        let b:livepreview_buf_data['run_cmd'] =                                 
                \       'env ' .                                                
                \               'TEXMFOUTPUT=' . l:tmp_root_dir . ' ' .         
                \               'TEXINPUTS=' . l:tmp_root_dir                   
                \                            . ':' . b:livepreview_buf_data['root_dir']
                \                            . ': ' .                           
                \ ' && ' .                                                      
                \       b:livepreview_buf_data['run_cmd'] .                     
                \ ' && ' .                                                      
                \       'cd ' . l:tmp_root_dir . ' && bibtex *.aux' .
                \ ' && ' .                                                      
                \       b:livepreview_buf_data['run_cmd']

This calls pdflatex orxelatex on your tex file, and produces the necessary .aux file for bibtex. It then moves to the appropriate directory to run bibtex on all the produced aux files. Absolute paths will NOT work unless you have loosened a particular security restriction in your texmf.cnf file.

In summary, it wouldn't work before because:

  1. Needed to run pdflatex before and after bibtex
  2. Absolute paths are not allowed for security reasons

This can also be done for biber as well:

  1. Your tex could remain the same, because biblatex uses biber by default
  2. Change *.aux to *.bcf used by biber

Ultimately, which executable to use [biber, bibtex], could be selected either by doing a regex for a combination of conditions on the tex file, default bibtex except when biblatex package used with no backend=bibtex option, OR by creating a new option g:livepreview_biber to use biber explicitly, otherwise default to bibtex.

sunwukonga added a commit to sunwukonga/vim-latex-live-preview that referenced this issue Apr 3, 2020
Run tex engine before and after bib executable
Add support for both `bibtex` and `biber`
 - Add global variable `g:livepreview_biber`
Add Bibliography section to README
 - Detail usage of `g:livepreview_biber`
 - Detail usage with `biblatex`
sunwukonga added a commit to sunwukonga/vim-latex-live-preview that referenced this issue Apr 3, 2020
Run tex engine before and after bib executable
Add support for both `bibtex` and `biber`
 - Add global variable `g:livepreview_biber`
Add Bibliography section to README
 - Detail usage of `g:livepreview_biber`
 - Detail usage with `biblatex`
@badouralix badouralix mentioned this issue May 8, 2020
sunwukonga added a commit to sunwukonga/vim-latex-live-preview that referenced this issue May 19, 2020
Run tex engine before and after bib executable
Add support for both `bibtex` and `biber`
 - Add global variable `g:latexlivepreview_use_biber`
Add Bibliography section to README
 - Detail usage of `g:latexlivepreview_use_biber`
 - Detail usage with `biblatex`
Clean up calls to bibexec commands
Remove `cd` from processing of bib commands
 - Move code that selects this option to the initializer
Give more meaningful feedback when `engine` and `preview` commands are not valid
 - Throw errors from this context
Catch errors in the initializer and then stop execution
Move README section about bibliographies
Update README to reflect change of g:latexlivepreview_biber
Add section in Known Issues about bibliographies to README
Add auto handling of certain bib setting mismatches
Fix bugged warning when `biblatex` not used
Add latex label to latex code in README
Use snake_case not camelCase
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests