TransWikia.com

How can I display number of words within my document?

TeX - LaTeX Asked by RobertLownds on May 17, 2021

For a magazine I have to write a small article of max. 700 words. I’d like to have a wordcount at the end. I found the following code here on StackExchange. But when I tried it myself it didn’t work. Unfortunately, I’m not allowed to respond to the topic.

documentclass{article}

newcommandwordcount{input{|"texcount -inc -sum -0 -template={SUM} jobname.tex"}}

begin{document}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec eleifend pulvinar quam, vel suscipit urna tincidunt eget.

This document has wordcount words.

end{document}

I get the following Error:

! LaTeX Error: File `|texcount -inc -sum -0 -template={SUM} test.tex’
not found .

Type X to quit or to proceed, or enter new name. (Default
extension: tex)

Enter file name:

Does anybody knows what is going wrong?

One Answer

mwe

documentclass{article}
parskip1emparindent0pt
immediatewrite18{texcount -1 -sum  jobname.tex > wordcount.aux }
begin{document}
section*{How to compile this file}
From the command line (The damn buttonless  black window): par
hfiltexttt{pdflatex --shell-escape  jobname .tex}par  
From  your favourite  LaTeX editor: par
hangindent1emhangafter0 Edit your editor configuration to enable the  option texttt{--shell-escape} of  the texttt{pdflatex} compiler. You should {em not} use this option by foreing  documents (like this) without know if the source is safe.par

% This part is not counted
%TC:ignore 
 Word count = {bfserieslarge input{wordcount.aux}}
%TC:endignore   
end{document}

Answered by Fran on May 17, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP