When I run:
tex algorithms.dtx
for example, I get this message.
! Undefined control sequence.
l.34 \documentclass
{ltxdoc}
?
Help?
When I run:
tex algorithms.dtx
for example, I get this message.
! Undefined control sequence.
l.34 \documentclass
{ltxdoc}
?
Help?
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.
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)
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.
You may need an .sty file, which can be extracted from a .dtx by doing the following:
.dtx file is locatedtex file_name.dtxThis 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).
.insfile", so that it's more clear to others with the question (How do I install a .dtx file?) – ShreevatsaR Apr 29 '17 at 07:16