summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-04-27 22:20:47 +0000
committerKarl Berry <karl@freefriends.org>2013-04-27 22:20:47 +0000
commit38b404935da1517d414a99cb996804cb778fa887 (patch)
tree1c3ae2fd631c7b481c4ac4affc2da08cae7c5641 /Master
parente05eb05519cff9def907a8814719ceb03b443de3 (diff)
noconflict (27apr13)
git-svn-id: svn://tug.org/texlive/trunk@30140 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/noconflict/README65
-rw-r--r--Master/texmf-dist/tex/latex/noconflict/noconflict.sty154
-rwxr-xr-xMaster/tlpkg/bin/tlpkg-ctan-check2
-rw-r--r--Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc1
-rw-r--r--Master/tlpkg/tlpsrc/noconflict.tlpsrc0
5 files changed, 221 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/noconflict/README b/Master/texmf-dist/doc/latex/noconflict/README
new file mode 100644
index 00000000000..9614d8721e9
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/noconflict/README
@@ -0,0 +1,65 @@
+
+Conflict Resolver <noconflict.sty>
+Resolves Macro Name Conflict among Packages
+Copyright 2013 M. Zahid Hossain
+
+This package resolves macro name conflict among packages with concise
+approaches and user-friendly syntaxes.
+
+This program 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.
+
+A macro name can be defined by many packages. In LaTeX, macro name need
+to be unique for a document and thus using the packages with same macro
+name causes conflict among them. In order to avoid macro name conflict
+this package defines several commands to save, restore and rename macros
+defined by other packages.
+
+PACKAGE COMMANDS
+================
+
+\prefix{<prefix added to the macro name>}
+\save{<prefix added to the macro name>}
+ {<comma separated list of macro name>}
+\save*{<comma separated list of macro name>}
+\restore{<prefix added to the macro name>}
+\restore*
+\reinstate{<prefix added to the macro name>}
+ {<comma separated partial list of macro name>}
+\rename{<old name>}{<new name>}
+
+
+USAGE EXAMPLE
+=============
+
+If package A, B and C define three macro names X, Y and Z. To avoid macro
+name conflict:
+
+\usepackage{noconflict}
+\usepackage{A}
+\prefix{First} is optional
+\save{X,Y,Z}
+
+\usepackage{B}
+\save{Second}{X,Y,Z}
+The above line can also be written as: \prefix{Second} and \save*{X,Y,Z}
+
+\usepackage{C}
+\save{Third}{X,Y,Z}
+
+Now macro X, Y and Z of
+Package A: \FirstX, \FirstY, \FirstZ
+Package B: \SecondX, \SecondY, \SecondZ
+Package C: \ThirdX, \ThirdY, \ThirdZ
+
+\restore{First}
+Macros \FirstX, \FirstY and \FirstZ become \X, \Y and \Z
+\restore{Second}
+The above line can also be written as: \prefix{Second} and \restore*
+The above line can also be written as: \reinstate{Second}{X,Y,Z}
+Macros \SecondX, \SecondY and \SecondZ become \X, \Y and \Z
+\restore{Third}
+Macros \ThirdX, \ThirdY and \ThirdZ become \X, \Y and \Z
+\rename{X}{CofX}
+Macro \X becomes \CofX \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/noconflict/noconflict.sty b/Master/texmf-dist/tex/latex/noconflict/noconflict.sty
new file mode 100644
index 00000000000..a99bbf97f77
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/noconflict/noconflict.sty
@@ -0,0 +1,154 @@
+% Conflict Resolver <noconflict.sty>
+% Resolves Macro Name Conflict among Packages
+% Copyright 2013 M. Zahid Hossain
+%
+% This package resolves macro name conflict among packages with concise
+% approaches and user-friendly syntaxes.
+%
+% This program 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.
+%
+% A macro name can be defined by many packages. In LaTeX, macro name need
+% to be unique for a document and thus using the packages with same macro
+% name causes conflict among them. In order to avoid macro name conflict
+% this package defines several commands to save, restore and rename macros
+% defined by other packages.
+%
+% PACKAGE COMMANDS
+% ================
+%
+% \prefix{<prefix added to the macro name>}
+% \save{<prefix added to the macro name>}
+% {<comma separated list of macro name>}
+% \save*{<comma separated list of macro name>}
+% \restore{<prefix added to the macro name>}
+% \restore*
+% \reinstate{<prefix added to the macro name>}
+% {<comma separated partial list of macro name>}
+% \rename{<old name>}{<new name>}
+%
+% USAGE EXAMPLE
+% =============
+%
+% If package A, B and C define three macro names X, Y and Z. To avoid macro
+% name conflict:
+%
+% \usepackage{noconflict}
+% \usepackage{A}
+% \prefix{First} is optional
+% \save{X,Y,Z}
+%
+% \usepackage{B}
+% \save{Second}{X,Y,Z}
+% The above line can also be written as: \prefix{Second} and \save*{X,Y,Z}
+%
+% \usepackage{C}
+% \save{Third}{X,Y,Z}
+%
+% Now macro X, Y and Z of
+% Package A: \FirstX, \FirstY, \FirstZ
+% Package B: \SecondX, \SecondY, \SecondZ
+% Package C: \ThirdX, \ThirdY, \ThirdZ
+%
+% \restore{First}
+% Macros \FirstX, \FirstY and \FirstZ become \X, \Y and \Z
+% \restore{Second}
+% The above line can also be written as: \prefix{Second} and \restore*
+% The above line can also be written as: \reinstate{Second}{X,Y,Z}
+% Macros \SecondX, \SecondY and \SecondZ become \X, \Y and \Z
+% \restore{Third}
+% Macros \ThirdX, \ThirdY and \ThirdZ become \X, \Y and \Z
+% \rename{X}{CofX}
+% Macro \X becomes \CofX
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+\NeedsTeXFormat{LaTeX2e} \ProvidesPackage{noconflict}[2013/04/23
+v1.0 Resolves macro name conflict]
+
+
+\def\@foreach#1#2{%
+ \@test@foreach{#1}#2,\@end@token%
+}
+
+\def\@swallow#1{}
+
+\def\@test@foreach#1{%
+ \@ifnextchar\@end@token%
+ {\@swallow}%
+ {\@body@foreach{#1}}%
+}
+
+\def\@body@foreach#1#2,#3\@end@token{%
+ #1{#2}%
+ \@test@foreach{#1}#3\@end@token%
+}
+
+\newcommand{\@save}[1]{%
+ \expandafter\global\expandafter\let\csname \@prefix#1\expandafter\endcsname%
+ \csname #1\endcsname
+ \expandafter\let\csname #1\endcsname\relax
+}
+
+\newcommand{\@restore}[1]{%
+ \expandafter\global\expandafter\let\csname#1\expandafter\endcsname%
+ \csname \@prefix#1\endcsname%
+}
+
+\newcommand{\@prefix}{First}
+
+\newcommand{\prefix}[1]{%
+ \gdef\@prefix{#1}%
+}
+
+\newcommand{\save}{\@ifstar
+ \save@star%
+ \save@nostar%
+}
+
+\newcommand{\save@star}[1]{
+ \expandafter\gdef\csname list@conflict\@prefix\endcsname{#1}%
+ \@foreach{\@save}{#1}%
+}
+
+\newcommand{\save@nostar}[2]{
+ \prefix{#1}
+ \expandafter\gdef\csname list@conflict\@prefix\endcsname{#2}%
+ \@foreach{\@save}{#2}%
+}
+
+\newcommand{\restore}{\@ifstar
+ \restore@star%
+ \restore@nostar%
+}
+
+\newcommand{\restore@star}{
+ \edef\expand@command{\csname list@conflict\@prefix\endcsname}%
+ \expandafter\@foreach\expandafter{\expandafter\@restore\expandafter}%
+ \expandafter{\expand@command}%
+}
+
+\newcommand{\restore@nostar}[1]{
+ \prefix{#1}
+ \edef\expand@command{\csname list@conflict\@prefix\endcsname}%
+ \expandafter\@foreach\expandafter{\expandafter\@restore\expandafter}%
+ \expandafter{\expand@command}%
+}
+
+\newcommand{\reinstate}[2]{
+ \prefix{#1}
+ \@foreach{\@restore}{#2}%
+}
+
+\newcommand{\rename}[2]{
+ \expandafter\global\expandafter\let\csname #2\expandafter\endcsname%
+ \csname #1\endcsname
+ \expandafter\let\csname #1\endcsname\relax
+}
+
+\endinput
+
+
diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check
index 26d9d8f65f6..7e5662a9b8e 100755
--- a/Master/tlpkg/bin/tlpkg-ctan-check
+++ b/Master/tlpkg/bin/tlpkg-ctan-check
@@ -307,7 +307,7 @@ my @TLP_working = qw(
newtx newunicodechar newvbtm
newverbs nextpage
nfssext-cfr niceframe nicefilelist nicetext nih nkarta nlctdoc
- noitcrul nolbreaks
+ noconflict noitcrul nolbreaks
nomencl nomentbl nonfloat nonumonpart nopageno nostarch notes
notes2bib notoccite nowidow
nrc ntgclass ntheorem ntheorem-vn nuc
diff --git a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
index c0ec18070fa..e16e18d4970 100644
--- a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
+++ b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
@@ -542,6 +542,7 @@ depend nicefilelist
depend niceframe
depend nicetext
depend nlctdoc
+depend noconflict
depend noitcrul
depend nolbreaks
depend nomencl
diff --git a/Master/tlpkg/tlpsrc/noconflict.tlpsrc b/Master/tlpkg/tlpsrc/noconflict.tlpsrc
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Master/tlpkg/tlpsrc/noconflict.tlpsrc