I have a project that comprises multiple sub-documents, each of which needs to be generated many times with small tweaks that need to be consistent across the document. Here's what I want to do:

  1. create a style file in which I define some macros containing the information needing to be tweaked,
  2. place each sub-document in its own subfolder,
  3. symlink the single style file to each subfolder,

so that

  1. I can just tweak the style file and rebuild each document rather than having to tweak each document individually hoping I don't forget something.

Here's what I tried.

  • I create a directory <minimal>, with a subdirectory <doc1>.
  • I create mwe.sty and put it in the home <minimal> directory:



  • I create doc1.tex in minimal/doc1:


  • I symlink the style file into doc1 with:

ln -s mwe.sty doc1/mwe.sty
  • I cd into doc1 try to build with:


latex doc1.tex

and I get:

! Undefined control sequence.
l.6 \foo

I'm on Mactex 2015. Anybody got an idea what I'm doing wrong here?

  • Why don't you just drop the style file into your TEXMFHOME? Then you don't need the symbolic links at all. mkdir -p $(kpsewhich -var TEXMFHOME)/tex/latex/shane-mwe && mv mwe.sty $(kpsewhich -var TEXMFHOME)/tex/latex/shane-mwe/snane-mwe.sty. (Don't use mwe.sty because there's already a package by that name in the standard distributions.) – cfr Dec 31 '15 at 20:05
  • But if you do want to use symbolic links, try cd minimal/doc1; ln -s ../shane-mwe.sty ./. Or ln -s ../shane-mwe.sty doc1/shane-mwe.sty. – cfr Dec 31 '15 at 20:07

First, don't use the same name as that of a standard package. So let's use shane-mwe.sty rather than mwe.sty, which already exists.


cd minimal && mv mwe.sty shane-mwe.sty

To see what is wrong with the existing symbolic link, do

ls -l doc1/mwe.sty

and you will see that the link points to itself.

To create a link to the parent directory, you need something like

ln -s ../shane-mwe.sty doc1/shane-mwe.sty


cd doc1/ && ln -s ../shane-mwe.sty ./

However, it would probably be better and easier to drop the style file in your TEXMFHOME since that is what it is designed for.

mkdir -p $(kpsewhich -var TEXMFHOME)/tex/latex/shane-mwe && mv shane-mwe.sty $(kpsewhich -var TEXMFHOME)/tex/latex/shane-mwe/
  • 1
    yep, that does it. I didn't want to install anything to my TEXMFHOME because i've got the same project synced to a bunch of different machines via github and I didn't want to have to go crawling into tex's guts to make a couple of simple changes a whole lot of times. Many thanks! – shane Jan 1 '16 at 15:20

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.