diff options
author | Karl Berry <karl@freefriends.org> | 2009-04-15 18:36:55 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-04-15 18:36:55 +0000 |
commit | 3617ef0fc28f0485785df18efeccd6bbd6b33bf1 (patch) | |
tree | 9d3430109e013d92405f713460a70d305c4b1a8a /Master/texmf-dist/doc/latex/totcount/totcount-ex.tex | |
parent | e802015081c281d89ccb87b4e29bd063d3ea427f (diff) |
new latex package totcount (14apr09)
git-svn-id: svn://tug.org/texlive/trunk@12727 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/totcount/totcount-ex.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/totcount/totcount-ex.tex | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/totcount/totcount-ex.tex b/Master/texmf-dist/doc/latex/totcount/totcount-ex.tex new file mode 100644 index 00000000000..7a8abdee4b2 --- /dev/null +++ b/Master/texmf-dist/doc/latex/totcount/totcount-ex.tex @@ -0,0 +1,82 @@ +%% +%% This is file `totcount-ex.tex', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% totcount.dtx (with options: `ex') +%% +%% The TotCount package, version 1.0, 2009/04/14 +%% +%% Copyright (c) [2009] Vasileios Koutavas (Vasileios.Koutavas@cs.tcd.ie) +%% +%% This program may be re-distributed and/or modified under the terms of the +%% LaTeX Project Public License version 1.3c, or any later version. +%% The latest version of this license is in +%% CTAN:macros/latex/base/lppl.txt +%% +\def\fileversion{1.0} +\def\filedate{2009/04/14} +\def\docdate{14 April 2009} +\NeedsTeXFormat{LaTeX2e} + \date{\docdate} +\ProvidesFile{totcount-ex.tex} + [\filedate \space v\fileversion \space% + test file for the TotCount package] +\documentclass{article} +%% +%% Import the package +\RequirePackage{totcount} +%% +%% Comment out the following line to use the previously stored total counts in +%% 'mycount.aux' (make sure it exists!) instead of computing them again: +\def\computemycount{} +\expandafter\ifx\csname computemycount\endcsname\relax + \usetotcountfile{mycount.aux} + \newcounter{mycount} % so that increments of this counter don't break +\else + \newtotcounter[auxfile=mycount.aux]{mycount} +\fi +%% +%% Register the section and page counters as a total counters: +\regtotcounter{section} +\regtotcounter{page} + +\begin{document} +%% +%% A total counter can be declared/registered anywhere: +\newtotcounter{yourcount} + +\section{Total Counts} +%% +%% Increment counters as usual: +\addtocounter{mycount}{5} +\addtocounter{yourcount}{5} +%% +%% Print the value of a total counter by using |\total|: +The total value of the counter {\tt mycount} is \total{mycount} (should +be 10), and the total value of the counter {\tt yourcount} is +\total{yourcount} (should be 17). + +%% +%% Get the numeric value of a total counter by using |\totvalue|: +This document has \total{section} +\ifnum\totvalue{section}=1 section \else sections \fi +and \total{page} +\ifnum\totvalue{page}=1 page. \else pages. \fi + +%% +%% The effect of incrementing the counters will be visible the second +%% time LaTeX runs: +\addtocounter{yourcount}{5} +\addtocounter{mycount}{5} +\addtocounter{yourcount}{7} + +\section{A Section} +\section{Another Section} +\section{Yet Another Section} + +\end{document} +\endinput +%% +%% End of file `totcount-ex.tex'. |