TeXiFy forgets imported packages over entire project once subfigure environment is included in one of the .tex files (multi-file project).
See original GitHub issueType of JetBrains IDE (IntelliJ, PyCharm, etc.) and version
PyCharm
Operating System
Ubuntu
TeXiFy IDEA version
0.7
What I did (steps to reproduce)
I’m writing a project which spans multiple files, and use \input{} to then bring everything together. I have all my \usepackage{}'s in a packages.tex.
Minimal example to reproduce the problem
A very short example from my thesis and what it looks like:
\documentclass{article}
\begin{document}
This is a small example of my text, see~\cite{author2020}.
\begin{figure}
\centering
\begin{subfigure}[b]{0.4\textwidth}
\includegraphics[
page=1,
width=\textwidth
]{images/informational/Master_thesis_drawings.pdf}
\caption{}
\label{subfig:knn_vis_1}
\end{subfigure}
~
\begin{subfigure}[b]{0.4\textwidth}
\includegraphics[
page=2,
width=\textwidth
]{images/informational/Master_thesis_drawings.pdf}
\caption{}
\label{subfig:knn_vis_2}
\end{subfigure}
\caption[Schematic representation of kNN]{
Schematic representation of the kNN algorithm in two dimensions.
An unclassified data point (star) is added in the binary dataset
indicated by triangles and squares. The range of the amount of nearest
neighbors used for classification is set to 3 (a) and 5 (b) and is
represented by the solid line.
}
\label{fig:knn_visualisation}
\end{figure}
\end{document}
Now, PyCharm would make \includegraphics{} red, and the citation {author2020} would be in an orange box, telling me to include graphicx and that the citation author2020 is not found.
Expected behavior
IDE should figure out I have all the packages included and not riddle my project with errors for every \includegraphics{} or citation.
Actual behavior
When writing my work and use for example a \includegraphics{} I get the error “Command requires graphicx package” even though I have it included in my packages.tex. When I compile, the figure does show and there seems to be no problem.
To give a less short example, I’ve included a screenshot where you can see from left to right the compiled pdf, the file containing the figure environment for creating the subfigure seen in the PDF, and the packages.tex file.

I should note that writing text within environments like figure and mathematics is also very slow, as if it has a lot of problems figuring out the completion in certain areas. I tried reinstalling the plugin, but that did not really help. I don’t know if this is a problem on my area or from the plugin.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6

Top Related StackOverflow Question
Het lijkt erop dat TeXiFy niet goed herkent dat thesis.tex je root file is, maar ik heb het probleem niet met deze structuur:
en als thesis.tex:
Je kan het beste proberen het probleem te reproduceren in een klein voorbeeldproject, om erachter te komen wat het veroorzaakt.
Wat betreft performance: ik heb daar laatst een hoop verbeterd, het zit al in de laatste alpha release maar daar heb je PyCharm 2020.3 (nu nog in early preview) voor nodig: https://github.com/Hannah-Sten/TeXiFy-IDEA/wiki/Alpha-builds Daar is ook wel het een en ander veranderd m.b.t. root files, dus kan zijn dat die het probleem oplost.
Oke ik kon het toch niet laten, de hoeveelheid errors stoorde me. Ik draai nu EAP203.5419.8 en 0.7.1 beta, en alle errors zijn weg betreft de ontbrekende packages. Heel erg bedankt!