This is kind of a soft question.

In my work, I generate a lot of images (graphs with data, sketches of the experimental system, etc..) which I later use in various latex files (papers, beamer presentations, internal reports to myself, etc.).

How would you recommend organizing the image files? I could have a folder with an enormous amount files all stacked like a large heap of stuff (kinda like how my garage looks like) but that would make it very difficult to maintain and search. On the other hand, I could keep each project in its own directory and keep local copies of the image, but that seems awfully redundant. Also, this doesn't allow me to simply copy-paste a beamer slide code from presentation to presentation without worrying whether I have that particular image in the other directory.

What would Knuth do?


This is what I will do. Hence it is only relative.

I will have a folder for my project (say thesis): D:\my-thesis where everything related to my thesis will be stored. Further, I will have subfolders like D:\my-thesis\images, D:\my-thesis\presentations, D:\my-thesis\thesis, D:\my-thesis\codes, ......... etc. Now as we are concentrating on images, I will not worry about how other folders will be but each of these folders will have sub folders depending upon the need.

Let us assume that my thesis will have six different topics (chapters). I will create six folders inside images folder and name them: topic-1, topic-2,... etc. topic-1 folder will have two subfolders: pdf and source. The folder pdf will have all pdf files of my images (I prefer pdf over png) and the source folder will have tikz sources of my images (as almost every diagram I use, will be written using tikz). If I have to use some other kind of file (say .jpg), I will have another folder inside topic-1 and call it jpg. Same is true for topic-2,... etc.

With this folder structure, it is easy to re-use the code for inserting the pictures. I will use \includegraphics[...]{D:/my-thesis/images/topic-1/pdf/de} where de is the picture. Hence the snippet can be used in all places like presentation or thesis.

A MWE will be

  • So, in essence, you eliminate the need to have the image in the same directory as the source by giving the absolute path to the image, rather than the path "starting in the current directory." One potential concern: this makes it harder to include all the necessary files if you want to send someone the source for a project that re-uses image code from another project. – Charles Staats May 5 '13 at 14:23
  • @CharlesStaats: True. But compared to multiple (redundant) copies lying all around your disk, this is less annoying. I will bundle only those images separately and send. Or use git :-) – user11232 May 5 '13 at 14:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.