diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex')
-rw-r--r-- | Master/texmf-dist/doc/latex/assoccnt/README | 39 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/assoccnt/assoccnt_example.pdf | bin | 0 -> 97388 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/assoccnt/assoccnt_example.tex | 97 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/assoccnt/assoccntdoc.pdf | bin | 0 -> 171849 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/assoccnt/assoccntdoc.tex | 277 |
5 files changed, 413 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/assoccnt/README b/Master/texmf-dist/doc/latex/assoccnt/README new file mode 100644 index 00000000000..dc2c1117648 --- /dev/null +++ b/Master/texmf-dist/doc/latex/assoccnt/README @@ -0,0 +1,39 @@ +%% LaTeX package assoccnt - version 0.2 (2014/08/13) +%% +%% ------------------------------------------------------------------------------------------- +%% Copyright (c) 2014 by Dr. Christian Hupfer <christian dot hupfer at siebenfelsen dot de> +%% ------------------------------------------------------------------------------------------- +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `author-maintained'. +%% +%% This work consists of all files listed in README +%% + +The package assoccnt provides a way of associating counters to an +existing driver counter, such incrementing the driver counter will increase +the associated counters as well. This package can be regarded as a supplement +to the totcount package by Vasileios Koutavas (http://www.ctan.org/pkg/totcount), but +can be used without it too. + +Further improvements will follow + +Directory listing: + + assoccntdoc.pdf 171849 08/13/14 18:50:12 + assoccntdoc.tex 9313 08/13/14 18:50:09 +assoccnt_example.pdf 97388 08/11/14 16:15:40 +assoccnt_example.tex 2687 08/11/14 14:01:03 + assoccnt.sty 4907 08/13/14 22:58:31 + +Installation: + +Unpack assoccnt.zip to your local Tex distribution tree. + diff --git a/Master/texmf-dist/doc/latex/assoccnt/assoccnt_example.pdf b/Master/texmf-dist/doc/latex/assoccnt/assoccnt_example.pdf Binary files differnew file mode 100644 index 00000000000..af901043e68 --- /dev/null +++ b/Master/texmf-dist/doc/latex/assoccnt/assoccnt_example.pdf 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 diff --git a/Master/texmf-dist/doc/latex/assoccnt/assoccntdoc.pdf b/Master/texmf-dist/doc/latex/assoccnt/assoccntdoc.pdf Binary files differnew file mode 100644 index 00000000000..ce125147dcc --- /dev/null +++ b/Master/texmf-dist/doc/latex/assoccnt/assoccntdoc.pdf diff --git a/Master/texmf-dist/doc/latex/assoccnt/assoccntdoc.tex b/Master/texmf-dist/doc/latex/assoccnt/assoccntdoc.tex new file mode 100644 index 00000000000..d0a78675538 --- /dev/null +++ b/Master/texmf-dist/doc/latex/assoccnt/assoccntdoc.tex @@ -0,0 +1,277 @@ +\documentclass[12pt,paper=a4]{ltxdoc} + +\usepackage[lmargin=2cm,rmargin=2cm]{geometry} +\usepackage{totcount}% +\usepackage{assoccnt}% +\usepackage{blindtext}% +\usepackage{xcolor} +\usepackage{imakeidx}% +\usepackage{tcolorbox} +\usepackage{datetime}% +\usepackage{scrpage2}% +\tcbuselibrary{listings}% +\tcbuselibrary{documentation}% + +\usepackage{array}% +\usepackage{amsmath}% +\usepackage{amsthm}% + + +\newcommand{\MarkupPackageName}[2][lightgray]{% +\colorbox{#1}{\textcolor{black}{#2}}% +}% + +\newcommand{\MarkupMacroName}[2][cyan]{% +\colorbox{#1}{\(\backslash\)\textcolor{black}{#2}}% +}% + +\newcommand{\MarkupCounterName}[2][yellow]{% +\colorbox{#1}{\textcolor{black}{\texttt{#2}}}% +}% + +\def\packageversion{0.2}% + +\makeindex + +\newcommand{\PackageDocName}{assoccnt.sty}% + +\begin{document} +\mmddyyyydate + + +\setlength{\parindent}{0pt} +\newtotcounter{totalpages}% +\newtotcounter{anothertotalpages}% + +\newtotcounter{totalproofs}% +\newtotcounter{totalsections}% + +\DeclareAssociatedCounters{section}{totalsections}% +\DeclareAssociatedCounters{proof}{totalproofs} + + +\DeclareAssociatedCounters{page}{anothertotalpages,totalpages} + +\thispagestyle{empty}% + +\begin{center} +\begin{tcolorbox}[colback=yellow!30!white,width=0.8\textwidth] +\large \bfseries% +\begin{center}% +\begin{tabular}{c}% +\textsc{\PackageDocName} \tabularnewline +\tabularnewline +Associate counters stepping simultaneously \tabularnewline +\tabularnewline +Version \packageversion \tabularnewline +\tabularnewline +\today \tabularnewline +\tabularnewline +Author: Christian Hupfer\footnote{\makeatletter christian.hupfer@siebenfelsen.de} +\tabularnewline +\end{tabular} +\end{center} + +\end{tcolorbox} + + +\end{center} + +\tableofcontents +\clearpage + + + +\pagestyle{scrheadings}% +\setheadsepline{2pt}[\color{blue}] + + +\section{Introduction} + +The aim of this package is to provide some additional support for example for a package like \MarkupPackageName{totcount}. + +For example, the total number of pages in a document could be achieved by using + +\begin{dispExample}% +\regtotcounter{page} +... +The number of pages in the document is \number\totvalue{page} page(s). +\end{dispExample}% + +This will work, as long there is no reset of the page counter, as it might happen in the case of \cs{setcounter} or \cs{pagenumbering} being applied in the document. The result is a false page counter total value. + +This package provides associate counters, i.e. counters that are increased simultaneously with a driver counter and are not influenced by a a resetting of the driver counter, as long as not being added to the reset list by definition of the counter or explicitly by \cs{@addtoreset}. + +This package defines some macros to handle associated counters. The only interception to the standard behaviour is within the redefined commands \cs{stepcounter} and \cs{refstepcounter}. The usual commands still work, as there is code added to their definition. + +Internally, the associated counters are stored in one list per counter -- it is not recommended to operate on those lists directly. + + + +\section{Documentation of Macros} +\tcbset{color command={blue}} +All macros have the general rule, that the driver counter is specified as 1st argument to the macro. + +\begin{docCommand}{DeclareAssociatedCounters}{\marg{driver counter}\marg{associated counters list}} +This command is the main macro of the package. It declares the counter names being specified in comma - separated - list (CSV) which should be stepped simultaneously when the driver counter is increased by \cs{stepcounter}. + + +Note, that this command should be used as early as possible, i.e. in the preamble of the document, since the driven counters are not increased as long as they are not associated to the driver counter. On the hand, it is possible, to control the starting point of the association at any position in the body of the document, when the association should start later on. + +\begin{dispExample} +%%%% The association of anothertotalpages in this example just takes place here, so the stepping of the counter will start from here and providing a 'wrong' value. +%%%% +\DeclareAssociatedCounters{page}{totalpages,anothertotalpages} +This document has \number\totvalue{totalpages} (note: \number\totvalue{anothertotalpages}) pages. +\end{dispExample} + + + +\begin{itemize} + \item Current version state: + \begin{itemize} + \item No checking whether the 1st and 2nd arguments hold counter names is applied. + \item No check is done whether two (or more) associated counters are mutually associated. + \end{itemize} + \item A self-association of the driver counter to itself is ignored internally as this would lead to inconsistent counter values. + \item The order of the specification of associated counters in the 2nd arguments is of no importance. + \item Specifing an associated counter name multiple times has no effect, only the first occurence of the name will be used. +\end{itemize} + +\end{docCommand} + + +\begin{docCommand}{RemoveAssociatedCounter}{\marg{driver counter}\marg{associated counter}} +This command removes a counter from the existing list for a driver counter, i.e. the counter will not be increased any longer by \cs{stepcounter}. It can be increased however manually, of course. +\end{docCommand} + +\begin{dispExample} +\RemoveAssociatedCounter{page}{anothertotalpages} +This document has \number\totvalue{totalpages} (beware: \number\totvalue{anothertotalpages}) pages. +\end{dispExample} + + + +\begin{docCommand}{RemoveAssociatedCounters}{\marg{driver counter}\marg{list of associated counters}} +This command removes the comma-separated-value list of counters from the existing list for a driver counter, i.e. the counters will not be increased any longer by \cs{stepcounter}. They can be increased however manually, of course. + +Take care not to confuse the commands \refCom{RemoveAssociatedCounters} +and{}\linebreak \refCom{RemoveAssociatedCounter} +\end{docCommand} + +\begin{docCommand}{ClearAssociatedCounters}{\marg{driver counter}} +This command clears the internal list for all counters associated to the \marg{driver counter}. The counters will not be increased automatically. +\end{docCommand} + +\begin{docCommand}{IfIsAssociatedCounter}{\marg{driver counter}\marg{associated counter}\marg{True branch}\marg{False branch}} +This macro checks, whether a counter is associated to the driver counter and expands the corresponding branch. If the internal driver counter list does not exist, the false branch will be used, since this also means, that the possibly associated counter is not associated at all. + +\begin{dispExample} +% Remove associated counter first for demonstration purposes +\RemoveAssociatedCounter{page}{anothertotalpages} +\IfIsAssociatedCounter{page}{totalpages}{Yes, totalpages is associated}{No, totalpages is not associated} + +\IfIsAssociatedCounter{page}{anothertotalpages}{Yes, anothertotalpages is associated}{No, anotherpages is not associated} +\end{dispExample} +\end{docCommand} + +\clearpage + + +\section{To do list} + +\begin{itemize} +\item Check the existence of driver and associated counters +\item Improve documentation +\end{itemize} + +\clearpage + + + +\section{Acknowledgments} + +I would like to express my gratitudes to the developpers of fine \LaTeX{} packages and of course +to the users at tex.stackexchange.com, especially to + +\begin{itemize} + \item Enrico Gregorio + \item Joseph Wright + \item David Carlisle + \item Werner +\end{itemize} + +for their invaluable help on many questions on macros. + +\vspace{2\baselineskip} +A special gratitude goes to Prof. Dr. Dr. Thomas Sturm for providing the wonderful \MarkupPackageName{tcolorbox} package which was used to +write this documentation. + +\clearpage + +\appendix +\section{Example: Total number of sections} +In this example, all sections of this document are counted, i.e. the current one as well as all following ones. +\begin{dispExample} +\DeclareAssociatedCounters{section}{totalsections}% +This document has \number\totvalue{totalsections} section(s)% +\end{dispExample} + + +\section{Example: Total number of subsections with suspension} + +In this example, the subsections of this document are counted but later on, the associatedcounter is removed from the list, so it is frozen. + +\begin{dispExample} +\newtotcounter{totalsubsections}% +\DeclareAssociatedCounters{subsection}{totalsubsections}% + +\subsection{First dummy subsection} +SubSection counter: \thesubsection~-- \number\totvalue{totalsubsections} +\subsection{Second dummy subsection} +SubSection counter: \thesubsection~-- \number\totvalue{totalsubsections} + +\RemoveAssociatedCounter{subsection}{totalsubsections} + +\subsection{Third dummy subsection after removing the associated counter} +SubSection counter: \thesubsection~-- \number\totvalue{totalsubsections} +\end{dispExample} + + + +\section{Example: Total number of proofs} + + +\begin{dispExample} +% \usepackage{amsthm} is needed +\newcounter{proof}% +\newtheorem{Proof}[proof]{Proof}% +\DeclareAssociatedCounters{proof}{totalproofs} +\begin{Proof} +It's trivial. +\end{Proof} + +\begin{Proof}[On Brontosaurs] +See excavations! +\end{Proof} + +%%% Manipulate the counter +\setcounter{proof}{17} + +\begin{Proof}[Yet another proof] +\begin{align*} + E &= m c^2 + \end{align*} +\end{Proof} + +This document has \number\totvalue{totalproofs} proofs % + +\end{dispExample} + +\clearpage + +%%%% Index of commands + +\printindex + +\end{document}
\ No newline at end of file |