I use several different computers, so I keep all of my files on Dropbox. To keep my latex style sheets synced up, I created a texmf folder on Dropbox. Then by adding a path on each computer, tex will automatically find the stylesheet there. I’m posting detailed instructions, because I always forget how to add the path. (These instructions are for macOS and texlive.)

First, you need a texmf tree on your Dropbox. Start by making a file called “texmf”—this can be put in any directory/file on your Dropbox. Inside of texmf, put another folder called “tex”, inside tex put a file called “latex”. Now make a folder for your style file inside latex—I called mine “dropsty”. So you should have a nested set of folders that looks like:

~/Dropbox/…/texmf/tex/latex/dropsty/dropsty.sty

Now you need to tell tex how to find this folder. To do this, open the terminal. Type “kpsewhich texmf.cnf”. This will give you the path to a config file. For me it returns

/usr/local/texlive/2012basic/texmf.cnf

texmf.cnf is the config file we want to edit.

(Here’s how I edited the file, skip this if you know how. Type “cd /usr/local/texlive/2012basic/” to get to the directory with the file. (Type “ls” to see what’s in the folder, type “pwd” to see where you are.) Now you’ll have to make sure you can edit the file, so type “sudo chmod 777 texmf.cnf”. You’ll be prompted to enter your password. Now “emacs texmf.cnf”. You can navigate using the arrow keys. To save, hold “control” and type “x s”.)

Here’s what texmf.cnf looks like by default:

% (Public domain.)
% This texmf.cnf file should contain only your personal changes from the
% original texmf.cnf (for example, as chosen in the installer).
%
% That is, if you need to make changes to texmf.cnf, put your custom
% settings in this file, which is …/texlive/YYYY/texmf.cnf, rather than
% the distributed file (which is …/texlive/YYYY/texmf/web2c/texmf.cnf).
% And include *only* your changed values, not a copy of the whole thing!
%
TEXMFLOCAL = $SELFAUTOPARENT/texmf-local
TEXMFHOME = ~/Library/texmf
TEXMFVAR = ~/Library/texlive/2012basic/texmf-var
TEXMFCONFIG = ~/Library/texlive/2012basic/texmf-config

We want to add a new path to TEXMFHOME. All we do is put a colon after the current path, and add “~/Dropbox/…/texmf”. In my case, it looks like this:

TEXMFHOME = ~/Library/texmf:~/Dropbox/grad_school/texmf

Once you’ve added the path, save the file. The last step is to run “texhash” in the terminal to let tex know there’s a new path (just type texhash and hit return).

That’s it! Now you can use style files as if there were in the same directory as the current file:

\usepackage{dropsty}

Advertisements