I use multiple computers (Mac and PC), so creating a path (e.g. \input{c:/folder/Preamble}) won't work. I really want to assign a URL (in Dropbox) to the file and input the file via the URL, but I don't know what command to use to achieve that. Suggestions?


This is what has been working great for me for about two years now.

  • create a .sty file containing your universal preamble. A .sty file, basically, is a regular TeX file starting with \ProvidesPackage{mystyle}, ending with \endinput, and everything else inbetween.*)

  • in your Dropbox (or similar), create a directory named texmf-local, and a subdirectory such as mypackages, and put your .sty file there. [it might be a good idea to follow the standard TeX Directory Structure, and make mypackages a subdirectory of temxmf-local/tex/latex/]

  • add that new texmf-local to the list of paths scanned by texhash. In my case (as a TeXLive user), this means modifying texmf.cnf:
    TEXMFLOCAL = $SELFAUTOPARENT/../texmf-local;e:/files/dropbox/texmf-local.

  • run a texhash and kpsewhich mystyle.sty to confirm everything's okay.

  • in your documents, load your preamble via \usepackage{mystyle}. No additional packages are needed for all this to work. Plus, it's completely platform-agnostic.

needless to say, step 3 (and 4) has to be done separately on each machine.

Over time, in my case, this has developed from a mere universal preamble into a full-fledged package with lots of options, internal sub-routines and dependencies. There's a lot of things you can do with a .sty file you can't do with a simple \input...

*) Consult clsguide.pdf for details about package writing.

  • 3
    I would suggest that the local texmf directory follow the TeX Directory Structure, so a custom package would go in temxmf-local/tex/latex/mypackages/ At the same time you can put your images in texmf-local/tex/generic/images, etc. – Matthew Leingang Oct 15 '13 at 19:18
  • yes, that's certainly the more standard way. Added it to my post. – Nils L Oct 15 '13 at 20:15
  • I was curious about the advantages of doing it with a package. I asked a question about it here: tex.stackexchange.com/questions/139157/… – twsh Oct 16 '13 at 16:17

Here's what I ended up doing:

\usepackage{ifplatform, pdftexcmds, catchfile}


\input{% windows path to preamble}



\input{% mac path to preamble}


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.