0

I am trying to get the words cumber per section using the following lines:

\newcommand\wordcount{
    \immediate\write18{texcount -sub=section \jobname.tex  | grep "Section" | sed -e 's/+.*//' | sed -n \thesection p > 'count.txt'}
    (\input{count.txt}words)}

as in: Dynamically count words in chapter and insert word count at start of chapter or wordcount by section when sections were formally known as chapter

however, the words are not counted. But no error pops up.

In the pdf output it appears:

no words example

Many thanks in advance for your suggestions

Rui
  • 101
  • You need to provide more details. Can you run the instruction from the command line? Is the count.txt file produced? What's your OS and TeXcount version? Have you set the shell-escape option required for running commands from TeX? – Einar Rødland Aug 11 '20 at 18:27
  • @EinarRødland the file count.txt is not produced. I think that is actually the main issue (besides my lack of computational skills)

    Additional information: OS:64-bit version ; TeXcount_3_2.

    The shell-escape option was set as in: https://tex.stackexchange.com/questions/99475/how-to-invoke-latex-with-the-shell-escape-flag-in-texstudio-former-texmakerx

    – Rui Aug 12 '20 at 06:53
  • Try reducing the example, and try to see what's the simplest case that still fails. Eg try running just texcount -o count.txt \jobname.tex and see if this still fails. You can also try echo "test" > count.txt just to see if it actually runs. I also have some vague memory of some version of TeX that took a different option than shell-escape. – Einar Rødland Aug 12 '20 at 18:43

0 Answers0