Hannah-Sten / TeXiFy-IDEA

LaTeX support for the IntelliJ platform by JetBrains.
https://hannah-sten.github.io/TeXiFy-IDEA
MIT License
898 stars 90 forks source link

Resolving references to relative paths outside of the project #3714

Open padrecedano opened 3 weeks ago

padrecedano commented 3 weeks ago

First of all, thank you for this excellent project. I have moved from a Linux device to an Apple M1 (Silicon) device and I couldn't find a native LaTeX project editor on this new infrastructure. Combining IntelliJ IDEA with TeXify seems to solve that difficulty.

I would like to raise the following question. Considering the following directory tree:

.
└── IdeaProjects/
    ├── biennal/
    │   └── common/
    │       ├── template/
    │       │   └── main-template.tex
    │       ├── biblical/
    │       │   ├── Gn/
    │       │   │   ├── Gn_01_01-20.tex
    │       │   │   └── Gn_01_21-27.tex
    │       │   └── Ex/
    │       │       ├── Ex_01_01-15.tex
    │       │       └── Ex_02_08-22.tex  
    │       └── patres/
    │           ├── Agustin/
    │           │   ├── Agustin_PL038_0636.tex
    │           │   └── Agustin_PL038_1016.tex
    │           └── Ambrosio/
    │               ├── Ambrosio_CCL014_0165.tex
    │               └── Ambrosio_CCL064_0052.tex 
    ├── volume-01/
    │   └── src/
    │       └── main.tex
    ├── volume-02/
    │   └── src/
    │       └── main.tex
    ├── volume-03/
    │   └── src/
    │       └── main.tex
    └── volume-04/
        └── src/
            └── main.tex 

This structure would represent a project consisting of 4 volumes in which I would like to share certain content that is repeated:

For testing purposes, I created a project called volume-01 with the following file src/main.tex

%! Author = cedano
%! Date = 30/10/24

\input{../../biennal/common/template/main-template}

% Document
\begin{document}
    \input{../../biennal/common/biblical/Gn/Gn_01_21-27}
    \input{../../biennal/common/patres/Agustin/Agustin_PL038_0636}
    \lipsum
\end{document}

The code compiles and creates a document with the content, but in the IDE I have an error:

Command requires lipsum package

My questions are: Is this possible using IntelliJ IDEA and TeXify? If so, how could I achieve this? Would I have to use modules or something similar? Would I have to use Gradle? Are there any examples of projects similar to what I want to achieve so I can get an idea of ​​the setup? Why does it not recognize the lipsum package and yet it works?

PHPirates commented 3 weeks ago

Thanks for raising this issue! First of all, the document compiles but TeXiFy complains, so I think that is a bug that should be fixed.

In the meantime, you can either make one project containing all directories (this is what I would do), or you could set TEXINPUTS environment variables so that you can \input{Agustin_PL038_0636} without needing to figure out how many ../ you needed in the relative path. You can do this in your run configuration (template): https://hannah-sten.github.io/TeXiFy-IDEA/run-configuration-settings.html#environment-variables

padrecedano commented 3 weeks ago

@PHPirates

Thank you for your answer.

I have tried to define an environment variable by following the steps below:

  1. Go to Run option in the main menu

  2. Select Edit Configurations

  3. Select Edit configurations templates at the bottom of the left panel

  4. Select LaTeX in the left panel

  5. In the Environment Variables input put the following: TEXINPUTS=~/IdeaProjects/bienal//:

  6. Press Apply and OK

Doing all that, it still doesn't work. Do the environment variables need to be defined somewhere else?

PHPirates commented 3 weeks ago

Did you create an actual run configuration from the template and ran it? Also make sure there are no typos. above it was biennal