| 1 |
.TH DETEX 1 "August 12, 1993" "Purdue University" |
| 2 |
.SH NAME |
| 3 |
detex \- a filter to strip \fITeX\fP commands from a .tex file. |
| 4 |
.SH SYNOPSIS |
| 5 |
.B detex |
| 6 |
[ \fB\-clnstw\fR ] [ \fB\-e\fI environment-list\fR ] |
| 7 |
[ \fIfilename\fR[.tex] ... ] |
| 8 |
.SH DESCRIPTION |
| 9 |
.I Detex |
| 10 |
reads each file in sequence, removes all comments and |
| 11 |
.I TeX |
| 12 |
control sequences |
| 13 |
and writes the remainder on the standard output. |
| 14 |
All text in math mode and display mode is removed. |
| 15 |
By default, |
| 16 |
.I detex |
| 17 |
follows \einput commands. |
| 18 |
If a file cannot be opened, a warning message is |
| 19 |
printed and the command is ignored. |
| 20 |
If the |
| 21 |
.B \-n |
| 22 |
option is used, no \einput or \einclude commands will be processed. |
| 23 |
This allows single file processing. |
| 24 |
If no input file is given on the command line, |
| 25 |
.I detex |
| 26 |
reads from standard input. |
| 27 |
.PP |
| 28 |
If the magic sequence ``\ebegin{document}'' appears in the text, |
| 29 |
.I detex |
| 30 |
assumes it is dealing with |
| 31 |
.I LaTeX |
| 32 |
source and |
| 33 |
.I detex |
| 34 |
recognizes additional constructs used in |
| 35 |
.IR LaTeX . |
| 36 |
These include the \einclude and \eincludeonly commands. |
| 37 |
The |
| 38 |
.B \-l |
| 39 |
option can be used to force |
| 40 |
.I LaTeX |
| 41 |
mode and the |
| 42 |
.B \-t |
| 43 |
option can be used to force |
| 44 |
.I TeX |
| 45 |
mode regardless of input content. |
| 46 |
.PP |
| 47 |
Text in various environment modes of |
| 48 |
.I LaTeX |
| 49 |
is ignored. The default modes are array, eqnarray, equation, longtable, |
| 50 |
picture, tabular and verbatim. The |
| 51 |
.B \-e |
| 52 |
option can be used to specify a comma separated |
| 53 |
.I environment-list |
| 54 |
of environments to ignore. The list replaces the defaults so specifying an |
| 55 |
empty list effectively causes no environments to be ignored. |
| 56 |
.PP |
| 57 |
The |
| 58 |
.B \-c |
| 59 |
option can be used in |
| 60 |
.I LaTeX |
| 61 |
mode to have detex echo the arguments to \ecite, |
| 62 |
\eref, and \epageref macros. This can be useful when sending the output to |
| 63 |
a style checker. |
| 64 |
.PP |
| 65 |
.I Detex |
| 66 |
assumes the standard character classes are being used for |
| 67 |
.IR TeX . |
| 68 |
.I Detex |
| 69 |
allows white space between control sequences |
| 70 |
and magic characters like `{' when recognizing things like |
| 71 |
.I LaTeX |
| 72 |
environments. |
| 73 |
.PP |
| 74 |
The |
| 75 |
.B \-r |
| 76 |
option tries to naively replace $..$, $$..$$, \e(..\e) and \e[..\e] |
| 77 |
with nouns and verbs (in particular, "noun" and "verbs") |
| 78 |
in a way that keeps sentences readable. |
| 79 |
.PP |
| 80 |
If the |
| 81 |
.B \-w |
| 82 |
flag is given, the output is a word list, one `word' (string of two or more |
| 83 |
letters and apostrophes beginning with a letter) |
| 84 |
per line, and all other characters ignored. |
| 85 |
Without \fB\-w\fR the output follows the original, |
| 86 |
with the deletions mentioned above. Newline characters are |
| 87 |
preserved where possible |
| 88 |
so that the lines of output match the input as closely as possible. |
| 89 |
.PP |
| 90 |
The |
| 91 |
.B \-1 |
| 92 |
option will prefix each printed line with `filename:linenumber:` indicating |
| 93 |
where that line is coming from in terms of the original (La)TeX document. |
| 94 |
.PP |
| 95 |
The TEXINPUTS environment variable is used to find \einput and \einclude |
| 96 |
files. Like \fITeX\fP, it interprets a leading or trailing `:' as the default |
| 97 |
TEXINPUTS. |
| 98 |
It does \fInot\fP support the `//' directory expansion magic sequence. |
| 99 |
.PP |
| 100 |
Detex now handles the basic \fITeX\fP ligatures as a special case, replacing the |
| 101 |
ligatures with acceptable character4 substitutes. This eliminates |
| 102 |
spelling errors introduced by merely removing them. The ligatures are |
| 103 |
\eaa, \eae, \eoe, \ess, \eo, \el (and their upper-case |
| 104 |
equivalents). The special "dotless" characters \ei and \ej are also |
| 105 |
replaced with i and j respectively. |
| 106 |
.PP |
| 107 |
Note that previous versions of |
| 108 |
.I detex |
| 109 |
would replace control sequences with a space character to prevent words |
| 110 |
from running together. |
| 111 |
However, this caused accents in the middle of words to break words, generating |
| 112 |
"spelling errors" that were not desirable. |
| 113 |
Therefore, the new version merely removes these accents. |
| 114 |
The old functionality can be essentially duplicated by using the |
| 115 |
.B \-s |
| 116 |
option. |
| 117 |
.SH SEE ALSO |
| 118 |
.BR tex(1) |
| 119 |
.SH DIAGNOSTICS |
| 120 |
Nesting of \einput is allowed but the number of opened files must not |
| 121 |
exceed the system's limit on the number of simultaneously opened files. |
| 122 |
.I Detex |
| 123 |
ignores unrecognized option characters after printing a warning message. |
| 124 |
.SH AUTHOR |
| 125 |
Originally written by Daniel Trinkle, Computer Science Department, |
| 126 |
Purdue University. |
| 127 |
.PP |
| 128 |
Maintained by Piotr Kubowicz <https://github.com/pkubowicz/opendetex>. |
| 129 |
.SH BUGS |
| 130 |
.I Detex |
| 131 |
is not a |
| 132 |
.I TeX |
| 133 |
interpreter (it essentially reads the input with a (f)lex program), so |
| 134 |
it is easily confused by some constructs. Most errors result in too much |
| 135 |
rather than too little output. |
| 136 |
.PP |
| 137 |
Running \fILaTeX\fR |
| 138 |
source without a ``\ebegin{document}'' |
| 139 |
through \fIdetex\fR may produce |
| 140 |
errors. |
| 141 |
.PP |
| 142 |
Suggestions for improvements are (mildly) encouraged. |