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?
2 Answers
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 asmypackages, and put your .sty file there. [it might be a good idea to follow the standard TeX Directory Structure, and makemypackagesa subdirectory oftemxmf-local/tex/latex/]add that new
texmf-localto the list of paths scanned bytexhash. In my case (as a TeXLive user), this means modifyingtexmf.cnf:
TEXMFLOCAL = $SELFAUTOPARENT/../texmf-local;e:/files/dropbox/texmf-local.run a
texhashandkpsewhich mystyle.styto 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.
- 9,716
-
3I 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 intexmf-local/tex/generic/images, etc. – Matthew Leingang Oct 15 '13 at 19:18 -
-
I was curious about the advantages of doing it with a package. I asked a question about it here: http://tex.stackexchange.com/questions/139157/what-are-the-pros-and-cons-of-packages-versus-input-for-a-preamble – twsh Oct 16 '13 at 16:17
ifplatform. – jon Oct 15 '13 at 17:14