diff options
author | Karl Berry <karl@freefriends.org> | 2014-09-04 21:10:23 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-09-04 21:10:23 +0000 |
commit | 23550e4b6a7407977d39f6339f6f9fe2db2ba99e (patch) | |
tree | d617006b38f0e36523c53b14219500d24f8ef939 /Master/texmf-dist/doc/latex/assoccnt/assoccnt_example.tex | |
parent | 44619feacee76d2abea54c66454f19077701adbc (diff) |
assoccnt (4sep14)
git-svn-id: svn://tug.org/texlive/trunk@35106 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/assoccnt/assoccnt_example.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/assoccnt/assoccnt_example.tex | 108 |
1 files changed, 81 insertions, 27 deletions
diff --git a/Master/texmf-dist/doc/latex/assoccnt/assoccnt_example.tex b/Master/texmf-dist/doc/latex/assoccnt/assoccnt_example.tex index 8d58612b262..462ed9f7d08 100644 --- a/Master/texmf-dist/doc/latex/assoccnt/assoccnt_example.tex +++ b/Master/texmf-dist/doc/latex/assoccnt/assoccnt_example.tex @@ -23,20 +23,25 @@ + \newcounter{loopcounter}% -\newcommand{\ShowNiceCounterOutput}[5]{% +\newcommand{\QuickSections}[2]{% +\forloop{loopcounter}{1}{\value{loopcounter} < \numexpr #1+1}{% +\csuse{#2}{Dummy #2 -- \theloopcounter} +}% +}% + +\newcommand{\ShowNiceCounterOutput}[6]{% \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\value{#2}} & \textcolor{gray}{\number\value{#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 +\begin{tabular}{lllll}% +& & & & \tabularnewline +& \multicolumn{4}{c}{totcount page values} \tabularnewline +Page & \textcolor{red}{#1} & \textcolor{blue}{#2} & \textcolor{gray}{#3} & \textcolor{violet}{#4}\tabularnewline +\thepage & \textcolor{red}{\number\totvalue{#1}} & \textcolor{blue}{\number\value{#2}} & \textcolor{gray}{\number\value{#3}} & \textcolor{violet}{\number\totvalue{#4}} \tabularnewline +Section & \textcolor{red}{#5} & Subsection & \textcolor{blue}{#6} & \tabularnewline% +\thesection & \textcolor{red}{\number\totvalue{#5}} & \thesubsection & \textcolor{blue}{\number\totvalue{#6}} & \tabularnewline +& & & & \tabularnewline \end{tabular} \end{center}% }% @@ -46,62 +51,111 @@ Page & \textcolor{red}{#1} & \textcolor{blue}{#2} & \textcolor{gray}{#3} \tabula % \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}% +\ShowNiceCounterOutput{page}{associatedpages}{anotherpagescounter}{yetanotherpagescounter}{associatedsections}{associatedsubsections}% \blindtext% \newpage% some pages }% }% -\newcounter{totalpages} -\newtotcounter{totalsections}% + + +\newcounter{associatedpages}% \newcounter{anotherpagescounter}% \regtotcounter{page} % Register a total value counter --> this will be the driver counter \newtotcounter{yetanotherpagescounter}% 3rd driven counter +\newtotcounter{associatedsections}% + +\newtotcounter{associatedsubsections}% -\DeclareAssociatedCounters{page}{totalpages,anotherpagescounter,totalpages}% Register the driver and the driven counters -\DeclareAssociatedCounters{totalpages}{anotherpagescounter}% Register the driver and the driven counters -\DeclareAssociatedCounters{section}{totalsections}% +\DeclareAssociatedCounters{page}{associatedpages,anotherpagescounter,associatedpages,yetanotherpagescounter}% Register the driver and the driven counters +\DeclareAssociatedCounters{section}{associatedsections}% +\DeclareAssociatedCounters{subsection}{associatedsubsections}% + \begin{document} \tableofcontents% +\chapter*{Introduction} + +This is a dummy document -- it just shows how some of the commands work. +In section \ref{section::query} same queries and statistics are shown. \chapter{Chapter one} \section{First} +\QuickSections{10}{subsection}% + + +\QuickOutput{10} +% Suspend the associatedsubsections counters% +\typeout{Hello!} +\SuspendCounters{associatedsubsections,associatedpages}% \QuickOutput{10} +\clearpage + +\subsection[Suspended counters checking]{Checking for suspended counters} + +\IsSuspendedCounter{associatedsubsections}{Yes, Counter associatedsubsections is suspended}{No!} + +\IsSuspendedCounter{yetanothertotalpages}{Yes}{No!} -\section{Query routines}% +\clearpage + +\section{Dummy section}% + +\QuickSections{10}{subsection}% + +% Resume all counters +\ResumeSuspendedCounters +\QuickSections{20}{subsection}% + + + +\clearpage + +\section{Query routines} \label{section::query}% +\setlength{\parindent}{0pt}% \IsAssociatedCounter{totalsections}{Yes, it's associated}{Nope, it's not associated} \IsAssociatedCounter{anotherpagescounter}{Yes, it's associated}{Nope, it's not associated} -\AssociationStatistics% +\hrule\par + +Setting counter section explicitly to another value: + +\setcounter{section}{12}% + +\hrule\par + +Setting counter section explicitly to another value with option enabled: + +\setcounter[AssociatedCounters={associatedpages,anotherpagescounter,gandalf}]{page}{20}% + + + +\AssociatedDriverCounterInfo{page}% -\IsDriverCounter{section}{Yes, it's a driver counter}{No, it does not have this feature}% +\AssociatedDriverCounterInfo{associatedpages}% -\ClearAssociatedCountersList{section} +\AssociatedDriverCounterInfo{section}% -\IsDriverCounter{section}{Yes, it's a driver counter}{No, it does not have this feature}% +\AddAssociatedCounters{page}{associatedpages}% +\AddAssociatedCounters{page}{associatedpages}% -\AssociationStatistics% -Clearing the counters: +Clearing the counters (This will report wrong values for the associated counters!!!) -\ClearDriverCountersList -Show Statistics% -\AssociationStatistics% \end{document} |