General ⇒ totcount package
-
- Posts: 34
- Joined: Sat Aug 08, 2009 1:05 pm
totcount package
I'm finishing writing a math book and I'm trying to generate a statistics report to include at the end of the preface. After some search, it seems that the appropriate package to use is the totcount, but since I'm using the input to include each chapter, the counter is not working, and I always get 0 as the number. Does anyone knows how to circumvent this problems?
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
totcount package

OS: Debian/GNU Linux; LaTeX System : TeXLive; Editor : Vim
-
- Posts: 34
- Joined: Sat Aug 08, 2009 1:05 pm
totcount package
Code: Select all
\documentclass{book}
\usepackage{amsmath,amsthm,amssymb}
\usepackage{totcount}
\newtheorem{thm}{Theorem}[section]
\regtotcounter{thm}
\begin{document}
\input{preface}
\input{chp1}
\input{chp2}
\end{document}
Code: Select all
\total{thm}
totcount package
The following code works. Try it and see if it helps in solving your problem:
Code: Select all
\documentclass{book}
\usepackage{amsmath,amsthm,amssymb}
\usepackage{totcount}
\newtheorem{thm}{Theorem}[section]
\regtotcounter{thm}
\begin{document}
\chapter{Preface}
This is a preface.
There are a total of \total{thm}~theorems in the book.
\chapter{Intro}
This is some sort of an introduction.
\begin{thm}
The theorem is blah blah \dots
\end{thm}
\begin{thm}
The theorem is blah blah \dots
\end{thm}
\chapter{Boring Details}
This is introduction.
\begin{thm}
The theorem is blah blah \dots
\end{thm}
\begin{thm}
The theorem is blah blah \dots
\end{thm}
\begin{thm}
The theorem is blah blah \dots
\end{thm}
\end{document}
OS: Debian/GNU Linux; LaTeX System : TeXLive; Editor : Vim
-
- Posts: 34
- Joined: Sat Aug 08, 2009 1:05 pm
totcount package
Unfortunately, my problem is that the content of the preface and the chapters are defined as files, they are not written between \begin{document} and \end{document}, they are called using \input, and I think this is the reason the counter is not working.
Re: totcount package
OS: Debian/GNU Linux; LaTeX System : TeXLive; Editor : Vim