Apologies if this is really simple but I cannot figure this out. I am using the muthesis template for my thesis. A requirement of the University is to include a word count at the end of the toc, lof and lot. Within this template there is already a line for the word count as
\def\wordcount{}
I thought this would be a case of simply using the latex word count tool online http://app.uio.no/ifi/texcount/, input each of my chapters, add the numbers up and put this into \def\wordcount{}
, e.g. \def\wordcount{57103}
. But when I do this, it still comes up with 'word count 999,999'.
What am I doing wrong?
Here is a MWE:
\documentclass[11pt,PhD,twoside]{muthesis}
\usepackage[T1]{fontenc}% recommended
\usepackage{textcomp}
\usepackage{todonotes}
\usepackage{amsmath}
\usepackage{amstext}
\usepackage{enumitem}
% tables
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{booktabs}
% captions and floats
\usepackage[font=footnotesize,labelfont=bf]{caption}
\usepackage[aboveskip=2pt]{subcaption} % aboveskipchanges spacing beten caption and figure
\captionsetup[subfigure] {justification=justified,singlelinecheck=false} %%% alignment of subfigure captions
\usepackage{stackengine}
% colour, graphics, diagrams
\PassOptionsToPackage{table}{xcolor}
\usepackage{graphicx}% don't load graphics as well - this covers it all already
\usepackage{pgfplotstable}
\pgfplotstableset{col sep=comma}
\usepackage[UKenglish]{datetime}
\usepackage{parskip}
\usepackage[none]{hyphenat}
\usepackage{lscape}
% for references
\usepackage{natbib}
%\setlength{\bibhang}{5em}
\renewcommand{\bibfont}{\normalfont\small}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{listings}
\usepackage[]{titlesec}
\usepackage{fancyhdr}
% to sort out issues with urls
\usepackage[hyperindex,breaklinks]{hyperref}
\titleformat{\section}
{\normalfont\fontsize{13}{15}\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}
{\normalfont\fontsize{13}{15}\bfseries}{\thesubsection}{1em}{}
\titleformat{\subsubsection}
{\normalfont\fontsize{13}{15}\bfseries}{\thesubsubsection}{1em}{}
\titleformat{\subsubsubsection}
{\normalfont\fontsize{13}{15}\bfseries}{\thesubsubsubsection}{1em}{}
\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}
\def\afterpreface{\newpage
\pagestyle{fancy}}
\pagestyle{fancy}
\fancyhf{}
\renewcommand*\headrulewidth{0pt}
\fancyhf[leh,roh]{\thepage}
\fancyhf[loh,reh]{\slshape\leftmark}
\begin{document}
\title{A thesis}
\author{AN Author}
\school{School of}
\faculty{Faculty}
\def\wordcount{57103} %%% Word count required at end of toc/lof and lot
\beforeabstract
\section*{Abstract}
\addcontentsline{toc}{chapter}{Abstract}
\begin{spacing}{1.0}
\fontsize{12}{12}\normalfont% faculty requirements for abstract
abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract abstract
\end{spacing}
\afterabstract
\prefacesection{Acknowledgements}
I would like to thank......
\afterpreface
\chapter{Introduction}
\section{Background}
Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background
\clearpage
\section{Background2}
Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background
\clearpage
\section{Background3}
Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background Background
\end{document}
Best Answer
So the best I can come up with is to copy the
\beforeabstract
macro frommuthesis.cls
into your preamble and adjust the word count there:In that way, you don't have to fiddle with the contents of
muthesis
, which you might want to keep as they are.EDIT: After inspecting the commented lines in
\beforeabstract
I managed to do the word count automatically: For that, you need to runpdflatex --shell-escape report.tex
and have the following code:Further, you need a local copy of
texcount.pl
, refer to the links provided in the comments for help there.