\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{url}
\usepackage[margin=1cm]{geometry}
\usepackage{verbatim}
\title{Customising texcount}
\author{LianTze Lim (Overleaf)}
\date{}
%% 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
%% To include references. DO NOT USE WITH BIBLATEX
%TC:incbib
%% To include tabulars in main text count.
%TC:group table 0 1
%TC:group tabular 1 1
\newcommand{\detailtexcount}[1]{%
\immediate\write18{texcount -merge -sum -q #1.tex output.bbl > #1.wcdetail }%
\verbatiminput{#1.wcdetail}%
}
\newcommand{\quickwordcount}[1]{%
\immediate\write18{texcount -1 -sum -merge -q #1.tex output.bbl > #1-words.sum }%
\input{#1-words.sum} words%
}
% -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 -sum -merge -char -q #1.tex output.bbl > #1-chars.sum }%
\input{#1-chars.sum} characters (not including spaces)%
}
\begin{document}
\maketitle
%% You can define extra breakpoints to count certain text regions.
%TC:break Abstract
\begin{abstract}
Cupcake ipsum dolor sit amet. Cotton candy lollipop sweet apple pie sugar plum. Halvah jelly-o jujubes tart tart cake sesame snaps. Muffin halvah tootsie roll jelly-o caramels chupa chups. Powder macaroon chupa chups. Lollipop ice cream chocolate cake chupa chups chocolate bar jelly beans gummi bears chocolate jelly-o.
\end{abstract}
%% You can use these special %TC: tags to ignore certain parts of the text.
%TC:ignore
\section*{Word Counts}
This section is \textit{not} included in the word count.
\quickwordcount{main}
\quickcharcount{main}
\detailtexcount{main}
%TC:endignore
\section{Intro}
The delicious dummy text is generated by \url{http://cupcakeipsum.com/}.
Liquorice oat cake jelly beans. \cite{geiger2012we} Cookie carrot cake carrot cake dessert gingerbread. Donut fruitcake bonbon croissant chupa chups jelly beans apple pie. Liquorice tiramisu donut tiramisu gummies. Gummi bears chupa chups lollipop chocolate bar macaroon lollipop croissant sweet roll. Halvah candy ice cream bear claw jelly-o. Chocolate bar gingerbread chocolate sesame snaps pie. Liquorice cake pie sugar plum.
\section{Details}
Cake toffee bonbon sugar plum fruitcake cotton candy caramels lollipop marzipan. Carrot cake chocolate bar candy lollipop gummies jujubes muffin jelly. Candy canes lemon drops sweet roll croissant halvah wafer croissant tiramisu toffee. Toffee dragée topping ice cream chocolate cake tootsie roll sesame snaps caramels cake. Dessert pie bear claw muffin macaroon icing dessert cake. Candy chupa chups lollipop croissant tootsie roll powder bear claw cookie muffin. Cupcake topping dessert marzipan muffin jelly-o tootsie roll halvah. Tart pudding icing jujubes biscuit dessert. Carrot cake muffin chupa chups cookie pastry gingerbread topping.
\begin{table}[htb!]
\centering
\begin{tabular}{c|c}
This is & a test \\
Why so & serious?
\end{tabular}
\caption{This is a table}
\label{tab:my_label}
\end{table}
Lollipop brownie macaroon chocolate sweet roll. Biscuit marzipan tiramisu tootsie roll chocolate pie. Halvah icing lemon drops sesame snaps fruitcake marshmallow tiramisu jujubes. Dragée pudding chocolate topping oat cake caramels brownie cake lemon drops. Tootsie roll chupa chups icing dessert biscuit marshmallow sesame snaps apple pie. Dragée jelly icing cake muffin candy toffee pudding macaroon. Bear claw cake gummi bears. Danish cotton candy oat cake sesame snaps chocolate cupcake.
Donut cake tart icing sesame snaps. Cotton candy carrot cake pie cake bear claw biscuit dragée sugar plum. Pudding marshmallow candy cupcake cake bonbon icing. Dessert halvah sesame snaps danish muffin. Halvah cookie sugar plum oat cake tart pie marshmallow muffin. Wafer toffee caramels sweet danish liquorice. Macaroon cheesecake tootsie roll caramels cake. Bonbon oat cake wafer. Tootsie roll powder chocolate cake icing toffee cake dragée pudding jujubes. Pastry apple pie fruitcake chocolate bar chocolate biscuit pastry tiramisu.
\bibliographystyle{plain}
\bibliography{refs}
\end{document}