question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inline citation doesn't popup in subfiles

See original GitHub issue

Foreword: I originally wrote the issue up as a bug report because I was trying to track down a bug. I have now found a “solution” to the bug, but said solution is quite inconvenient.

Disable all the other extensions except for LaTeX Workshop, and check that you still see this issue. [Required]

You still see this issue?: Yes

Describe the bug [Required] Intellisense does not pop-up with citation key suggestions in one of my LaTeX projects. Specifically, a project that uses subfiles. See the “Additional Context” section below for more details. CitationExampleWrongThesis

To Reproduce Steps to reproduce the behavior:

  1. Go to existing project
  2. Start typing in “\cite{”
  3. Hit ‘Enter’ to autocomplete and bring up the intellisense “suggestions” (idk what to call it)
  4. Start typing in citation key, but it does not come up

Expected behavior Intellisense to show the citation keys and insert them. This is done on a single files LaTeX project using the same .bib file. CitationExampleCorrectAIAA

Logs [Required] This log is after reloading the VS Code window with nothing but LaTeX Workshop extension loaded, and immediately performing the reproduction steps.

LaTeX Workshop Output [Required] [13:15:32] Initializing LaTeX Workshop. [13:15:32] pdflatex is provided by MiKTeX [13:15:32] Creating LaTeX Workshop http and websocket server. [13:15:32] LaTeX Workshop initialized. [13:15:32] Linter for root file started. [13:15:32] Found root file from active editor: c:\Users\jrwrigh\gitRepos\ms_thesis\background.tex [13:15:36] Root file changed from: undefined. Find all dependencies. [13:15:36] Instantiating a new file watcher for c:\Users\jrwrigh\gitRepos\ms_thesis\background.tex [13:15:36] Parsing c:\Users\jrwrigh\gitRepos\ms_thesis\background.tex [13:15:36] Cannot find file c:\Users\jrwrigh\gitRepos\ms_thesis\background.fls [13:15:36] Server created on 127.0.0.1:62975 [13:15:36] Snippet data loaded. [13:15:36] LaTeX Workshop version: 7.0.2
Developer Tools Console [Required] Nothing suspicious

Screenshots See explanatory gifs above

Desktop [Required]:

  • OS: Windows 10
  • VS Code version: 1.35.1
  • Extension version: 7.0.2

IMPORTANT CONTEXT/Solution The thesis is a subfiles-based project. So it each subfile does not have a \bibliography{[.bib file]} command on it. Instead, I have a command defined in the “main” .tex file that makes the subfiles package compile correctly:

\def\biblio{\bibliographystyle{new-aiaa}\bibliography{Sources}}

If I add a \bibliographystyle{new-aiaa}\bibliography{Sources} line to the end of the subfile, then the intellisense works. However, I’d much prefer to keep this single command in main.tex as it’s much easier to switch between biliography styles this way.

Possible Feature Suggestion Is it possible to force a bib file to be used as intellisense? Like a magic command:

% !TEX bibfile = relative/or/absolute/path/to/bibfile.bib

I know there is latex-workshop.latex.bibDirs already available, but I thought that it would check the current directory for .bib files, My project has the subfile and .bib in the same directory.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
jlelongcommented, Jul 4, 2019

When a root file is detected (see the wiki), it is parsed and all the included files recursively to detect bibliographies via \addbibresource or \bibliography. Then, every .bib file is associated to all files in the current LaTeX project to provide intellisense. Then, the problem arises with subfiles, because each subfile has its own \documentclass[...]{subfiles} command and is therefore considered as a root file. So, if you comment the line \documentclass[./mainMWE.tex]{subfiles} in section.tex, everything works as expected.

I will think of a way to properly handle the subfiles package.

0reactions
werunomcommented, Jun 17, 2019

I am too facing the same issue — the intellisense citation-key autocomplete is not working on sub-files.

I have similar setup as reported by @jrwrigh — I have the main tex-config file in which I have put all the tex configurations; and each tex files imports this main tex-config file.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cite pop-up in Texstudio doesn't show up anymore - TeX
I'm using TeXstudio 2.5.2 together with Jabref 2.9.2 and BibLaTeX. Everything in my document works fine except that when I enter \cite no...
Read more >
Latextools does not display cite keys if .tex file is in subfolder
Unfortunately, for my larger projects, I keep my chapter .tex files in a subfolder. The \bibliography command only appears once in the master...
Read more >
Cross referencing with the xr package in Overleaf
This article explains, and demonstrates, the xr package which enables access to, and use of, cross-referencing labels present in external, standalone, ...
Read more >
<iframe>: The Inline Frame element - HTML - MDN Web Docs
The HTML element represents a nested browsing context, embedding another HTML page into the current one.
Read more >
Insert In-text Citations - Zotero - Milner Library Guides
In the Add Citation box, click inside the source · In the popup box, check the Suppress Author check box · Click outside...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found