I've not been able to find a good solution for this problem. I use google drive which syncs on my home and work computers. At work, we use "Google Drive Stream" and at home I use "Backup and Sync". It's typical that I'm in some directory (some deeper than others) and I want to include a file from my "images" directory.

at work that is something like

/Volumes/GoogleDrive/My Drive/images/dog.png

(note the space in My Drive which I cannot edit, it seems, but I've found a workaround for that)

at home my directory is


Unfortunately it doesn't seem like I'm able to change either my home setup to work or vice versa.

I'd like to have my files compile from either location, but I need to refer to the correct location which seems to depend on the system. In the past I'd just copy the images directory to wherever my file was and just refer to it locally, but I'd rather not have lots of copies of this images directory. Is there some way to tell LaTeX "go up 1 or 2 or 3 or 4 levels until you find /images/ and then go there to find dog.png"? Or perhaps "Look first in X and if not there, then in Y" (and preferably can I write a macro that does this once and for all?


  • 1
    just use \includegraphic{zzz.jpg} with no path and arrange that your drive folder is in the TEXINPUTS environment variable on both machines – David Carlisle Jul 23 '19 at 19:36
  • Ah thanks, I've just done something similar which seems to work \makeatletter \graphicspath{{/path1/}{/path2/}} \def\input@path{{/path1/}{/path2/}} \makeatother – Adam Boocher Jul 23 '19 at 20:01
  • 2
    TEXINPUTS is a lot quicker but in practice that only seems to bother me (as I wrote \graphicspath so I know how much work it's doing:-) – David Carlisle Jul 23 '19 at 20:03

Your Answer

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

Browse other questions tagged or ask your own question.