Wie kann ich die Anzahl der Wörter in meinem Dokument anzeigen?
Jan 12 2021
Für eine Zeitschrift muss ich einen kleinen Artikel von max. 700 Wörter. Am Ende hätte ich gerne eine Wortzahl. Ich habe den folgenden Code hier auf StackExchange gefunden. Aber als ich es selbst ausprobiert habe, hat es nicht funktioniert. Leider darf ich nicht auf das Thema antworten.
\documentclass{article}
\newcommand\wordcount{\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}
Ich erhalte folgenden Fehler:
! LaTeX-Fehler: Datei `| texcount -inc -sum -0 -template = {SUM} test.tex 'wurde nicht gefunden.
Geben Sie X ein, um das Programm zu beenden oder fortzufahren, oder geben Sie einen neuen Namen ein. (Standarderweiterung: tex)
Dateinamen eingeben:
Weiß jemand, was falsch läuft?
Antworten
1 Fran Jan 13 2021 at 04:28

\documentclass{article}
\parskip1em\parindent0pt
\immediate\write18{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
\hfil\texttt{pdflatex --shell-escape \jobname .tex}\par
From your favourite \LaTeX\ editor: \par
\hangindent1em\hangafter0 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 = {\bfseries\large \input{wordcount.aux}}
%TC:endignore
\end{document}