0

I'm using Neovim and the Latex Suite for Latex Documents. When I put all the code in a single file, cite completion using F9 is working like a charm. However, if I split my source file using \include it stops working. Instead of showing a list of possible citations, insertion mode is entered. Following https://github.com/vim-latex/vim-latex/issues/135 I checked that Python was available and used for cite completion:

:echo Tex_HasPython
3
:echo Tex_UsePython()
1
:echo Tex_GetVarValue('Tex_UsePython')
1
:echo Tex_GetVarValue('Tex_UseCiteCompletionVer2')
1

The log file created using let g:Tex_Debug = 1 and let g:Tex_DebugLog = "vim-latex-suite.log" shows no bibfiles found:

view : Tex_Complete: s:type = cite, typeoption =
view : :Tex_Complete: using s:prefix =
view : :Tex_FindBibFiles:
proj : texproject.vim: catching LatexSuiteFileType event
env : envmacros.vim: Catching LatexSuiteFileType event
comp : compiler.vim: Catching LatexSuiteFileType event
fold : folding.vim: catching LatexSuiteFileType
brak : brackets.vim: Catching LatexSuiteFileType event
view : texviewer.vim: Catching LatexSuiteFileType event
main : main.vim: Catching LatexSuiteFileType event
pack : packages.vim: Catching LatexSuiteFileType event
pack : +Tex_pack_updateall
view : :Tex_FindBibFiles: returning []
view : :Tex_StartCiteCompletion: No bibfiles found.
view : :Tex_SwitchToInsertMode: %

Following How to get vim-latex's \cite completion to pick up the .bib file from the directory below?, g:Tex_BIBINPUTS was set to both a directory containing a bibfile which is usable when explicitly mentioned or the file itself but is not picked up in both cases. I cannot set the bibliography in each file as this is only possible in the preamble.

MWE.tex: \usepackage[utf8]{inputenc} \usepackage[backend=biber]{biblatex}

\bibliography{bibliography.bib}
\title{MWE for dysfunctional cite completion}

\begin{document}
  \maketitle
  Here completion works \cite{}
  \include{cite}
\end{document}

cite.tex:

Here the completion should work but doesn't \cite{}

bibliography.bib:

@report{europeanroadsafetyobservatoryTrafficSafetyBasic2012,
  title = {Traffic {{Safety Basic Facts}} 2012 - {{Cyclists}}},
  author = {{European Road Safety Observatory}},
  date = {2012},
  keywords = {Partly Processed,Safety},
  file = {/home/mbeeking/Zotero/storage/3RLBIXIE/bfs2012_dacota-swov-cyclists.pdf}
}

In the MWE.tex file the cite completion is working as expected: Cite completion working in MWE

In the cite.tex file insertion mode is entered: Cite completion not working in other file

4
  • 1
    Can you try using \addbibresource instead of \bibliography (which is deprecated for biblatex)? Does it work if you use \input instead of \include? Does setting a .latexmain help?
    – Dai Bowen
    Jun 21, 2023 at 13:46
  • I found a different solution as posted below and thus will not try this, but thanks nonetheless!
    – MoRoBe
    Jun 21, 2023 at 13:53
  • 1
    My suggestion was to set a .latexmain file... like your answer...
    – Dai Bowen
    Jun 21, 2023 at 13:54
  • My appologies, you are absolutely correct, I just found the answer before reading your comment and than appear to not have read it thoroughly. I have edited my answer to credit you.
    – MoRoBe
    Jun 26, 2023 at 10:16

1 Answer 1

0

tl;dr:

As also suggested by Dai Bowen in his comment, for using the Vim Latex Suite with multi-file projects one should mark the master file following https://vim-latex.sourceforge.net/documentation/latex-suite/latex-project.html#latex-project-example


As ever so often I stumbled upon the answer just after posting the question but decided to leave it here for reference. If you have set up a multi-file project you need to mark the main file for Latex Suite. Let's say you have document.tex including several other files, possibly in subdirectories. Then you need to create a (possibly empty, I used touch) file called document.tex.latexmain in the same directory as document.tex. Latex Suite will search your file system going upwards from the file you're currently working on for such a file and pull things like the bibliography from there. See https://vim-latex.sourceforge.net/documentation/latex-suite/latex-project.html#latex-project-example for further information.

1
  • This is the answer for me and I will accept it next week when I'm back at work
    – MoRoBe
    Jun 21, 2023 at 13:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .