Skip to content
Counter.tex 1.49 KiB
Newer Older
Thomas Winkler's avatar
Thomas Winkler committed
%% You can pass in your own texcount params, e.g. -chinese to turn on Chinese mode, or -char to do a character count instead (which does NOT include spaces!)
%%% http://app.uio.no/ifi/texcount/documentation.html
\newcommand{\detailtexcount}[1]{%
  \immediate\write18{texcount -merge -sum -char -nobib -dir -relaxed #1.tex > #1.wcdetail }%
  \verbatiminput{#1.wcdetail}%
}

\newcommand{\quickwordcount}[1]{%
  \immediate\write18{texcount -1 -merge -sum -nobib -relaxed #1.tex > #1-words.sum }%
  \input{#1-words.sum} Wörter%
}

%   -sum, -sum=   Make sum of all word and equation counts. May also use
%              -sum=#[,#] with up to 7 numbers to indicate how each of the
%              counts (text words, header words, caption words, #headers,
%              #floats, #inlined formulae, #displayed formulae) are summed.
%              The default sum (if only -sum is used) is the same as
%              -sum=1,1,1,0,0,1,1.


\newcommand{\quickcharcount}[1]{%
  \immediate\write18{texcount -1 -merge -sum -char -nobib -relaxed #1.tex > #1-chars.sum }%
  \input{#1-chars.sum} Charaktere (ohne Leerzeichen/Leerzeichen ausgenommen)%
}

%% You can use these special %TC: tags to ignore certain parts of the text.
%TC:ignore
\chapter{Charaktere zählen}

\textit{Dieser Abschnitt und die folgenden Verzeichnisse werden vom Zähler ignoriert.}

\section{Grobe Zählung}

\enskip\textbf{\quickwordcount{main}}

\enskip\textbf{\quickcharcount{main}}

\section{Detaillierte Aufschlüsselung}

\detailtexcount{main}
%TC:endignore