1DETEX(1)                    General Commands Manual                   DETEX(1)
2
3
4

NAME

6       detex - a filter to strip TeX commands from a .tex file.
7

SYNOPSIS

9       detex [ -clnstw ] [ -e environment-list ] [ filename[.tex] ... ]
10

DESCRIPTION

12       Detex (Version 2.8.3) 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, longtable, picture, tabular and
29       verbatim.  The -e option can be used to specify a comma separated envi‐
30       ronment-list of environments to ignore.  The list replaces the defaults
31       so specifying an empty list effectively causes no  environments  to  be
32       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       The  -r  option  tries to naively replace $..$, $$..$$,  and with nouns
43       and verbs (in particular, "noun" and "verbs") in a way that keeps  sen‐
44       tences readable.
45
46       If  the -w flag is given, the output is a word list, one `word' (string
47       of two or more letters and apostrophes beginning  with  a  letter)  per
48       line,  and all other characters ignored.  Without -w the output follows
49       the original, with the deletions mentioned above.   Newline  characters
50       are  preserved  where  possible  so  that the lines of output match the
51       input as closely as possible.
52
53       The TEXINPUTS environment variable is used to find \input and  \include
54       files.   Like  TeX,  it  interprets  a  leading  or trailing `:' as the
55       default TEXINPUTS.  It does not support the  `//'  directory  expansion
56       magic sequence.
57
58       Detex  now handles the basic TeX ligatures as a special case, replacing
59       the ligatures with acceptable charater  substitutes.   This  eliminates
60       spelling  errors introduced by merely removing them.  The ligatures are
61       \aa, \ae, \oe, \ss, \o, \l (and  their  upper-case  equivalents).   The
62       special  "dotless"  characters \i and \j are also replaced with i and j
63       respectively.
64
65       Note that previous versions of detex would  replace  control  sequences
66       with  a  space  character to prevent words from running together.  How‐
67       ever, this caused accents in the middle of words to break words, gener‐
68       ating  "spelling  errors"  that were not desirable.  Therefore, the new
69       version merely removes these accents.  The  old  functionality  can  be
70       essentially duplicated by using the -s option.
71

SEE ALSO

73       tex(1)
74

DIAGNOSTICS

76       Nesting  of  \input  is allowed but the number of opened files must not
77       exceed the system's limit on the number of simultaneously opened files.
78       Detex  ignores  unrecognized option characters after printing a warning
79       message.
80

AUTHOR

82       Originally written by Daniel Trinkle, Computer Science Department, Pur‐
83       due University
84
85       Maintained by Piotr Kubowicz <https://github.com/pkubowicz/opendetex>.
86

BUGS

88       Detex  is not a complete TeX interpreter, so it can be confused by some
89       constructs.  Most errors result in too much rather than too little out‐
90       put.
91
92       Running  LaTeX  source without a ``\begin{document}'' through detex may
93       produce errors.
94
95       Suggestions for improvements are (mildly) encouraged.
96
97
98
99Purdue University               12 August 1993                        DETEX(1)
Impressum