LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

texcount

Count words in LaTeX documents

TLDR

Count words
$ texcount [document.tex]
copy
Brief output
$ texcount -brief [document.tex]
copy
Include subcounts
$ texcount -sub [document.tex]
copy
HTML output
$ texcount -html [document.tex]
copy
Count multiple files
$ texcount -merge [file1.tex] [file2.tex]
copy
Verbose output
$ texcount -v [document.tex]
copy

SYNOPSIS

texcount [-brief] [-sub] [-html] [options] files

DESCRIPTION

texcount counts words in LaTeX documents by properly parsing TeX syntax rather than counting all whitespace-separated tokens. It distinguishes between text words, header words, caption words, and mathematical formulas, providing accurate counts that exclude macro names and formatting commands.The -sub option breaks down counts by section, chapter, or other structural elements, which is useful for tracking progress on individual parts of a document. Multiple files can be processed together with -merge, and -inc follows \\input and \\include directives to count included files. Output formats include plain text, HTML, and verbose mode showing how each word was classified.

PARAMETERS

-brief

Short output.
-sub
Subcounts by section.
-html
HTML output.
-merge
Merge file counts.
-v
Verbose output.
-inc
Include input files.

CAVEATS

LaTeX specific. Custom macros may confuse. Perl required.

HISTORY

TeXcount was created to provide accurate word counts for LaTeX documents by properly parsing TeX syntax.

SEE ALSO

wc(1), latex(1), detex(1)

Copied to clipboard
Kai