summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-03-30 23:19:24 +0000
committerKarl Berry <karl@freefriends.org>2008-03-30 23:19:24 +0000
commit15c3636372419100306039c936173e07445cff51 (patch)
treed06017253375576e3cf811a6f955fb022995f634 /Master/texmf-dist/tex/latex
parent51b494961c4ad3ca60e567bf2faec44e3ffc17f8 (diff)
new latex package constants (30mar08)
git-svn-id: svn://tug.org/texlive/trunk@7248 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/constants/constants.sty173
1 files changed, 173 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/constants/constants.sty b/Master/texmf-dist/tex/latex/constants/constants.sty
new file mode 100644
index 00000000000..d4ee664be28
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/constants/constants.sty
@@ -0,0 +1,173 @@
+%%
+%% This is file `constants.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% constants.dtx (with options: `package')
+%% ----------------------------------------------------------------
+%% The constants package --- Automatic labelling of constants
+%% Maintained by Antoine Lejay
+%% Based on ltxref.dtx of the Latex Kernel (Copyright the LaTeX 3 project).
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{constants}%
+ [2008/03/25 v.1 Labeling and numbering constants]
+\PackageInfo{constants}
+ {This package aims to label et number constants in a mathematical proof.}
+\RequirePackage{keyval}
+\def\@if@constant@exists#1#2#3{\@ifundefined{cst@family@#1}{#3}{#2}}
+\global\@namedef{cst@family@normal}{}
+\newcounter{cst@counter@normal}
+\def\cst@format@normal#1{\arabic{#1}}
+\def\cst@symbol@normal{C}
+\newcommand{\newconstantfamily}[2]{
+\@if@constant@exists{#1}{%
+\PackageError{constants}{The family of constants '#1' already exists}{%
+Use \protect\renewconstantfamily\space to override}}%
+{%
+\expandafter\def\csname cst@family@#1\endcsname{}
+\expandafter\def\csname cst@format@#1\endcsname{\cst@format@normal}
+\expandafter\def\csname cst@symbol@#1\endcsname{\cst@symbol@normal}
+\expandafter\newcounter{cst@counter@#1}
+\define@key{constants}{format}%
+{\expandafter\def\csname cst@format@#1\endcsname{##1}}
+\define@key{constants}{symbol}%
+{\expandafter\def\csname cst@symbol@#1\endcsname{##1}}
+\define@key{constants}{reset}{\@addtoreset{cst@counter@#1}{##1}}
+\setkeys{constants}{#2}
+}}
+\newcommand{\renewconstantfamily}[2]{
+\@if@constant@exists{#1}{
+\define@key{constants}{format}{%
+\expandafter\def\csname cst@format@#1\endcsname{##1}}
+\define@key{constants}{symbol}{%
+\expandafter\def\csname cst@symbol@#1\endcsname{##1}}
+\define@key{constants}{reset}{\@addtoreset{cst@counter@#1}{##1}}
+\setkeys{constants}{#2}
+}{%
+\PackageError{constants}{The family of constants '#1' already exists}{%
+Use \protect\renewconstantfamily\space to override}}%
+}
+\@onlypreamble\newconstantfamily
+\@onlypreamble\renewconstantfamily
+\def\G@refundefinedconstanttrue{%
+ \gdef\@refundefinedconstant{%
+ \@latex@warning@no@line{%
+There were undefined references to constants}}}
+\let\@refundefinedconstant\relax
+\def\cst@tmp@format{cst@undefined@format}
+\def\cst@tmp@symbol{cst@undefined@symbol}
+\long\def\@firstofthree#1#2#3{#1}
+\long\def\@secondofthree#1#2#3{#2}
+\long\def\@thirdofthree#1#2#3{#3}
+\def\cst@undefined@format#1{}
+\def\cst@undefined@symbol{%
+\nfss@text{\reset@font\textrm{C\textsuperscript{st}\textbf{??}}}}
+\def\@setrefconstant#1#2#3{%
+ \ifx#1\relax
+ \protect\G@refundefinedconstanttrue
+ \nfss@text{\reset@font\bfseries ??}%
+ \@latex@warning{Reference to constant `#3' on page \thepage \space
+ undefined}%
+ \else
+ \expandafter#2#1\null
+ \fi}
+\def\@setfamconstant#1#2#3{%
+\ifx#1\relax%
+\def\cst@tmp@format{cst@undefined@format}\null
+\def\cst@tmp@symbol{cst@undefined@symbol}\null
+\else%
+\def\cst@tmp@format{cst@format@\expandafter#2#1}\null
+\def\cst@tmp@symbol{cst@symbol@\expandafter#2#1}\null
+\fi}
+\newcounter{cst@tmp@counter}
+\def\@setcounterconstant#1#2#3{%
+ \ifx#1\relax
+ \protect\G@refundefinedconstanttrue
+ \@latex@warning{Reference to constant `#3' on page \thepage \space
+ undefined}%
+ \else
+ \setcounter{cst@tmp@counter}{\expandafter#2#1}\null
+\fi}
+\def\refconstant#1{%
+\expandafter\@setrefconstant\csname cstr@#1\endcsname\@firstofthree{#1}}
+\def\familyconstant#1{%
+\expandafter\@setfamconstant\csname cstr@#1\endcsname\@thirdofthree{#1}}
+\def\counterconstant#1{%
+\expandafter\@setcounterconstant%
+\csname cstr@#1\endcsname\@firstofthree{#1}}
+\newcommand{\Cr}[1]{%
+\counterconstant{#1}%
+\familyconstant{#1}%
+{\@nameuse{\cst@tmp@symbol}}_{\@nameuse{\cst@tmp@format}{cst@tmp@counter}}}
+\newcommand{\C}[1][normal]{%
+\@if@constant@exists{#1}{%
+\expandafter\refstepcounterconstant{cst@counter@#1}%
+{\@nameuse{cst@symbol@#1}}_{\@nameuse{cst@format@#1}{cst@counter@#1}}}%
+{\PackageError{constants}{Family for constants '#1' not defined}{
+Check the name or use \protect\newconstantfamily}}%
+}
+\newcommand{\Cl}[2][normal]{\C[#1]\labelconstant{#2}{\string #1}}
+\def\pagerefconstant#1{%
+\expandafter\@setrefconstant\csname cstr@#1\endcsname
+ \@secondofthree{#1}}
+\def\refstepcounterconstant#1{\stepcounter{#1}%
+ \protected@edef\@currentlabelconstant
+ {\csname p@#1\endcsname\csname the#1\endcsname}%
+}
+\def\@newl@belconstant#1#2#3{{%
+ \@ifundefined{#1@#2}%
+ \relax
+ {\gdef \@multiplelabelsconstant {%
+ \@latex@warning@no@line{%
+There were multiply-defined labels for constants}}%
+ \@latex@warning@no@line{Label for constant `#2' multiply defined}}%
+ \global\@namedef{#1@#2}{#3}
+}}
+\def\@currentlabelconstant{}
+\def\newlabelconstant{\@newl@belconstant{cstr}}
+\@onlypreamble\@newl@belconstant
+\let \@multiplelabelsconstant \relax
+\def\labelconstant#1#2{\@bsphack
+ \protected@write\@auxout{}%
+ {\string\newlabelconstant{#1}{{\@currentlabelconstant}{\thepage}{#2}}}%
+ \@esphack}
+\AtEndDocument{
+\clearpage
+\let\@newl@belconstant\@empty
+\begingroup
+ \if@filesw
+ \immediate\closeout\@mainaux
+ \let\@setckpt\@gobbletwo
+ \let\@newl@belconstant\@testdef
+ \let\@newl@bel\@testdef
+ \@tempswafalse
+ \makeatletter \input\jobname.aux
+ \fi
+\@refundefinedconstant
+ \if@filesw
+ \ifx \@multiplelabelsconstant \relax
+ \if@tempswa
+ \@latex@warning@no@line{%
+Label(s) for constants may have changed.
+ Rerun to get cross-references right}%
+ \fi
+ \else
+ \@multiplelabelsconstant
+ \fi
+ \fi
+\endgroup
+\deadcycles\z@\@@end
+}
+\newcommand{\resetconstant}[1][normal]{%
+\@if@constant@exists{#1}{%
+\setcounter{cst@counter@#1}{0}}{%
+{\PackageError{constants}{Family for constants '#1' not defined}{%
+Check the name or use \protect\newconstantfamily}}%
+}}
+\endinput
+%%
+%% End of file `constants.sty'.