Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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
\askforoverwritefalse
\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.

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

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
\askforoverwritefalse
\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
    

    in your file

    /usr/local/texlive/2011/texmf.cnf
    
share|improve this answer
    
Just an aside: make very sure you don't mistype your paths, you can end up overwriting important files in your system ... –  Koji Mar 20 '12 at 12:16
    
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
    
@Jonathan: It works here, make sure of a few things: a) change ~ for your homedir; on OS X, it's a path of the form /Users/<username>. b) Watch carefully my DeclareDir definition, there's an intentional typo there: "Library/texmfa/tex" should be "Library/texmf/tex"!! –  Koji Mar 20 '12 at 13:28
    
@Jonathan: also, the directories have to exist before hand. –  Koji Mar 20 '12 at 13:30
    
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
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.