Currently I have a thesis with separate chapters in different tex files (with no \begin{document}, etc.). I include these into the main tex file with \input{}. However, since each included file doesn't have a \addbibresource{bib.bib} line, completion of bibtex entries isn't working, e.g. when I type \citep{ I don't see a list of bib.bib's entries.
An example:
\documentclass[11pt]{scrbook}
\RequirePackage{fullpage}
\RequirePackage{amsmath,amssymb,amsthm}
\RequirePackage{graphicx}
\RequirePackage[citestyle=authoryear,maxbibnames=9,maxcitenames=2,backend=biber,natbib=true]{biblatex}
\addbibresource{bib.bib}
\begin{document}
\maketitle
\input{test-file}
\end{document}
test-file.tex:
\chapter{a test}
Some stuff, \citep{} % doesn't auto complete
bib.bib:
@article{darwin1859origin,
title={On the origin of species London},
author={Darwin, Charles},
journal={UK: John Murray},
year={1859}
}
My only vimtex settings:
" -| latex |-
let g:tex_flavor='latex'
let g:vimtex_fold_envs = 0
let g:vimtex_view_general_viewer = '/Applications/Skim.app/Contents/SharedSupport/displayline'
let g:vimtex_view_general_options = '-r @line @pdf @tex'
One more comment 鈥斅爄t would be terrific if there were a way to get <leader> lv from within an included chapter tex file to open up the current position.
So, you have two issues. The first is that completion of bibliographies does not work in included files. However, this should work, and with your example, it works as expected for me. Could you please create a minimal vimrc file and try again?
For the second issue, please see :h vimtex_viewer_skim. I know that forward searching should work as expected e.g. with Zathura and mupdf, and I think it should work with Skim if you follow the proposed settings in the documentation.
Just a follow-up on this thread, I had a similar issue, turns out that vim considered the included tex file as a 'plaintex', so 'vimtex' wasn't being loaded. To fix this, add the following to your .vimrc:
let g:tex_flavor = 'latex'
Most helpful comment
Just a follow-up on this thread, I had a similar issue, turns out that vim considered the included tex file as a 'plaintex', so 'vimtex' wasn't being loaded. To fix this, add the following to your .vimrc:
let g:tex_flavor = 'latex'