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.

TeXiFy forgets imported packages over entire project once subfigure environment is included in one of the .tex files (multi-file project).

See original GitHub issue

Type 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. Example from screenshot

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:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
PHPiratescommented, Oct 30, 2020

Het lijkt erop dat TeXiFy niet goed herkent dat thesis.tex je root file is, maar ik heb het probleem niet met deze structuur:

.
├── common
│   └── packages.tex
├── content
│   └── chapters
│       └── chapter1.tex
└── thesis.tex

en als thesis.tex:

\documentclass[11pt]{article}

\input{common/packages.tex}
\begin{document}
    \include{content/chapters/chapter1}
\end{document}

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.

1reaction
GroenteLepelcommented, Nov 5, 2020

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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multiple subfigures using the subfigure environment - TeX
In the first row the squares fill all the space available ( \linewidth refers to the current linewidth, inside a subcaption environment it's ......
Read more >
Multi-file LaTeX projects - Overleaf, Online LaTeX Editor
An online LaTeX editor that's easy to use. No installation, real-time collaboration, version control, hundreds of LaTeX templates, and more.
Read more >
Allow LaTeX-Projects with multiple files · Issue #677 - GitHub
The missing import inspection first finds all included packages, and then compares all commands in the opened file. So the interesting part here ......
Read more >
Whole Issue PDF for PracTeX Journal 2007-3
OS environment. Jérôme Laurens presents the benefits of synchronism between PDF and TeX files when a pdfsync package is loaded.
Read more >
Combining sub-figures to a single figure for submission to ...
This figure can then be included in the main document or processed by the journal later on, without using an additional sub-figure packages....
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