The journal I am submitting to requires a total word count on the title page. My question is more like an extension to Greg's previous question. The journal states that a table/figure is counted as 250 words, and the total word count — which is essentially word count + figure count * 250 + table count * 250 — cannot exceed a certain number.
From Greg's solution, I was able to print the three counts using texcount
and totcount
:
\newcommand\wordcount{
\immediate\write18{texcount -sum -1 \jobname.tex > count.txt} \input{count.txt}}
\usepackage{totcount}
\regtotcounter{table} %count tables
\regtotcounter{figure} %count figures
Word Count: \wordcount words + \total{figure} figure(s) + \total{table} table(s) = ?? words
My question is, in LaTeX, how do I calculate the total word count (??) using the three counts and print it on my title page?
PS. I am new to LaTeX (and TeX.SX
) so any help is highly appreciated!
Best Answer
Use
\numexpr
and other commands to calculate the multiplication.However, just inputing
count.txt
does not make the number available for computation. I stored the number to a counter instead.The command
\totalwordcount
computes the number of words from the\wordcount
command and adds the table/figure word amount then, finally the counter value is printed. Afterwards the command is redefined to provide only the counter value, no computations are done in the end.