summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-wordcount.html
blob: 52902737d5454d061199ac59e7cf277d0a4a29b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<head>
<title>UK TeX FAQ -- question label wordcount</title>
</head><body>
<h3>How many words have you written?</h3>
<p/>One often has to submit a document (e.g., a paper or a dissertation)
under some sort of constraint about its size.  Sensible people set a
constraint in terms of numbers of pages, but there are some that
persist in limiting the numbers of words you type.
<p/>A simple solution to the requirement can be achieved following a
simple observation: the powers that be are unlikely to count all the
words of a document submitted to them.  Therefore, a statistical
method can be employed: find how many words there are on a full page;
find how many full pages there are in the document (allowing for
displays of various sorts, this number will probably not be an
integer); multiply the two.  However, if the document to be submitted
is to determine the success of the rest of one&#8217;s life, it takes a
brave person to thumb their nose at authority quite so
comprehensively&#8230;
<p/>The simplest method is to strip out the (La)TeX markup, and to count
what&#8217;s left.  On a  Unix-like system, this may be done using
<i>detex</i> and the built-in <i>wc</i>:
<pre>
  detex &#60;filename&#62; | wc -w
</pre>
The <i>latexcount</i> script does the same sort of job, in one
&#8220;step&#8221;; being a <i>perl</i> script, it is in principle rather
easily configured (see documentation inside the script).
<i>Winedt</i> (see <a href="FAQ-editors.html">editors and shells</a>)
provides this functionality direct in the Windows environment.
<p/><i>TeXcount</i> also goes a long way with heuristics for counting,
starting from a LaTeX file; the documentation is comprehensive, and
you may try the script on-line via the 
  <a href="http://folk.uio.no/einarro/Comp/texwordcount.html">package home page</a>.

Even quite sophisticated stripping of (La)TeX markup can never be
entirely reliable, however: that markup itself may contribute typeset
words, and this could be a problem.  The <i>wordcount</i> package
contains a Bourne shell (i.e., typically Unix) script for running a
LaTeX file with a special piece of supporting TeX code, and then
counting word indications in the log file.  This is probably as
accurate automatic counting as you can get, if it works for you.
<dl>
<dt><tt><i>detex</i></tt><dd><a href="http://www.tex.ac.uk/tex-archive/support/detex.zip">support/detex</a> (or <a href="http://www.tex.ac.uk/tex-archive/support/detex/">browse the directory</a>)
<dt><tt><i>latexcount.pl</i></tt><dd><a href="http://www.tex.ac.uk/tex-archive/support/latexcount/latexcount.pl">support/latexcount/latexcount.pl</a>
<dt><tt><i>TeXcount</i></tt><dd><a href="http://www.tex.ac.uk/tex-archive/support/texcount.zip">support/texcount</a> (or <a href="http://www.tex.ac.uk/tex-archive/support/texcount/">browse the directory</a>)
<dt><tt><i>wordcount</i></tt><dd><a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/wordcount.zip">macros/latex/contrib/wordcount</a> (or <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/wordcount/">browse the directory</a>)
</dl>
<p/>
<p/><p/><p/><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=wordcount">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=wordcount</a>
</body>