summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/upmethodology/upmethodology-extension.sty
blob: 0ef86e696ed9744016ca767c3ae2e154d62dac6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
% Package for Unified Process Methodology's extensions
%
% Copyright (c) 2006-2022 Stephane GALLAND <galland@arakhne.org>
% 
% This program is free library; you can redistribute it and/or modify
% it under the terms of the GNU Lesser General Public License as
% published by the Free Software Foundation; either version 3 of the
% License, or any later version.
%
% This library is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
% Lesser General Public License for more details.
%
% You should have received a copy of the GNU Lesser General Public
% License along with this library; see the file COPYING.  If not,
% write to the Free Software Foundation, Inc., 59 Temple Place - Suite
% 330, Boston, MA 02111-1307, USA.
%

\global\edef\upm@package@ext@ver{2022/02/10}

\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{upmethodology-extension}[\upm@package@ext@ver]

\RequirePackage{upmethodology-p-common}

%----------------------------------------
% TEST MACROS
%----------------------------------------
\long\def\Ifdefined#1#2{\@ifundefined{upmext@extension@value@#1}{}{#2}}
\long\def\Ifelsedefined#1#2#3{\@ifundefined{upmext@extension@value@#1}{#3}{#2}}
\long\def\Ifundefined#1#2{\@ifundefined{upmext@extension@value@#1}{#2}{}}
\long\def\Ifelseundefined#1#2#3{\@ifundefined{upmext@extension@value@#1}{#2}{#3}}

%----------------------------------------
% EXTENSION MANAGEMENT
%----------------------------------------

\newif\ifupm@extension@savealllang\upm@extension@savealllangfalse

\newcommand{\Get}[1]{\@nameuse{upmext@extension@value@#1}}
\newcommand{\GetLang}[2]{\@nameuse{upmext@extension@value@#1@#2}}

\newcommand{\upm@extension@Set}[3][\upmcurrentlang]{%
	% PREDEFINED FRONT PAGE
	\ifthenelse{\equal{#2}{frontpage}}{%
		\gdef\upmext@extension@value@frontpage{#3}%
		\global\let\upmext@extension@value@frontpage@custom\relax%
	}{%			
	% CUSTOM BACK PAGE
	\ifthenelse{\equal{#2}{backpage}}{%
		\ifthenelse{\equal{\upmcurrentlang}{#1}}{%
			\gdef\upmext@extension@value@backpage{#3}%
		}{}%
	}{%			
	% CUSTOM FRONT PAGE
	\ifthenelse{\equal{#2}{cfrontpage}}{%
		\ifthenelse{\equal{\upmcurrentlang}{#1}}{%
			\gdef\upmext@extension@value@frontpage{custom}%
			\gdef\upmext@extension@value@frontpage@custom{#3}%
		}{}%
	}{%			
		\ifthenelse{\equal{\upmcurrentlang}{#1}}{%
			\message{*** define the extension value #2 ****}%
			\global\@namedef{upmext@extension@value@#2}{#3}%
			}{}%
		\ifupm@extension@savealllang%
			\global\@namedef{upmext@extension@value@#2@#1}{#3}%
		\fi
	}}}%
}
\let\Set\upm@extension@Set

\newcommand{\Append}[3][\upmcurrentlang]{%
	\ifthenelse{\equal{\upmcurrentlang}{#1}}{%
		\message{*** append to extension value #2 ****}%
		\expandafter\expandafter\expandafter\global\expandafter\protected@edef\csname upmext@extension@value@#2\endcsname{\@nameuse{upmext@extension@value@#2}\xspace#3}%
	}{}%
	%\ifupm@extension@savealllang%
	%	\global\expandafter\g@addto@macro\csname upmext@extension@value@#2#1\endcsname{#3}%
	%\fi
}

\newcommand{\Unset}[2][\upmcurrentlang]{%
	\ifthenelse{\equal{\upmcurrentlang}{#1}}{%
		\message{*** undefine the extension value #2 ****}%
		\global\expandafter\let\csname upmext@extension@value@#2\endcsname\@undefined%
		\ifupm@extension@savealllang%
			\global\expandafter\let\csname upmext@extension@value@#2@#1\endcsname\@undefined%
		\fi%
	}{}%
}

\newcommand{\DeclareCopyright}[5][\upmcurrentlang]{%
	\ifthenelse{\equal{\upmcurrentlang}{#1}}{%
		\Set{copyright}{Copyright {(c)} #3 #4.}%
		\message{*** style extension #2, \Get{copyright} ****}%
		\Set{trademarks}{#5}%
	}{}%
}

\newlength{\upmext@tmp@putx}
\def\Put(#1,#2){%
	\setlength{\upmext@tmp@putx}{#1\unitlength}%
	\if@twoside\ifodd\c@page\else\addtolength{\upmext@tmp@putx}{28\unitlength}\fi\fi%
	\put(\strip@pt\upmext@tmp@putx,#2)}

%-----
% Use the specified extension
%\UseExtension{extension_name}
\newcommand{\UseExtension}[1]{%
	\message{**** including upm extension #1 (upmext-#1.cfg) ****}%
	\input{upmext-#1.cfg}%
}

%------------
% Default declarations
\Set{frontillustrationsize}{1}
\Set{watermarksize}{1}
\Unset{publisher}
\Unset{copyrighter}
\Unset{printedin}

\endinput