TransWikia.com

How do you copy all the images referenced in a document into a single directory?

TeX - LaTeX Asked on October 3, 2021

I am finalising a book and I need to submit all the images as separated files along with the manuscript.

Now, images are all saved in different places and referenced with a relative path from my chapter files. E.g. ../replication_package/data/user_behav/my_img from my chap01.tex compiled from main.tex.

Is there a way to script a copy function that searches all the images referenced in the different inputed filed and copy them into a single folder (ideally renaming them using the enumeration of the resulting LaTeX-typeset document?

One Answer

If you move the images elsewhere, you will have to edit the references to match. Loads of fun if you have lots of figure1...

I'd store away a working copy of everything (you use version control, don't you?), and locate the commands including images by a search command, stash the full lines away for reference. Identify file names of images, check for duplicates. De-duplicate by renaming, process the result and check it makes sense. Move all images to a single place, search and replace the places using them. Process and check.

Find out if "all images" includes stuff generated in the document, like TikZ pictures, or commands calling e.g. gnuplot. Those would require extra work. Any such external commands will probably require special treatment.

Answered by vonbrand on October 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP