summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/locality
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-07-10 00:13:23 +0000
committerKarl Berry <karl@freefriends.org>2010-07-10 00:13:23 +0000
commit461dca6fbcc3da74ff8d9851943fdcac56a570dc (patch)
treebfc7e3a1b2c91f4b1743309e9db32be74a7848fa /Master/texmf-dist/tex/latex/locality
parent8ca533f6b861bcaba7ce56d6b638640d5fdfe52b (diff)
new latex package locality (29jun10)
git-svn-id: svn://tug.org/texlive/trunk@19325 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/locality')
-rw-r--r--Master/texmf-dist/tex/latex/locality/locality.sty167
1 files changed, 167 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/locality/locality.sty b/Master/texmf-dist/tex/latex/locality/locality.sty
new file mode 100644
index 00000000000..a674c1a8e98
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/locality/locality.sty
@@ -0,0 +1,167 @@
+%%
+%% This is file `locality.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% locality.dtx (with options: `package')
+%%
+%% This is a generated file.
+%%
+%% Copyright (C) 2010 by Jason Gross
+%%
+%% This file may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.2 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.2 or later is part of all distributions of
+%% LaTeX version 1999/12/01 or later.
+\NeedsTeXFormat{LaTeX2e}[1999/12/01]
+\ProvidesPackage{locality}
+ [2010/06/29 v0.1 Various macros for keeping things local]
+\def\@nil{\@nil\relax} % this way, I'll know if I've messed up; I'll get
+\def\if@nil#1{\@if@nil#1\@@nil}
+\def\@if@nil#1#2\@@nil{\ifx\@nil#1}
+\newcount\locality@global@non@collision@unique@count
+\locality@global@non@collision@unique@count=0
+\long\def\@manyaftergroup#1{\ifx#1\@nil \else \aftergroup#1
+\expandafter\@manyaftergroup\fi}
+\newcommand{\manyaftergroup}[1]{\@manyaftergroup#1\@nil}
+\newcommand{\locallydefine}[2]{{#2\expandafter}%
+ \expandafter\def\expandafter#1\expandafter{#1}}
+\let\@old@begingroup=\begingroup
+\let\@old@endgroup=\endgroup
+\newcommand{\DeclareNonlocalMacro}[1]{\expandafter\let
+ \csname endgroup \the\locality@local@group@non@local@macro@count
+ \endcsname=\endgroup
+ \expandafter\def\expandafter\endgroup\expandafter{%
+ \expandafter\expandafter\expandafter\let\expandafter
+ \expandafter\expandafter\endgroup\expandafter\expandafter
+ \csname endgroup \the\locality@local@group@non@local@macro@count
+ \endcsname\expandafter\endgroup
+ \expandafter\def\expandafter#1\expandafter{#1}}%
+ \advance\locality@local@group@non@local@macro@count by 1
+}%
+\newcommand{\DeclareNonlocalCount}[1]{\expandafter\let
+ \csname endgroup \the\locality@local@group@non@local@macro@count
+ \endcsname=\endgroup
+ \expandafter\def\expandafter\endgroup\expandafter{%
+ \expandafter\expandafter\expandafter\let
+ \expandafter\expandafter\expandafter\endgroup
+ \expandafter\expandafter
+ \csname endgroup \the\locality@local@group@non@local@macro@count
+ \endcsname\expandafter\endgroup
+ \expandafter#1\expandafter=\the#1 }% Note the space. This is to
+ \advance\locality@local@group@non@local@macro@count by 1
+}%
+\let\DeclareNonlocalLength=\DeclareNonlocalCount
+\newcommand{\DeclareNonlocalToks}[1]{\expandafter\let
+ \csname endgroup \the\locality@local@group@non@local@macro@count
+ \endcsname=\endgroup
+ \expandafter\def\expandafter\endgroup\expandafter{%
+ \expandafter\expandafter\expandafter\let\expandafter\expandafter
+ \expandafter\endgroup\expandafter\expandafter
+ \csname endgroup \the\locality@local@group@non@local@macro@count'
+ \endcsname\expandafter\endgroup
+ \expandafter#1\expandafter=\expandafter{\the#1}}%
+ \advance\locality@local@group@non@local@macro@count by 1
+}%
+\newcount\locality@local@group@non@local@macro@count % Hopefully, this
+\def\begingroup{\@old@begingroup
+ \let\endgroup=\@old@endgroup
+ \locality@local@group@non@local@macro@count=0
+}
+\def\@savevalues#1{\ifx#1\@nil \else \expandafter\let
+ \csname @\string#1\space backup\endcsname=#1
+ \expandafter\@savevalues\fi}
+\newcommand{\savevalues}[1]{\@savevalues#1\@nil}
+
+\def\@restorevalues#1{%
+\ifx
+ #1\@nil
+\else
+ \expandafter\let\expandafter#1\expandafter
+ =\csname @\string#1\space backup\endcsname
+ \expandafter
+ \let\csname @\string#1\space backup\endcsname
+ =\relax
+ \expandafter\@restorevalues
+\fi
+}
+\newcommand{\restorevalues}[1]{\@restorevalues#1\@nil}
+\newcommand{\makecommandslocal}[2]{\savevalues{#1}#2\restorevalues{#1}}
+\savevalues{\global\gdef\xdef\@cons}
+{\def\begingroup{\begingroup\DeclareNonlocalMacro{##1}}%
+\expandafter\expandafter\expandafter}%
+\expandafter\expandafter\expandafter\def
+\expandafter\expandafter\expandafter\locality@cons
+\expandafter\expandafter\expandafter#%
+\expandafter\expandafter\expandafter1%
+\expandafter\expandafter\expandafter#%
+\expandafter\expandafter\expandafter2%
+\expandafter\expandafter\expandafter{\@cons{#1}{#2}}%
+\newcommand{\obeyglobal}{\restorevalues{\globabl\gdef\xdef\@cons}}
+\let\unignoreglobal=\obeyglobal
+\newcommand{\ignoreglobal}{%
+\let\global=\relax\let\gdef=\def\let\xdef=\edef
+\let\@cons=\locality@cons
+\expandafter\def\expandafter\unignoreglobal\expandafter{\expandafter
+\def\expandafter\unignoreglobal\expandafter{\unignoreglobal}%
+ \unignoreglobal}}
+\newcommand{\makecounterslocal}{% FIX, to make more robust
+ \expandafter\def\expandafter\stepcounter
+ \expandafter##\expandafter1\expandafter{%
+ \expandafter\ignoreglobal\stepcounter{##1}%
+ \unignoreglobal
+ }%
+ %
+ \expandafter\def\expandafter\refstepcounter
+ \expandafter##\expandafter1\expandafter{%
+ \expandafter\ignoreglobal\refstepcounter{##1}%
+ \unignoreglobal
+ }%
+ %
+ \expandafter\def\expandafter\setcounter
+ \expandafter##\expandafter1%
+ \expandafter##\expandafter2\expandafter{%
+ \expandafter\ignoreglobal\setcounter{##1}{##2}%
+ \unignoreglobal
+ }%
+ %
+ \expandafter\def\expandafter\addtocounter
+ \expandafter##\expandafter1%
+ \expandafter##\expandafter2\expandafter{%
+ \expandafter\ignoreglobal\addtocounter{##1}{##2}%
+ \unignoreglobal
+ }%
+ %
+ \expandafter\def\expandafter\@addtoreset
+ \expandafter##\expandafter1%
+ \expandafter##\expandafter2\expandafter{%
+ \expandafter\ignoreglobal\@addtoreset{##1}{##2}%
+ \unignoreglobal
+ }%
+ %
+ \expandafter\def\expandafter\@definecounter
+ \expandafter##\expandafter1\expandafter{%
+ \expandafter\ignoreglobal\@definecounter{##1}%
+ \unignoreglobal
+ }%
+ \@ifpackageloaded{amstext}{%
+ \expandafter\def\expandafter\stepcounter
+ \expandafter##\expandafter1\expandafter{%
+ \expandafter\iffirstchoice@\stepcounter{##1}\fi
+ }
+ \expandafter\def\expandafter\addtocounter
+ \expandafter##\expandafter1%
+ \expandafter##\expandafter2\expandafter{%
+ \expandafter\iffirstchoice@\addtocounter{##1}{##2}\fi
+ }
+ }{}
+}
+\endinput
+%%
+%% End of file `locality.sty'.