diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/assoccnt/assoccnt_example.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/assoccnt/assoccnt_example.tex | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/assoccnt/assoccnt_example.tex b/Master/texmf-dist/doc/latex/assoccnt/assoccnt_example.tex new file mode 100644 index 00000000000..af6e1ddd295 --- /dev/null +++ b/Master/texmf-dist/doc/latex/assoccnt/assoccnt_example.tex @@ -0,0 +1,97 @@ +\documentclass{book}% + +\usepackage{totcount}% +\usepackage{assoccnt}% + +% Some packages only for output and dummy pages +\usepackage{blindtext}% +\usepackage{forloop}% +\usepackage{xcolor}% + +\newcounter{loopcounter}% + +\newcommand{\ShowNiceCounterOutput}[5]{% +\begin{center}% +\begin{tabular}{llll}% +& & & \tabularnewline +& \multicolumn{3}{c}{totcount page values} \tabularnewline +Page & \textcolor{red}{#1} & \textcolor{blue}{#2} & \textcolor{gray}{#3} \tabularnewline +\thepage & \textcolor{red}{\number\totvalue{#1}} & \textcolor{blue}{\number\totvalue{#2}} & \textcolor{gray}{\number\totvalue{#3}} \tabularnewline +& & & \tabularnewline + & \multicolumn{3}{c}{totcount section values} \tabularnewline +Section & \textcolor{red}{#4} & \textcolor{blue}{#5} \tabularnewline +\thesection & \textcolor{red}{\number\totvalue{#4}} & \textcolor{blue}{\number\totvalue{#5}} & \tabularnewline +& & & \tabularnewline +\end{tabular} +\end{center}% +}% + + +\newcommand{\QuickOutput}[1]{% +% +\forloop{loopcounter}{1}{\value{loopcounter} < \numexpr #1+1}{% +\pagenumbering{arabic}% -> pagenumber reset to zero , on purpose inside the loop +\ShowNiceCounterOutput{page}{totalpages}{anotherpagescounter}{section}{totalsections}% +\blindtext% +\newpage% some pages +}% +}% + + + +\begin{document} +\regtotcounter{page} % Register a total value counter --> this will be the driver counter +\newtotcounter{totalpages}% 1st driven counter +\newtotcounter{anotherpagescounter}% 2nd driven counter +\newtotcounter{yetanotherpagescounter}% 3rd driven counter + + +\regtotcounter{section}% +\newtotcounter{totalsections} + +\DeclareAssociatedCounters{page}{totalpages,anotherpagescounter}% Register the driver and the driven counters +\DeclareAssociatedCounters{section}{section,totalsections}% Register the driver and the driven counters for sections% +\DeclareAssociatedCounters{page}{yetanotherpagescounter}% Register the driver and the driven counters + + + +\pagenumbering{Roman}% + +\chapter{The first chapter}% + +\section{My first section}% + +% Generate dummy output +\QuickOutput{10}% + + +\section{My second section}% + +\QuickOutput{10}% + +\pagenumbering{arabic}% -> pagenumber reset to zero + +\appendix + +\chapter{First Appendix chapter}% + +\section{My (only) appendix section}% + + +% Generate dummy output, again ;-) +\QuickOutput{10}% + +% Clear the list of counters associated to page +\ClearAssociatedCountersList{page}% + +% Not necessary, only for removing some counters from list +\RemoveAssociatedCounters{page}{totalpages,anotherpagescounter}% +% Readd the counter totalpages to the list --> in this context, +% It acts, as if it has not been removed at all +\DeclareAssociatedCounters{page}{totalpages} + +\QuickOutput{20}% + + + +\end{document}
\ No newline at end of file |