I've recently created a document class and have not long finished wrapping it up into a DTX file. I have an installation file the looks like this:

%% Licence info

\input docstrip.tex



This is a generated file licenced under the MIT License:
The MIT License (MIT)…blah blah blah...



\Msg{* To finish the installation you have to move the}
\Msg{* following file into a directory searched by TeX:}
\Msg{* \space\space bil-CV.cls}
\Msg{* To produce the documentation run the file bil-CV.dtx} 
\Msg{* through LaTeX.}
\Msg{* Happy TeXing!} 


I run this by doing latex bil-CV.ins, and get the following output:

This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2014) (preloaded format=latex)
 restricted \write18 enabled.
entering extended mode
LaTeX2e <2014/05/01>
Babel <3.9k> and hyphenation patterns for 78 languages loaded.
Utility: `docstrip' 2.5d <2005/07/29>
English documentation    <2014/04/19>

* This program converts documented macro-files into fast *
* loadable files by stripping off (nearly) all comments! *

* No Configuration file found, using default settings. *


Generating file(s) ./bil-CV.cls 

Processing file bil-CV.dtx (class) -> bil-CV.cls
Lines  processed: 407
Comments removed: 262
Comments  passed: 9
Codelines passed: 130

* To finish the installation you have to move the
* following file into a directory searched by TeX:
*    bil-CV.cls
* To produce the documentation run the file bil-CV.dtx
* through LaTeX.
* Happy TeXing!
No pages of output.
Transcript written on bil-CV.log.

Having specified \usedir{tex/latex/bil-CV}, why is the class file generated in the CWD, and not ~/Library/texmf/tex/latex/bil-CV as specified in /usr/local/texlive/2014/texmf.cnf and the ins file?

  • You don't have \BaseDirectory in your .ins file: without it, nothing is going to happen – Joseph Wright Apr 24 '15 at 12:16
  • But surely having \BaseDirectory in a .ins file means that I need a separate .ins file for each platform I'm installing on? – forquare Apr 24 '15 at 12:18
  • No, that would normally go into docstrip.cfg if you want to work that way. (You'll also likely want \UseTDS.) – Joseph Wright Apr 24 '15 at 12:49
  • 4
    The current TeX distributions don't allow writing in directories specified with absolute paths or in directories whose path requires going above the working directory. So you should process the .ins file from the top of the chosen tree (local, TEXMFLOCAL, or personal, TEXMFHOME), which I wouldn't recommend either. Note also that TeX never creates directories, so you should create the needed one in advance. – egreg Apr 24 '15 at 12:56

As detailed in the DocStrip manual, the design of DocStrip is such that you are expected to set \BaseDirectory (as TeX can't know where you want to install to) and\UseTDS (to activate mapping of your \usedir lines to the approach TDS structure). Those lines are intended most likely to go into a docstrip.cfg file rather than into the .ins file(s) themselves.

As noted in comments, modern TeX systems do not allow writing to a directory above the current one for security reasons. (This can be altered but is not at all recommended.) TeX, and thus DocStrip, cannot make directories so the structure also needs to be pre-existing. As such, the 'extract to TDS' feature of DocStrip is best regarded as a historical idea and not for use today. Rather than use DocStrip to populate a local tree, a more useful approach is to create a TDS-style zip and to use this. There are a variety of scripts available to help with this process.

| improve this answer | |

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.