diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/upmethodology/src/upmethodology-p-common.sty |
Initial commit
Diffstat (limited to 'macros/latex/contrib/upmethodology/src/upmethodology-p-common.sty')
-rw-r--r-- | macros/latex/contrib/upmethodology/src/upmethodology-p-common.sty | 231 |
1 files changed, 231 insertions, 0 deletions
diff --git a/macros/latex/contrib/upmethodology/src/upmethodology-p-common.sty b/macros/latex/contrib/upmethodology/src/upmethodology-p-common.sty new file mode 100644 index 0000000000..166c2e0f09 --- /dev/null +++ b/macros/latex/contrib/upmethodology/src/upmethodology-p-common.sty @@ -0,0 +1,231 @@ +% Copyright (c) 2009-13 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@private@doctype@ver{2015/04/24} + +\NeedsTeXFormat{LaTeX2e}[1995/12/01] +\ProvidesPackage{upmethodology-p-common}[\upm@package@private@doctype@ver] + +\RequirePackage{ifthen} +\RequirePackage{xspace} +\RequirePackage{xcolor} +\RequirePackage{ifpdf} + +%---------------------------------------- +% UPMVERSION MACRO +%---------------------------------------- +\input UPMVERSION.def +\def\upm@common@parseversion@to@tex#1#2#3#4#5#6#7#8#9\@nil{#1#2#3#4/#5#6/#7#8} +\def\upm@common@parseversion@major#1#2#3#4#5#6#7#8#9\@nil{#1#2#3#4#5#6#7#8} +\edef\ver@UPMVERSION@major{\expandafter\upm@common@parseversion@major\UPMVERSION-\relax\@nil} +\edef\ver@UPMVERSION{\expandafter\upm@common@parseversion@to@tex\UPMVERSION\@nil} +\expandafter\let\csname ver@UPMVERSION.sty\endcsname\ver@UPMVERSION +\expandafter\let\csname ver@UPMVERSION.cls\endcsname\ver@UPMVERSION + +\gdef\UPMVERSIONTEST{\ver@UPMVERSION\\\ver@UPMVERSION@major} + +%---------------------------------------- +% ARAKHNE.ORG MACRO +%---------------------------------------- +\providecommand{\arakhneorg}{{\begingroup% + {\usefont{T1}{pzc}{m}{it}\selectfont Arakhn\^e}% + {\usefont{T1}{phv}{bc}{sc}\selectfont\tiny.org}\endgroup}\xspace} + +%---------------------------------------- +% CURRENT LANGUAGE +%---------------------------------------- +\def\upmcurrentlang{english} +\def\ifupmlang#1{\ifthenelse{\equal{#1}{\upmcurrentlang}}} + +%---------------------------------------- +% TEST MACROS +%---------------------------------------- +\long\def\Ifnotempty#1{\ifthenelse{\equal{#1}{\@empty}}{}} +\long\def\Ifempty#1#2{\ifthenelse{\equal{#1}{\@empty}}{#2}{}} +\long\def\Ifelseempty#1#2#3{\ifthenelse{\equal{#1}{\@empty}}{#2}{#3}} + +%---------------------------------------- +% TOC MACROS +%---------------------------------------- +\newcommand{\newpageintoc}{\addtocontents{toc}{\protect\newpage}} + +%---------------------------------------- +% DOCUMENT TYPE +%---------------------------------------- +\newif\ifupmbookformat +\newif\ifupmreportformat +\newif\ifupmarticleformat + +\upmbookformatfalse +\upmreportformattrue +\upmarticleformatfalse + +%---------------------------------------- +% PDF COLORS +%---------------------------------------- +\newcommand{\setpdfcolor}[1]{} + +%---------------------------------------- +% CREATE COMMAND WITH ID AS NAME +%---------------------------------------- +\def\upm@protect#1{\upm@p@protect #1\relax} +\def\upm@p@protect#1#2\relax{% + \ifx\relax #1% + \relax + \else% + \string #1% + \ifx\relax #2% + \relax + \else + \upm@p@protect #2\relax% + \fi + \fi} + +\def\upm@namedef#1#2{% + \@namedef{\upm@protect{#1}}{#2}% +} + +\def\upm@nameuse#1{% + \@nameuse{\upm@protect{#1}}% +} + +\def\upm@nameundef#1{% + \expandafter\let\csname\upm@protect{#1}\endcsname\relax% +} + +\def\upm@namelet@ext#1#2{% + \expandafter\expandafter\let\expandafter\upm@tmp\csname#2\endcsname% + \global\expandafter\let\csname#1\endcsname\upm@tmp% +} + +\def\upm@ifdefinedname#1#2#3{% + \expandafter\ifx\csname\upm@protect{#1}\endcsname\relax% + #3% + \else% + #2% + \fi% +} + +\newcommand{\upm@column@char}{\ifupmlang{french}{ :}{:}} + +%---------------------------------------- +% GET THE REFERENCE ID WITHOUT \REF +%---------------------------------------- +\gdef\upm@getref#1{% + \expandafter\ifx\csname r@#1\endcsname\relax + \nfss@text{\reset@font\bfseries ??}% + \else + \expandafter\expandafter\expandafter\@car\csname r@#1\endcsname\@nil + \fi +} + +\gdef\upm@getpageref@filter#1#2#3#4#5{#2} + +\gdef\upm@getpageref#1{% + \expandafter\ifx\csname r@#1\endcsname\relax + \nfss@text{\reset@font\bfseries ??}% + \else% + \protected@xdef\upm@p@tmp@tmp{\protect\upm@getpageref@filter\csname r@#1\endcsname}% + \upm@p@tmp@tmp% + \global\let\upm@p@tmp@tmp\relax% + \fi +} + +%---------------------------------------- +% INTERNAL COMMAND FOR TEXT SUPPER/SUB SCRIPT +%---------------------------------------- + +\let\upm@textsuperscript\textsuperscript + +\def\upm@textsubscript#1{% + {\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}} + + +%---------------------------------------- +% MACRO THAT PERMITS TO LOOP ON A SEPARATOR +%---------------------------------------- + +\newif\ifupm@foreach@hasseparator +\newif\ifupm@foreach@oneseparator + +\let\upm@foreach@end\relax + +\def\upm@foreach@rec#1{% + {\upm@foreach@searchseparator#1\upm@foreach@end\@nil}% + \ifupm@foreach@hasseparator% + \protected@xdef\upm@foreach@continue{\protect\upm@foreach@rec{\upm@foreach@rest}}% + \upm@foreach@body% + \upm@foreach@continue% + \else% + \ifupm@foreach@oneseparator\else% + \upm@foreach@lastbody% + \fi% + \fi% +} + +% Loop on parts of a text given a specific separator. +% In the bodies, the macros \upm@foreach@term is the current data. +% #1: is the separator to consider +% #2: is the data set +% #3: is the body to run for each loop, except the last. +% #4: is the body to run for the last loop. +\def\upm@foreach#1\in#2\do#3#4{% + \global\upm@foreach@oneseparatorfalse% + \gdef\upm@foreach@searchseparator##1#1##2\@nil{% + \gdef\upm@foreach@term{##1}% + \ifx\upm@foreach@end##2% + \global\upm@foreach@hasseparatorfalse% + \else% + \gdef\upm@foreach@rest{##2}% + \global\upm@foreach@hasseparatortrue% + \global\upm@foreach@oneseparatortrue% + \fi% + }% + \gdef\upm@foreach@body{#3}% + \gdef\upm@foreach@lastbody{#4}% + \upm@foreach@rec{#2#1}% +} + +%---------------------------------------- +% MACRO THAT PERMITS TO FIND A STRING +%---------------------------------------- +\def\upm@ifin#1#2{\begingroup\edef\upm@tmp{\endgroup\noexpand\in@{#1}{#2}}\upm@tmp\ifin@} + +%----------------------------------------- +% Option parameters +\newif\ifupm@common@optlist@needdefault +\gdef\upm@common@optlist@parseparams#1=#2\@nil{% + \ifthenelse{\equal{#2}{===}}{% + \global\upm@common@optlist@needdefaulttrue% + }{% + \global\upm@common@optlist@needdefaultfalse% + }% +} +\DeclareRobustCommand{\upm@common@optlist}[1]{% + {\upm@common@optlist@parseparams #1====\@nil}% +} +\newcommand{\upm@setkeys}[3]{% + \upm@common@optlist{#3}% + \ifupm@common@optlist@needdefault% + \expandafter\setkeys{#1}{#2=#3}% + \else% + \expandafter\setkeys{#1}{#3}% + \fi% +} + +\endinput |