1DETEX(1) General Commands Manual DETEX(1)
2
3
4
6 detex - a filter to strip TeX commands from a .tex file.
7
9 detex [ -clnstw ] [ -e environment-list ] [ filename[.tex] ... ]
10
12 Detex (Version 2.6) reads each file in sequence, removes all comments
13 and TeX control sequences and writes the remainder on the standard out‐
14 put. All text in math mode and display mode is removed. By default,
15 detex follows \input commands. If a file cannot be opened, a warning
16 message is printed and the command is ignored. If the -n option is
17 used, no \input or \include commands will be processed. This allows
18 single file processing. If no input file is given on the command line,
19 detex reads from standard input.
20
21 If the magic sequence ``\begin{document}'' appears in the text, detex
22 assumes it is dealing with LaTeX source and detex recognizes additional
23 constructs used in LaTeX. These include the \include and \includeonly
24 commands. The -l option can be used to force LaTeX mode and the -t
25 option can be used to force TeX mode regardless of input content.
26
27 Text in various environment modes of LaTeX is ignored. The default
28 modes are array, eqnarray, equation, figure, mathmatica, picture, table
29 and verbatim. The -e option can be used to specify a comma separated
30 environment-list of environments to ignore. The list replaces the
31 defaults so specifying an empty list effectively causes no environments
32 to be ignored.
33
34 The -c option can be used in LaTeX mode to have detex echo the argu‐
35 ments to \cite, \ref, and \pageref macros. This can be useful when
36 sending the output to a style checker.
37
38 Detex assumes the standard character classes are being used for TeX.
39 Detex allows white space between control sequences and magic characters
40 like `{' when recognizing things like LaTeX environments.
41
42 If the -w flag is given, the output is a word list, one `word' (string
43 of two or more letters and apostrophes beginning with a letter) per
44 line, and all other characters ignored. Without -w the output follows
45 the original, with the deletions mentioned above. Newline characters
46 are preserved where possible so that the lines of output match the
47 input as closely as possible.
48
49 The TEXINPUTS environment variable is used to find \input and \include
50 files. Like TeX, it interprets a leading or trailing `:' as the
51 default TEXINPUTS. It does not support the `//' directory expansion
52 magic sequence.
53
54 Detex now handles the basic TeX ligatures as a special case, replacing
55 the ligatures with acceptable charater substitutes. This eliminates
56 spelling errors introduced by merely removing them. The ligatures are
57 \aa, \ae, \oe, \ss, \o, \l (and their upper-case equivalents). The
58 special "dotless" characters \i and \j are also replaced with i and j
59 respectively.
60
61 Note that previous versions of detex would replace control sequences
62 with a space character to prevent words from running together. How‐
63 ever, this caused accents in the middle of words to break words, gener‐
64 ating "spelling errors" that were not desirable. Therefore, the new
65 version merely removes these accents. The old functionality can be
66 essentially duplicated by using the -s option.
67
69 tex(1)
70
72 Nesting of \input is allowed but the number of opened files must not
73 exceed the system's limit on the number of simultaneously opened files.
74 Detex ignores unrecognized option characters after printing a warning
75 message.
76
78 Daniel Trinkle, Computer Science Department, Purdue University
79
81 Detex is not a complete TeX interpreter, so it can be confused by some
82 constructs. Most errors result in too much rather than too little out‐
83 put.
84
85 Running LaTeX source without a ``\begin{document}'' through detex may
86 produce errors.
87
88 Suggestions for improvements are (mildly) encouraged.
89
90
91
92Purdue University 12 August 1993 DETEX(1)