39

When I run:

tex algorithms.dtx

for example, I get this message.

  ! Undefined control sequence.
l.34 \documentclass
                   {ltxdoc}
?

Help?

4 Answers 4

21

Depending on how the .dtx is constructed, it may not work at all with TeX: you have to use (pdf)latex. To unpack the file you may well need an .ins file.

4
  • @an_ant: it doesn't need to be deleted, because it might help other users. You could even improve that chance if you change the title to "Installing a dtx file" or similar, so it could be found by users with a similar problem but any arbitrary package.
    – Stefan Kottwitz
    Commented Dec 11, 2010 at 18:59
  • @Stefan Kottwitz: Got it. I'll try to manage it.
    – user1996
    Commented Dec 11, 2010 at 19:24
  • 4
    Thanks! Forgot that you should "Run LaTeX on the .ins file to unpack the .dtx file".
    – user1996
    Commented Dec 11, 2010 at 19:29
  • 10
    Could this answer contain something like "run (pdf)latex on the .ins file", so that it's more clear to others with the question (How do I install a .dtx file?) Commented Apr 29, 2017 at 7:16
20

I was having difficulty to understand the accepted answer. It's not the fault of the answer, just that the accepted answer was not targeted to novice (like me). So here is what I figured that I need to run to get the sty file from a dtx:

tex algorithms.dtx

I ran this for pullquote, and got the following response (and the required .sty file):

This is TeX, Version 3.14159265 (TeX Live 2018) (preloaded format=tex)
(./pullquote.dtx
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/docstrip.tex
Utility: `docstrip' 2.5e <2014/09/29>
English documentation    <2017/03/13>

**********************************************************
* 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) pullquote.sty

Processing file pullquote.dtx (package) -> pullquote.sty
File pullquote.dtx ended by \endinput.
Lines  processed: 2209
Comments removed: 1500
Comments  passed: 0
Codelines passed: 692


Generating file(s) pullquote.ins

Processing file pullquote.dtx (install) -> pullquote.ins
File pullquote.dtx ended by \endinput.
Lines  processed: 2209
Comments removed: 1500
Comments  passed: 0
Codelines passed: 692


Generating file(s) README.txt

Processing file pullquote.dtx (readme) -> README.txt
File pullquote.dtx ended by \endinput.
Lines  processed: 2209
Comments removed: 1500
Comments  passed: 0
Codelines passed: 692

Overall statistics:
Files  processed: 3
Lines  processed: 6627
Comments removed: 4500
Comments  passed: 0
Codelines passed: 2076
 )
No pages of output.
Transcript written on pullquote.log.

(This should really be a comment, but I don't have enough reputation for that)

9

Joseph Wright says "run latex on the .ins"; however, if you have LaTeX, you also have ltxdoc.cls, etc., so that unpacking the .dtx doesn't help.

Processing the .dtx file with (pdf)latex gives all you need -- a file of documentation.

1
  • 12
    "gives all you need -- a file of documentation" But I don't want the documentation: I was the cls or sty file. How are those generated? Commented Nov 1, 2017 at 11:52
7

You may need an .sty file, which can be extracted from a .dtx by doing the following:

  • Go to the folder where the .dtx file is located
  • Run tex file_name.dtx

This should generate some other files on the current directory, one of which is a .sty file.

Then, move the file_name.sty directly into your project folder, where a file will use it, or somewhere where latex will look for lib files (check this question for info on that).

1

You must log in to answer this question.