# quickly changing all the file paths in a .tex file

I use a `.tex` file that I sync with Dropbox across two computers, - mac (running win 7) and a pc.

The problem is that the `.tex` file is large, and contains a lot of tex commands (even user-written ones) like:

`\addbibresource{D:/Gdrive/Drop/Dropbox/latex/main/my.file.tex}`

Of course, this is the absolute path on my PC and the same file on my mac looks like:

`\addbibresource{C:\Dropbox\latex\main\my.file.tex}`

Note how `/` are changed in `\` and how the path is different.

My question is: how can I simply (and quickly) change all the paths when I move from my pc to my mac and vice versa? I use the latest winedt version to edit my latex file.

-
You must not use absolute paths. Use always relative paths. It is more simple and it is necessary for security reason too. – user56567 Jul 20 '14 at 10:49
`\addbibresource{file.bib}` (sorry, but I think that `.bib` is more appropriate for `\addbibresource` command) is the solution if `latex/main/` is the working directory for both system. – user56567 Jul 20 '14 at 10:54
If you need to access a `.tex` file that is located in the `main\other` folder you have to write `\input{main/other/file.tex}` – user56567 Jul 20 '14 at 10:58
First: I don't know. Second: `../` go back in the folder. – user56567 Jul 20 '14 at 12:21
The paths are relative to the directory in which you are running `pdflatex` (or whichever). So if you run `pdflatex main/my.file` then the paths should be relative to the `latex` directory (i.e. to get to `main/other/file` you would simply put that). If you change into the `main` folder and run `pdflatex my.file`, then to get to the `other` folder you should put `../other/file`. This messed me up so many times when I was using subfiles... :-) – darthbith Jul 20 '14 at 12:27

Perhaps use a system dependent preamble for this kind of information.

On the mac:

``````% systempreamble.tex
\newcommand{\pathtostuff}{D:/Gdrive/Drop/Dropbox/latex/main}
``````

On the pc:

``````% systempreamble.tex

% latex uses / for paths, even on a pc
\newcommand{\pathtostuff}{C:/Dropbox/latex/main}
``````

``````\input{systempreamble}
% ...