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

[windows support] Make bib completion work on windows #20

Closed
lervag opened this issue Jul 9, 2014 · 11 comments
Closed

[windows support] Make bib completion work on windows #20

lervag opened this issue Jul 9, 2014 · 11 comments

Comments

@lervag
Copy link
Owner

lervag commented Jul 9, 2014

This issue was first mentioned by @petobens here. He suggest that I make changes similar to this change in LaTeX-Box at this line.

@lervag
Copy link
Owner Author

lervag commented Jul 9, 2014

I think the last commit should fix this issue. Could you test?

@petobens
Copy link

petobens commented Jul 9, 2014

Using the following MWE:

\documentclass{article}

\usepackage{biblatex}
\addbibresource{biblatex-examples.bib}

\begin{document}
\textcite{
\end{document}

I get the error:

Error detected while processing function latex#complete#omnifunc..latex#complete#bibtex..<SNR>174_bibtex_search:
line   26:
E484: Can't open file tmpfile.bbl

@petobens
Copy link

I manage to partially fix this. It won't work with the MWE that uses \addbibresource{biblatex-examples.bib} but it works if there is a test.bib file in the same directory as the current file:

\documentclass{article}
\usepackage{biblatex}
\addbibresource{test.bib}
\begin{document}
\textcite{
\end{document}

I hope you can help me fix the general case (does it work on Unix)?

@lervag
Copy link
Owner Author

lervag commented Jul 14, 2014

The first MWE won't work because the bibtex_search function does not know where biblatex-examples.bib is.

The mechanism behind the completion is really very simple: We create a temporary aux file that includes every citation from every bib file, then we use bibtex with a custom style file to generate a bbl file that we finally parse to get the candidates.

I now notice that the parsing of the bib files with s:bibtex_find_bibs modify the found files to yield full paths. This is "good" in the sense that it makes things work when the tex project is "complicated". However, it is probably not very good since it breaks the latex internal "knowledge" of "special" bib files (such as this biblatex-examples.bib).

I just tested the example after using relative paths instead of full paths, and that seems to make things work. I'll make the change, since it seems to work. If someting breaks for complicated projects, then I'll investigate further.

@lervag
Copy link
Owner Author

lervag commented Jul 14, 2014

Fixed by 55a35fc.

@lervag lervag closed this as completed Jul 14, 2014
@petobens
Copy link

Thanks! This in fact fixes the example but there is a scenario that still has issues. Maybe it falls under what you've called "complicated projects" but I think it is pretty simple and quite common. Let a_main_file.tex be

\documentclass{book}
\input{preamble.tex}
\begin{document}
  \include{bar}
\end{document}

where, preamble.tex is

\usepackage{biblatex}
\addbibresource{test.bib}

bar.tex is

\section{Bar section}
\label{sec:bar_section}

and test.bib is

@Article{foo10,
  author  = {Foo},
  title   = {Bar},
  journal = {journal name},
  year    = {2010},
  volume  = {volume number},
  number  = {number},
  pages   = {page range}
}

If you write \textcite{ in bar.tex then no completion happens.

Additional question regarding the mechanism to build de bbl file: can bibtex be invoked only when the bib file (in my example test.bib) changes? i.e is it possible to cache the bibcompletion candidates rather than generating a bbl file every time?

@lervag
Copy link
Owner Author

lervag commented Jul 15, 2014

Ah, interesting. Could you try to set g:latex_complete_recursive_bib = 1?

@lervag
Copy link
Owner Author

lervag commented Jul 15, 2014

Regarding your second question: Yes, that would be possible. However, it seems to complicate things, so I'm curious if it is worth the effort. Do you have any performance issues or similar?

@petobens
Copy link

Setting g:latex_complete_recursive_bib = 1 indeed fixes the issue. I missed that from the docs. I'm sorry about that. Thanks!

@petobens
Copy link

Regarding the second question, I have no performance issues at all. If it complicates things then just forget about my question. I only asked it because I noticed that you recently improved the TOC and thought that maybe if it wasn't too much trouble you were willing to also improve bibcompletion. Thank you for the great help!

@lervag
Copy link
Owner Author

lervag commented Jul 16, 2014

No problem!

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

No branches or pull requests

2 participants