m. c. de marco: To invent new life and new civilizations...

word counts

About counting words

"What Is a Word?" by Chuck Rothman

Methods for counting words

LaTeX

Sffms has a basic word counter which inserts the word count into your manuscript. Use the \wordcount command to adjust the word count manually.

For more word counting options, try the wordcount script available on CTAN.

Emacs word count macro

If you use emacs, put the following code into your .emacs file. Control-c w will count words in a highlighted region. Use control-x h first in order to count the entire buffer.

    ;; source: xemacs 20.3
    (defun count-words-region (start end)
       (interactive "r")
       (save-excursion
          (let ((n 0))
           (goto-char start)
           (while (< (point) end)
             (if (forward-word 1)
                 (setq n (1+ n))))
           (message "Region has %d words" n)
           n)))

    (global-set-key "\C-cw" 'count-words-region)

wc

Of course, there's always wc, the unix word counting program.

Links checked: September 28, 2022