# Having docstrip place files in different folders

I've written my own biblatex citation style and decided to put both the bbx and the cbx file in a dtx file to process that with docstrip. Now I would like to have docstrip place the files in my local folder ~/Library/texmf/tex/latex/biblatex/bbx/ and .../cbx/ respectively. My attempt at using the following ins file failed:

\input docstrip.tex
\usedir{~/Library/texmf/tex/latex/biblatex/bbx/}
\generate{\file{blah.bbx}{\from{blah.dtx}{bbx}}}
\usedir{~/Library/texmf/tex/latex/biblatex/cbx/}
\generate{\file{blah.cbx}{\from{blah.dtx}{cbx}}}
\end


It just places both files in the same directory as the dtx file. My guess is that I didn't quite understand the usage of \usedir in the docstrip manual ... Any help would be appreciated!

The ins and dtx file are both in ~/Library/texmf/tex/source/blah/ by the way.

-

From the docstrip documentation:

\BaseDirectory


This macro is administrator’s way of saying “yes, I want to use that directories support of yours”. DocStrip will write only to current directory unless your config has a call to this macro. (This means DocStrip won’t write to random directories unless you tell it to, which is nice.) Using this macro you can specify a base directory for TEX-related stuff. E.g., for many Unix systems that would be

\BaseDirectory{/usr/local/lib/texmf}


and for standard emTEX installation

\BaseDirectory{c:/emtex}


You need a more explicit approach:

\input docstrip.tex
\catcode~=11
\BaseDirectory{~}
\DeclareDir{firstLabel}{Library/texmfa/tex/latex/biblatex/bbx/}
\usedir{firstLabel}
\generate{\file{blah.bbx}{\from{blah.dtx}{bbx}}}
\end


Caveats:

1. I couldn't really test this, missing blah.dtx :)

2. The ~ is also messing up your code; remember it means "unbreakable space", so you have to make it a letter (that's what the mysterious catcode is there for).

3. It may not work anyway with ~, try changing that to \BaseDirectory{/home/koji} or whatever your home dir is.

4. Depending on your system, you may have change the variable openout_any in your texmf.cnf. Edit: Since you seem to be using osx, this involves adding

openout_any = a


/usr/local/texlive/2011/texmf.cnf

Hm, this still results in a ! I can't write on file ... error by LaTeX. Could it be that I need to "reload" texmf.cnf and if yes, how does that work? And do I need to change the catcode of ~ back after I've used it for the filename? –  Jonathan Mar 20 '12 at 12:58
Ok, it worked now. Seems that the expansion of ~ didn't work, which is a pity because this means it only works for my user now. Is there a way to set BaseDirectory` to my local textree? –  Jonathan Mar 20 '12 at 15:42