Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When checking whether an image is referenced, \graphicspath is not taken into account #26

Open
isarandi opened this issue Jul 11, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@isarandi
Copy link

In LaTeX there's a feature allowing to set the root of all images with \graphicspath, then all image includes will be relative to this root, not the main tex file's directory.

However, this tool does not know about \graphicspath and therefore thinks that none of the images are referenced and deletes them all.

@isarandi isarandi changed the title When checking whether and image is referenced, \graphicspath is not taken into account When checking whether an image is referenced, \graphicspath is not taken into account Jul 11, 2020
@jponttuset jponttuset added the enhancement New feature or request label Jul 11, 2020
@jponttuset
Copy link
Collaborator

Dear @isarandi

Indeed our tool does not take \graphicspath into account.
I marked the issue as enhancement (please do not close it) in case someone could give it a go and propose a PR.

Best,

@jorsn
Copy link

jorsn commented Jan 4, 2024

This could be achieved by using the snapshot package.
If this package is included in a tex file using \RequirePackage{snapshot} before everything else, it generates a list of all files that are included in the document, at least as far as LaTeX internally tracks them somehow. I just tried to use \graphicspath with it.
For every graphics file included using \includegraphics, snapshot keeps the path in the file list. This could even supersede all parts of arxiv-latex-cleaner analyzing which tex files might be included in the main document(s).

To implement it, arxiv-latex-cleaner could compile the main document once, but prepending the \RequirePackage call to the document, e.g. using pdflatex -jobname main '\RequirePackage{snapshot} \input{main}'. One might want to configure the TeX engine/command to use.

Note that you can also modify the TEXINPUTS from within a LaTeX document by setting \input@path or \l_file_search_path_seq. The texinputs, however, are not included in the file list. One should also be able to write them to an auxiliary file from within a TeX file.

EDIT: Note that snapshot does not consider .bib files, but only the .bbl files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants