2

This question is somehow related to this question but I'm looking for a solution on class basis. I have my own texmf tree with different classes like this:

├── mytexmf/
│   └── tex/
│       └── latex/
│           ├── class_1/
│           │   └── Pictures/
│           │       ├── A.pdf
│           │       └── B.pdf
│           └── class_2/
│               └── Pictures/
│                   ├── A.pdf
│                   └── C.pdf
└── mytexprojects/
    └── project_a/
        └── Pictures/
            └── D.pdf

Inside the class_1.cls file I set \graphicspath{{./Pictures}}. When I compile my tex file inside project_a, this allows me to use the same graphicspath and gives me access to A/B/D.pdf. However, sometimes A.pdf from the class_2 subfolder is used. If I understand correctly, I could rename the Pictures directory for each class in the texmf directory to a unique name to only import from there.

Assuming I change my directory structure like this:

├── mytexmf/
│   └── tex/
│       └── latex/
│           ├── class_1/
│           │   └── Pictures_1/
│           │       ├── A.pdf
│           │       └── B.pdf
│           └── class_2/
│               └── Pictures_2/
│                   ├── A.pdf
│                   └── C.pdf
└── mytexprojects/
    └── project_a/
        └── Pictures/
            └── D.pdf

And in class_1.cls changing the import to read

\graphicspath{{./Pictures}{./Pictures_1}}

will this make sure, when I include A.pdf I will not accidentially use the one from class_2?

3
  • tex.stackexchange.com/questions/603949/… this might be a better option than what I'm trying.
    – Dschoni
    Aug 10, 2023 at 11:19
  • 1
    latex will find A.pdf in the texmf tree independant of your graphicspath settings and which one it finds first is undefined. You would have to do something like \includegraphic{class_1/Pictures/A} to ensure that you get the right one. Aug 10, 2023 at 11:43
  • Perfect, I'll do this then. All this images are anyway part of a macro, so I can simply change all paths to be explicit.
    – Dschoni
    Aug 10, 2023 at 11:59

0

You must log in to answer this question.

Browse other questions tagged .