Skip to content
This repository has been archived by the owner on Mar 25, 2019. It is now read-only.

[Feature request] Add support for bibtex compilation #6

Open
ddnomad opened this issue Oct 3, 2017 · 9 comments
Open

[Feature request] Add support for bibtex compilation #6

ddnomad opened this issue Oct 3, 2017 · 9 comments
Assignees

Comments

@ddnomad
Copy link
Contributor

ddnomad commented Oct 3, 2017

It would be great to have an option to compile bibtex references together with the whole document. In essence, a convention that the .bib file should be called the same as the .tex file would be sufficient I think.

As for now I post-compile .aux file with bibtex manually to make the whole thing working.

The general pipeline would be the following (source):

pdflatex <options> doc.tex &&
bibtex doc && # compiles doc.bib
pdflatex && <options> doc.tex
pdflatex <options> doc.tex

Though I think adding it as a permanent pipeline might break the compilation process in case there is no .bib file so it definitely should be an option.

I would try to tuckle the problem myself but I doubt I will succeed in a short term as I'm not a vim-script ninja.

P.S. Sadly, there is no feature-request label to add

@donRaphaco
Copy link
Owner

I created the branch bibtex and made a commit: ca7ab59

If you set the option let g:neotex_bibtex=1, it will check if there is a .bib file in the same folder and with the same name as the .tex file, when loading a latex file. If there is a .bib file it will add the additional bibtex and pdflatex commands to the pipeline.
This way you can keep g:neotex_bibtex enabled on tex files without bibtex.
It should also work using latexdiff.

So it passed the "It works for me"-test, but maybe you can test yourself and give me feedback.

@ddnomad
Copy link
Contributor Author

ddnomad commented Oct 22, 2017

Great, thanks! I'll try to test it in the following days and get back to you.

@ddnomad
Copy link
Contributor Author

ddnomad commented Dec 3, 2017

My apologies for the fact testing took a little bit more then a month (basically it turns out that only now I had a necessity and time to get back to bibtex related stuff).

Sadly compilation with bibtex still do not work for me. I've pulled from bibtex branch and added let g:neotex_bibtex = 1 to my neovim config though nothing really changed.

How can I assist you to simplify the debugging process? Any kind of logs I can provide to you?

@donRaphaco
Copy link
Owner

Sorry for the late answer.
Unfortunately I have very few experience with bibtex, but there are two things you could do to help me debug:

  1. what is the output of :echo b:neotex_jobexe being in the buffer of the .tex file? Does it match the expected compilation pipeline?
  2. I updated the bibtex branch and added the option to log the output of the build process:
    With let g:neotex_log = 1 all stderr messages and with let g:neotex_log = 2 stdout and stderr messages, are written to neotex.log in the current directory.
    Hopefully this will get some indication whats wrong.

@ddnomad
Copy link
Contributor Author

ddnomad commented Jan 11, 2018

Ok, so this is the output of :echo b:neotex_jobexe:

pdflatex -shell-escape -jobname=report -interaction=nonstopmode /tmp/nvimNBSRUc/1 && bibtex repo
rt && pdflatex -shell-escape -jobname=report -interaction=nonstopmode /tmp/nvimNBSRUc/1 &
& pdflatex -shell-escape -jobname=report -interaction=nonstopmode /tmp/nvimNBSRUc/1

It looks fine. Though citing remains ? and there is no additional entry present in resulting pdf file. After enabling logging I found this in .log file:

LaTeX Warning: There were undefined references.

Overall, for some reason the whole thing do not work (while the same workflow working fine manually). The issue might be because of the compilation of the .tex document that is done on /tmp/* files while .bib file is compiled in the working directory.

@donRaphaco
Copy link
Owner

The issue might be because of the compilation of the .tex document that is done on /tmp/* files while .bib file is compiled in the working directory.

Yea, I guess that too. The weird thing is that I don't get such Errors. Maybe it's because we use different versions of latex and/or bibtex..
What's your output of pdflatex --version and bibtex --version?
Maybe I can test those versions and reproduce it.

@ddnomad
Copy link
Contributor Author

ddnomad commented Jan 18, 2018

Here you go:

+ ddnomad $ pdflatex --version
pdfTeX 3.14159265-2.6-1.40.18 (TeX Live 2017/Arch Linux)
kpathsea version 6.2.3
Copyright 2017 Han The Thanh (pdfTeX) et al.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.34; using libpng 1.6.34
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with poppler version 0.61.0

+ ddnomad $ bibtex --version
BibTeX 0.99d (TeX Live 2017/Arch Linux)
kpathsea version 6.2.3
Copyright 2017 Oren Patashnik.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the BibTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the BibTeX source.
Primary author of BibTeX: Oren Patashnik.

@donRaphaco
Copy link
Owner

I'm also on arch running the exact same versions :(
I really don't know what's the problem then...
Maybe you can give me detailed steps to reproduce from vanilla nvim (vimrc, sample .tex and .bib code, ...).

Also could you make a gist with all of your log?
The warning undefined references is normal in the first and second iteration of pdflatex, but should not appear on the third one (speaking of the compilation pipeline).

Other suggestions that might help finding the bug are welcome.

@ddnomad
Copy link
Contributor Author

ddnomad commented Jan 23, 2018

I'll see what I can do

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants