summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/chngcntr
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/chngcntr
Initial commit
Diffstat (limited to 'macros/latex/contrib/chngcntr')
-rw-r--r--macros/latex/contrib/chngcntr/README.md15
-rw-r--r--macros/latex/contrib/chngcntr/chngcntr.pdfbin0 -> 231781 bytes
-rw-r--r--macros/latex/contrib/chngcntr/chngcntr.sty121
-rw-r--r--macros/latex/contrib/chngcntr/chngcntr.tex77
4 files changed, 213 insertions, 0 deletions
diff --git a/macros/latex/contrib/chngcntr/README.md b/macros/latex/contrib/chngcntr/README.md
new file mode 100644
index 0000000000..40e411f7db
--- /dev/null
+++ b/macros/latex/contrib/chngcntr/README.md
@@ -0,0 +1,15 @@
+# chngcntr
+latex chngcntr package
+
+
+Defines commands
+
+
+`\counterwithin` (which sets up a counter to be reset when another is incremented)
+
+and
+
+`\counterwithout` (which unsets such a relationship).
+
+This package is obselete after the 2018 LaTeX relase as the commands are pre-defined
+in the format. \ No newline at end of file
diff --git a/macros/latex/contrib/chngcntr/chngcntr.pdf b/macros/latex/contrib/chngcntr/chngcntr.pdf
new file mode 100644
index 0000000000..f5378ba3ff
--- /dev/null
+++ b/macros/latex/contrib/chngcntr/chngcntr.pdf
Binary files differ
diff --git a/macros/latex/contrib/chngcntr/chngcntr.sty b/macros/latex/contrib/chngcntr/chngcntr.sty
new file mode 100644
index 0000000000..3af1325129
--- /dev/null
+++ b/macros/latex/contrib/chngcntr/chngcntr.sty
@@ -0,0 +1,121 @@
+% chngcntr.sty
+%
+% Provides commands to change the resetting of counters.
+% Instructions for use are at the end of this file.
+%
+% Author: Peter Wilson, Herries Press
+% Maintainer: Will Robertson (will dot robertson at latex-project dot org)
+% Released under the Latex Project Public License
+%
+%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{chngcntr}[2018/04/09 v1.1a change counter resetting]
+
+% version 1.1 this package has been adoped into the format so does not
+% need to do anything in current latex releases.
+
+\@ifundefined{counterwithout}{}{%
+\PackageInfo{chngcntr}{\string\counterwithout\space already defined.\MessageBreak
+Quitting chngcntr}%
+\endinput
+}
+
+
+%
+% This package uses David Carlisle's \@removefromreset command as
+% specified in the remreset package available from CTAN as
+% macros/latex/contrib/supported/carlisle/remreset.sty
+% It is \provided here as a convenience to the user, and with
+% David Carlisle's permission.
+% START OF DAVID CARLISLE'S CODE
+\providecommand{\@removefromreset}[2]{{%
+ \expandafter\let\csname c@#1\endcsname\@removefromreset
+ \def\@elt##1{%
+ \expandafter\ifx\csname c@##1\endcsname\@removefromreset
+ \else
+ \noexpand\@elt{##1}%
+ \fi}%
+ \expandafter\xdef\csname cl@#2\endcsname{%
+ \csname cl@#2\endcsname}}}
+% END OF DAVID CARLISLE'S CODE
+
+%%\@ifbothc@t@s{<package>}{<counter>}{<within>}{<code when both are counters>}
+\newcommand{\@ifbothc@t@s}[4]{%
+ \@ifundefined{c@#2}{% counter undefined
+ \PackageError{#1}{#2 is not a counter}{\@eha}}%
+ {% else counter is defined
+ \@ifundefined{c@#3}{% within undefined
+ \PackageError{#1}{#3 is not a counter}{\@eha}}%
+ {% else both counter and within are defined
+ #4}}}
+
+%%\counterwithout*{<counter>}{<within>}
+\newcommand{\counterwithout}{\@ifstar{\c@t@soutstar}{\c@t@sout}}
+\newcommand{\c@t@soutstar}[2]{%
+ \@ifbothc@t@s{chngcntr}{#1}{#2}{\@removefromreset{#1}{#2}}}
+\newcommand{\c@t@sout}[2]{%
+ \@ifbothc@t@s{chngcntr}{#1}{#2}{\@removefromreset{#1}{#2}%
+ \@namedef{the#1}{\arabic{#1}}}}
+
+
+%%\counterwithin*{<counter>}{<within>}
+\newcommand{\counterwithin}{\@ifstar{\c@t@sinstar}{\c@t@sin}}
+\newcommand{\c@t@sinstar}[2]{%
+ \@ifbothc@t@s{chngcntr}{#1}{#2}{\@addtoreset{#1}{#2}}}
+\newcommand{\c@t@sin}[2]{%
+ \@ifbothc@t@s{chngcntr}{#1}{#2}{\@addtoreset{#1}{#2}%
+ \@namedef{the#1}{\@nameuse{the#2}.\arabic{#1}}}}
+
+
+\endinput
+
+%%%%%%%%%%%%%%%%%%
+% USAGE
+%%%%%%%%%%%%%%%%%%
+%
+% In LaTeX, a new counter called, say `ctr', is created by the command
+% \newcounter{ctr}[within]. If the optional within argument is given
+% the the counter `ctr' is reset to zero each time the counter `within'
+% changes. The command \thectr typesets the value of the counter ctr.
+% This is automatically defined by \newcounter and is initialised
+% to typeset arabic numerals.
+%
+%%%%%%%%%%%%%%%%%
+% \counterwithin
+% \counterwithin*
+%%%%%%%%%%%%%%%%%
+% It is sometimes desireable to change a counter that has been defined
+% by \newcounter{ctr} to act as though it had been defined as
+% \newcounter{ctr}[within]. The package provides the command
+% \counterwithin{ctr}{within} that accomplishes this. By default,
+% it also redefines the \thectr command so that it typesets values
+% in the style \thewithin.\arabic{ctr}. The starred version of the
+% command suppresses the redefinition of \thectr
+% (e.g., \counterwithin*{ctr}{within}).
+%
+%%%%%%%%%%%%%%%%%%
+% \counterwithout
+% \counterwithout*
+%%%%%%%%%%%%%%%%%%
+% Likewise, the command \counterwithout{ctr}{within} changes a
+% counter that has been created by \newcounter{ctr}[within] to act
+% as though it had been created by \newcounter{ctr}. By default it
+% also redefines the \thectr command so that it just typesets an arabic
+% numeral. The starred version of the command suppresses the redefinition
+% of \thectr.
+%
+% Any number of \counterwithin{ctr}{...} and \counterwithout{ctr}{...}
+% commands can be issued for a given counter, ctr, if you wish to toggle
+% between the two styles. The current value of ctr is unaffected by
+% \counterwithin and \counterwithout. If you want to change the value
+% after one of these commands, use \setcounter{ctr}{...}, and to change
+% the typeseting style use \renewcommand{\thectr}{...}.
+%
+%
+% Peter W.
+% 2001/03/30
+%
+% Change History:
+% v1.0a - New maintainer (Will Robertson)
+%
+
diff --git a/macros/latex/contrib/chngcntr/chngcntr.tex b/macros/latex/contrib/chngcntr/chngcntr.tex
new file mode 100644
index 0000000000..76f40d0a63
--- /dev/null
+++ b/macros/latex/contrib/chngcntr/chngcntr.tex
@@ -0,0 +1,77 @@
+\documentclass[DIV=7, pagesize=auto]{scrartcl}
+
+\usepackage{fixltx2e}
+\usepackage{etex}
+\usepackage{lmodern}
+\usepackage[T1]{fontenc}
+\usepackage{textcomp}
+\usepackage{microtype}
+\usepackage[unicode=true]{hyperref}
+
+\newcommand*{\pkg}[1]{\textsf{#1}}
+\newcommand*{\cs}[1]{\texttt{\textbackslash#1}}
+\makeatletter
+\newcommand*{\cmd}[1]{\cs{\expandafter\@gobble\string#1}}
+\makeatother
+\newcommand*{\meta}[1]{\textlangle\textsl{#1}\textrangle}
+\newcommand*{\marg}[1]{\texttt{\{}\meta{#1}\texttt{\}}}
+\newcommand*{\oarg}[1]{\texttt{[}\meta{#1}\texttt{]}}
+\newcommand*{\ml}[1]{\leavevmode\marginline{\small#1}\ignorespaces}
+
+\reversemarginpar
+
+\addtokomafont{title}{\rmfamily}
+
+\title{The \pkg{chngcntr} package\thanks{This manual corresponds to \pkg{chngcntr}~v1.0a, dated~2009/09/02.}}
+\author{Author: Peter Wilson\and Maintainer: Will Robertson}
+\date{2018/04/09}
+
+
+\begin{document}
+
+\maketitle
+
+\section{Usage}
+
+In \LaTeX, a new counter called, say `\meta{ctr}', is created by the command
+\cmd{\newcounter}\marg{ctr}\oarg{within}. If the optional \meta{within} argument is given
+the the counter `\meta{ctr}' is reset to zero each time the counter `\meta{within}'
+changes. The command \cmd{\the\meta{ctr}} typesets the value of the counter \meta{ctr}.
+This is automatically defined by \cmd{\newcounter} and is initialised
+to typeset arabic numerals.
+
+\ml{\cmd{\counterwithin}\\\cmd{\counterwithin*}}
+It is sometimes desireable to change a counter that has been defined
+by \cmd{\newcounter}\marg{ctr} to act as though it had been defined as
+\cmd{\newcounter}\marg{ctr}\oarg{within}. The package provides the command
+\cmd{\counterwithin}\marg{ctr}\marg{within} that accomplishes this. By default,
+it also redefines the \cmd{\the\meta{ctr}} command so that it typesets values
+in the style \texttt{\cmd{\the\meta{within}}.\cmd{\arabic}\marg{ctr}}. The starred version of the
+command suppresses the redefinition of \cmd{\the\meta{ctr}}
+(e.\,g., \cmd{\counter\-within*}\verb+{ctr}{within}+).
+
+\ml{\cmd{\counterwithout}\\\cmd{\counterwithout*}}
+Likewise, the command \cmd{\counterwithout}\marg{ctr}\marg{within} changes a
+counter that has been created by \cmd{\newcounter}\marg{ctr}\oarg{within} to act
+as though it had been created by \cmd{\newcounter}\marg{ctr}. By default it
+also redefines the \cmd{\the\meta{ctr}} command so that it just typesets an arabic
+numeral. The starred version of the command suppresses the redefinition
+of \cmd{\the\meta{ctr}}.
+
+Any number of \cmd{\counterwithin}\marg{ctr}\marg{\ldots} and \cmd{\counterwith\-out}\marg{ctr}\marg{\ldots}
+commands can be issued for a given counter, \meta{ctr}, if you wish to toggle
+between the two styles. The current value of \meta{ctr} is unaffected by
+\cmd{\counterwithin} and \cmd{\counterwithout}. If you want to change the value
+after one of these commands, use \cmd{\set\-counter}\marg{ctr}\marg{\ldots}, and to change
+the typeseting style use \cmd{\renew\-command}\texttt{\{}\cmd{\the\meta{ctr}}\texttt{\}}\marg{\ldots}.
+
+
+\section{Change History:}
+
+\begin{tabular}{@{}l@{ -- }l@{}}
+ v1.0a & New maintainer (Will Robertson)\\
+ v1.1a & The package commands are now defined in the format
+\end{tabular}
+
+\end{document}
+