← 返回命令列表

Linux command

detex 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Remove LaTeX commands from a file

detex [document.tex]

Process and output to file

detex [document.tex] > [output.txt]

Follow \\input and \\include references

detex -e [document.tex]

Process in LaTeX mode

detex -l [document.tex]

Retain math mode content

detex -m [document.tex]

Show environment names to ignore

detex -n [document.tex]

说明

detex strips LaTeX and TeX commands from documents, leaving plain text. This is useful for spell checking, word counting, text analysis, and extracting readable content from LaTeX source files. The tool handles standard LaTeX constructs: commands, environments, comments, and special characters. Math mode content is typically removed unless -m is specified. With -e, it follows \\input directives to process multi-file documents. Output is the document text without markup, suitable for piping to spell checkers, word processors, or text analysis tools.

参数

-e
Expand \\input and \\include directives.
-l
Force LaTeX mode processing.
-m
Retain dollar signs and math content.
-n
Show names of unknown environments.
-s
Replace math with space instead of removing.
-t
Force plain TeX mode.
-w
Output one word per line.

FAQ

What is the detex command used for?

detex strips LaTeX and TeX commands from documents, leaving plain text. This is useful for spell checking, word counting, text analysis, and extracting readable content from LaTeX source files. The tool handles standard LaTeX constructs: commands, environments, comments, and special characters. Math mode content is typically removed unless -m is specified. With -e, it follows \\input directives to process multi-file documents. Output is the document text without markup, suitable for piping to spell checkers, word processors, or text analysis tools.

How do I run a basic detex example?

Run `detex [document.tex]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -e do in detex?

Expand \\input and \\include directives.