如果当前文件中未明确指定,Vim Latex Suite 无法找到 .bib 文件

如果当前文件中未明确指定,Vim Latex Suite 无法找到 .bib 文件

我正在使用 Neovim 和 Latex Suite 来处理 Latex 文档。当我将所有代码放在一个文件中时,使用 F9 完成引用非常有效。但是,如果我使用\include它就会停止工作。不会显示可能的引用列表,而是进入插入模式。以下https://github.com/vim-latex/vim-latex/issues/135我检查了 Python 是否可用,并用于引用补全:

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

let g:Tex_Debug = 1使用创建的日志文件let g:Tex_DebugLog = "vim-latex-suite.log"显示未找到 bibfiles:

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: %

下列的如何让 vim-latex 的 \cite 补全从下面的目录中获取 .bib 文件?g:Tex_BIBINPUTS既设置为包含 bibfile 的目录(在明确提及时可用),又设置为文件本身,但在这两种情况下都不会被拾取。我无法在每个文件中设置参考书目,因为这只能在序言中实现。

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}

引用.tex:

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

书目.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}
}

在 MWE.tex 文件中,引用完成按预期工作: 在 MWE 中引用完成工作

在cite.tex文件中进入插入模式: 引用完成在其他文件中不起作用

答案1

总结:

正如所建议的戴博文在他的评论,为了使用 Vim Latex Suite 处理多文件项目,应该在主文件上标记以下内容https://vim-latex.sourceforge.net/documentation/latex-suite/latex-project.html#latex-project-example


和往常一样,我刚发布问题后就偶然发现了答案,但决定将其留在这里以供参考。如果您设置了一个多文件项目,则需要标记 Latex Suite 的主文件。假设您有 document.tex,其中包含几个其他文件,可能在子目录中。然后您需要touch在与 document.tex 相同的目录中创建一个名为 document.tex.latexmain 的(可能是空的,我用的是)。Latex Suite 将从您当前正在处理的文件向上搜索您的文件系统以查找此类文件,并从那里提取参考书目等内容。请参阅https://vim-latex.sourceforge.net/documentation/latex-suite/latex-project.html#latex-project-example了解更多信息。

相关内容