From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Mon, 2 Sep 2019 13:46:59 +0900
Subject: Initial commit

---
 .../upmethodology/src/upmethodology-fmt.sty        | 1527 ++++++++++++++++++++
 1 file changed, 1527 insertions(+)
 create mode 100644 macros/latex/contrib/upmethodology/src/upmethodology-fmt.sty

(limited to 'macros/latex/contrib/upmethodology/src/upmethodology-fmt.sty')

diff --git a/macros/latex/contrib/upmethodology/src/upmethodology-fmt.sty b/macros/latex/contrib/upmethodology/src/upmethodology-fmt.sty
new file mode 100644
index 0000000000..bbdd4bce1e
--- /dev/null
+++ b/macros/latex/contrib/upmethodology/src/upmethodology-fmt.sty
@@ -0,0 +1,1527 @@
+% Layout and Pagraph Format for Unified Process Methodology
+%
+% Copyright (c) 2006-2009, 2012-2015 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@fmt@ver{2019/08/04}
+
+\NeedsTeXFormat{LaTeX2e}[1995/12/01]
+\ProvidesPackage{upmethodology-fmt}[\upm@package@fmt@ver]
+
+\RequirePackage{upmethodology-p-common}
+
+\gdef\upm@fmt@force@single@spacing#1{{\begin{singlespace}#1\end{singlespace}}}
+\gdef\upm@date@head#1/#2\@nil{#1}
+\gdef\upm@date@tail#1/#2\@nil{#2}
+\gdef\upm@date@first#1{{\expandafter\upm@date@head#1\expandafter\@nil}}
+\gdef\upm@date@second#1{{\expandafter\expandafter\expandafter\upm@date@head\expandafter\upm@date@tail#1\expandafter\@nil\expandafter\expandafter\expandafter\@nil}}
+\gdef\upm@date@third#1{{\expandafter\expandafter\expandafter\upm@date@tail\expandafter\upm@date@tail#1\expandafter\@nil\expandafter\expandafter\expandafter\@nil}}
+
+\newif\ifupm@use@override@standard@lists
+\global\upm@use@override@standard@liststrue
+
+%----------------------------------------
+% LOCALES
+%----------------------------------------
+\global\let\upm@format@lang@extractyear\upm@date@first%
+\def\upm@format@lang@english{%
+  \gdef\upm@lang@@{\message{**** upmethodology-fmt is using English language ****}}%
+  \global\renewcommand{\upm@format@lang@makedate}[3]{##3\string/\two@digits{##2}\string/\two@digits{##1}}%
+  \global\let\upm@format@lang@extractyear\upm@date@first%
+  \global\let\upm@format@lang@extractmonth\upm@date@second%
+  \gdef\upm@format@lang@professor{Pr.}%
+  \gdef\upm@format@lang@doctor{Dr.}%
+  \gdef\upm@format@lang@phdoctor{Ph.D.}%
+  \gdef\upm@format@lang@scdoctor{Sc.D.}%
+  \gdef\upm@format@lang@mdoctor{M.D.}%
+  \gdef\upm@format@lang@professionalengineer{CEng.}%
+  \gdef\upm@format@lang@incorporatedengineer{IEng.}%
+}
+\def\upm@format@lang@french{%
+  \gdef\upm@lang@@{\message{**** upmethodology-fmt is using French language ****}}%
+  \global\renewcommand{\upm@format@lang@makedate}[3]{\two@digits{##1}\string/\two@digits{##2}\string/##3}%
+  \global\let\upm@format@lang@extractyear\upm@date@third%
+  \global\let\upm@format@lang@extractmonth\upm@date@second%
+  \global\let\upm@format@lang@extractday\upm@date@first%
+  \gdef\upm@format@lang@professor{Pr.}%
+  \gdef\upm@format@lang@doctor{Dr.}%
+  \gdef\upm@format@lang@phdoctor{Ph.D.}%
+  \gdef\upm@format@lang@scdoctor{Sc.D.}%
+  \gdef\upm@format@lang@mdoctor{M.D.}%
+  \gdef\upm@format@lang@professionalengineer{Ing.}%
+  \gdef\upm@format@lang@incorporatedengineer{Ing.}%
+}
+\global\providecommand{\upm@format@lang@makedate}[3]{}%
+
+%----------------------------------------
+% OPTIONS
+%----------------------------------------
+\DeclareOption{french}{%
+  \upm@format@lang@french
+  \PassOptionsToPackage{french}{varioref}
+}
+\DeclareOption{francais}{%
+  \upm@format@lang@french
+  \PassOptionsToPackage{french}{varioref}
+}
+\DeclareOption{english}{%
+  \upm@format@lang@english
+  \PassOptionsToPackage{english}{varioref}
+}
+\DeclareOption{standardlists}{%
+  \global\upm@use@override@standard@listsfalse
+}
+\ExecuteOptions{english}
+\ProcessOptions
+\upm@lang@@
+
+
+\RequirePackage{graphicx}
+\RequirePackage{subcaption}
+\RequirePackage{tabularx}
+\RequirePackage{multicol}
+\RequirePackage{colortbl}
+\RequirePackage{picinpar}
+\RequirePackage{amsmath}
+\RequirePackage{amsthm}
+\RequirePackage{thmtools}
+\RequirePackage{pifont}
+\RequirePackage{setspace}
+\RequirePackage{varioref}
+\RequirePackage{txfonts}
+\RequirePackage{relsize}
+\RequirePackage{xkeyval}
+\RequirePackage{hyphenat}
+\RequirePackage{bbm}
+\RequirePackage{environ}% for advanced environment declaration
+
+%----------------------------------------
+% Exponent and indice
+%----------------------------------------
+% Exponent
+%\newcommand{\textsup}[1]{\ensuremath{^{\text{#1}}}\xspace}
+\newcommand{\textsup}[1]{\upm@textsuperscript{#1}\xspace}
+% Indice
+%\newcommand{\textsub}[1]{\ensuremath{_{\text{#1}}}\xspace}
+\newcommand{\textsub}[1]{\upm@textsubscript{#1}\xspace}
+
+%----------------------------------------
+% Major Emphazing
+%----------------------------------------
+\newcommand{\Emph}[1]{\textbf{#1}\xspace}
+
+%----------------------------------------
+% SYMBOLS
+%----------------------------------------
+\renewcommand{\copyright}{\Pisymbol{psy}{211}\xspace}
+\newcommand{\trademark}{\Pisymbol{psy}{228}\xspace}
+\newcommand{\regmark}{\Pisymbol{psy}{226}\xspace}
+\newcommand{\smalltrade}{{\tiny\trademark}\xspace}
+\newcommand{\smallreg}{{\tiny\regmark}\xspace}
+\newcommand{\smallcopy}{{\tiny\copyright}\xspace}
+\newcommand{\ust}{\textsup{st}}
+\newcommand{\und}{\textsup{nd}}
+\newcommand{\urd}{\textsup{rd}}
+\newcommand{\uth}{\textsup{th}}
+
+%----------------------------------------
+% MATH SYMBOLS
+%----------------------------------------
+\newcommand{\R}{\ensuremath{\mathbb{R}}}
+\newcommand{\N}{\ensuremath{\mathbb{N}}}
+\newcommand{\Z}{\ensuremath{\mathbb{Z}}}
+\newcommand{\C}{\ensuremath{\mathbb{C}}}
+\newcommand{\Q}{\ensuremath{\mathbb{Q}}}
+\newcommand{\powerset}{\ensuremath{\mathcal{P}}}
+
+\DeclareMathOperator{\sgn}{sgn}
+
+%----------------------------------------
+% DEFAULT GRAPHICX CONFIGURATION
+%----------------------------------------
+
+\ifpdf
+  \DeclareGraphicsExtensions{.pdf,.png,.jpg,.jpeg,.gif}
+\else
+  \DeclareGraphicsExtensions{.eps,.png,.jpg,.jpeg,.gif}
+\fi
+\graphicspath{{./}}
+
+%-----------------------------------------
+% LOCAL DEFINITION OF TH GRAPHICS PATH
+%-----------------------------------------
+
+\newenvironment{graphicspathcontext}[1]{%
+	\bgroup%
+	\let\upm@tmp@graphicspathcontext@ginputpath\Ginput@path%
+	\def\old{\upm@tmp@graphicspathcontext@ginputpath}%
+	\protected@edef\upm@tmp@graphicspathcontext@tmp{\protect\graphicspath{#1}}%
+	\upm@tmp@graphicspathcontext@tmp%
+}{%
+	\egroup%
+}
+
+%----------------------------------------
+% FIGURES
+%----------------------------------------
+
+\newcommand{\upm@mfigure}[5][ht]{
+	\begin{figure}[#1]%
+		\begin{center}%
+			\includegraphics[#2]{#3}%
+			\caption{#4}%
+			\label{fig:#5}%
+		\end{center}%
+	\end{figure}%
+}
+\newcommand{\upm@mfigurestar}[5][ht]{
+	\begin{figure*}[#1]%
+		\begin{center}%
+			\includegraphics[#2]{#3}%
+			\caption{#4}%
+			\label{fig:#5}%
+		\end{center}%
+	\end{figure*}%
+}
+%-----
+%\mfigure[position]{options}{filename}{caption}{label}
+\def\mfigure{\@ifstar\upm@mfigurestar\upm@mfigure}
+%-----
+%\figref{label}
+\newcommand{\figref}[1]{\ref{fig:#1}}
+%-----
+%\figpageref{label}
+\newcommand{\figpageref}[1]{\pageref{fig:#1}}
+
+%-----
+% Multi-figures
+
+\newcounter{upm@subfigure@count}
+
+\newcommand{\upm@beginsubfigure}[4]{%
+	\let\upm@mfiguresaved\mfigure%
+	%options,filename,caption,label
+	\renewcommand{\mfigure}[5][]{%
+		\xdef\upm@tmp@subfigure@label{\alph{upm@subfigure@count}}%
+		\subcaptionbox{##4%
+			\label{fig:##5}%
+			\label{fig:#4:\upm@tmp@subfigure@label}%
+		}{\includegraphics[##2]{##3}}%
+		\addtocounter{upm@subfigure@count}{1}%
+	}
+	%options,filename,caption
+	\newcommand{\msubfigure}[3]{%
+		\xdef\upm@tmp@subfigure@label{\alph{upm@subfigure@count}}%
+		\subcaptionbox{##3%
+			\label{fig:#4:\upm@tmp@subfigure@label}%
+		}{\includegraphics[##1]{##2}}%
+		\addtocounter{upm@subfigure@count}{1}%
+	}
+	\setcounter{upm@subfigure@count}{1}%
+	\gdef\upm@mfigurescaption{#3}%
+	\gdef\upm@mfigureslabel{fig:#4}%
+	\begin{#1}[#2]\centering %
+	\begingroup%
+}
+
+\newcommand{\upm@endsubfigure}[1]{%
+	\endgroup%
+	\caption{\upm@mfigurescaption}%
+	\label{\upm@mfigureslabel}%
+	\end{#1}%
+	\let\mfigure\upm@mfiguresaved
+}
+
+%-----
+%\mfigures[position]{caption}{label}
+\newenvironment{mfigures}[3][ht]{
+	\upm@beginsubfigure{figure}{#1}{#2}{#3}%
+}{%
+	\upm@endsubfigure{figure}%
+}
+%-----
+%\mfigures*[position]{caption}{label}
+\newenvironment{mfigures*}[3][ht]{
+	\upm@beginsubfigure{figure*}{#1}{#2}{#3}%
+}{%
+	\upm@endsubfigure{figure*}%
+}
+
+%----------------------------------------
+% IMAGES INCLUDING TeX EXPRESSIONS
+%----------------------------------------
+
+%
+% This section is copied from the AutoLaTeX package
+% http://www.arakhne.org/autolatex
+%
+
+%-----
+%\DeclareGraphicsExtensionsWtex{coma separated extensions}
+\providecommand{\DeclareGraphicsExtensionsWtex}[1]{%
+	\xdef\@autolatex@wtfig@extensions{\zap@space#1 \@empty}%
+}
+\ifpdf
+   \DeclareGraphicsExtensionsWtex{.pdftex_t,.pdf_tex}
+\else
+  \DeclareGraphicsExtensionsWtex{.pstex_t,.ps_tex}
+\fi
+
+\providecommand{\@autolatex@wtfig@searchinpath}[1]{%
+	\IfFileExists{#1}{%
+		\protected@edef\@autolatex@wtfig@tmp{\protect\resizebox{\@autolatex@wtfig@width}{\@autolatex@wtfig@height}{\protect\input{#1}}}%
+	}{%
+		\@for\@autolatex@wtfig@pathtmp:=\Ginput@path\do{%
+			\ifx\@autolatex@wtfig@tmp\relax%
+				\IfFileExists{\@autolatex@wtfig@pathtmp#1}{%
+					\protected@edef\@autolatex@wtfig@tmp{\protect\resizebox{\@autolatex@wtfig@width}{\@autolatex@wtfig@height}{\protect\input{\@autolatex@wtfig@pathtmp#1}}}%
+				}{}%
+			\fi%
+		}%
+	}%
+}
+
+\define@key[autolatex]{withtex}{width}{%
+	\gdef\@autolatex@wtfig@width{#1}%
+}
+\define@key[autolatex]{withtex}{height}{%
+	\gdef\@autolatex@wtfig@height{#1}%
+}
+
+%-----
+%\includefigurewtex[width=xx,height=yy]{filename}
+\providecommand{\includefigurewtex}[2][width=\linewidth]{%
+	\begingroup%
+	\gdef\@autolatex@wtfig@width{!}%
+	\gdef\@autolatex@wtfig@height{!}%
+	\setkeys[autolatex]{withtex}{#1}%
+	%
+	\global\let\@autolatex@wtfig@tmp\relax%
+	\global\let\@autolatex@wtfig@ext\relax%
+	\global\let\@autolatex@wtfig@path\relax%
+	\filename@parse{#2}%
+	\ifx\filename@ext\relax%
+		\@for\@autolatex@wtfig@exttmp:=\@autolatex@wtfig@extensions\do{%
+			\@autolatex@wtfig@searchinpath{#2\@autolatex@wtfig@exttmp}%
+		}%
+	\else%
+		\@autolatex@wtfig@searchinpath{#2\@autolatex@wtfig@exttmp}%
+	\fi%
+	%
+	\ifx\@autolatex@wtfig@tmp\relax%
+		\errmessage{Package upmethodology-fmt: File not found '#2', needed for figure inclusion}%
+	\else%
+		\@autolatex@wtfig@tmp%
+	\fi%
+	%
+	\endgroup%
+}
+
+\global\let\includegraphicswtex\includefigurewtex
+
+%----------------------------------------
+% ENVIRONMENT FOR IMAGES INCLUDING TeX EXPRESSIONS
+%----------------------------------------
+
+\gdef\upm@figtex@dyncaption@remove{}
+\gdef\upm@figtex@figremove#1{%
+	\global\expandafter\let\csname FIG#1\endcsname\relax%
+}
+\gdef\upm@figtex@restore{%
+	\upm@figtex@dyncaption@remove%
+	\gdef\upm@figtex@dyncaption@remove{}
+}
+%-----
+%\figmath{id}{content}
+\def\figmath#1#2{%
+	\expandafter\gdef\csname FIG#1\endcsname{\ensuremath{#2}}%
+	\global\protected@edef\upm@figtex@dyncaption@remove{\upm@figtex@dyncaption@remove\protect\upm@figtex@figremove{#1}}%
+}
+%-----
+%\figtext{id}{content}
+\def\figtext#1#2{%
+	\expandafter\gdef\csname FIG#1\endcsname{#2}%
+	\global\protected@edef\upm@figtex@dyncaption@remove{\upm@figtex@dyncaption@remove\protect\upm@figtex@figremove{#1}}%
+}
+
+\let\upm@fmt@figtex@nil\@nil
+\def\upm@fmt@figtex@parseparams#1=#2\upm@fmt@figtex@nil{\gdef\@tmp{#2}}
+
+\newcommand{\upm@mfigurewtex}[5][ht]{
+	\begin{figure}[#1]%
+		\begin{center}%
+			% Providing an ascendent compatibility on the second parameter:
+			% - Prefered value of the parameter: a list of key/value pairs;
+			% - Old fashion value of the parameter: the value for the "width" key.
+			{\upm@fmt@figtex@parseparams #2====\upm@fmt@figtex@nil}%
+			\ifthenelse{\equal{\@tmp}{===}}{%
+				\includegraphicswtex[width=#2]{#3}%
+			}{%
+				\includegraphicswtex[#2]{#3}%
+			}%
+			\caption{#4}%
+			\label{fig:#5}%
+		\end{center}%
+	\end{figure}%
+	\upm@figtex@restore%
+}
+\newcommand{\upm@mfigurewtexstar}[5][ht]{
+	\begin{figure*}[#1]%
+		\begin{center}%
+			% Providing an ascendent compatibility on the second parameter:
+			% - Prefered value of the parameter: a list of key/value pairs;
+			% - Old fashion value of the parameter: the value for the "width" key.
+			{\upm@fmt@figtex@parseparams #2====\upm@fmt@figtex@nil}%
+			\ifthenelse{\equal{\@tmp}{===}}{%
+				\includegraphicswtex[width=#2]{#3}%
+			}{%
+				\includegraphicswtex[#2]{#3}%
+			}%
+			\caption{#4}%
+			\label{fig:#5}%
+		\end{center}%
+	\end{figure*}%
+	\upm@figtex@restore%
+}
+%-----
+%\mfigurewtex[position]{options}{filename}{caption}{label}
+\def\mfigurewtex{\@ifstar\upm@mfigurewtexstar\upm@mfigurewtex}
+
+
+
+%----------------------------------------
+% TABLES
+%----------------------------------------
+
+%table's colors
+\definecolor{backtableheader}{rgb}{0.92,0.94,1}
+\definecolor{fronttableheader}{rgb}{0.23,0.33,0.48}
+%title of a table
+\def\upm@fmt@table@title#1{\color{fronttableheader} \cellcolor{backtableheader} {\bfseries #1}}
+%title of columns
+\def\upm@fmt@table@column@title#1{\hfil{\color{fronttableheader} \cellcolor{backtableheader} {\itshape#1}}\hfil}
+
+% Utility functions for mtabular
+\newcounter{upm@fmt@mtabular@columnnumber}
+
+\gdef\upm@fmt@mtabular@expandtitle#1#2{%
+	\multicolumn{#1}{|c|}{\upm@fmt@table@title{\ignorespaces#2\ignorespaces}}%
+}
+
+\newcommand{\tabulartitlespec}[1]{%
+	\gdef\upm@fmt@mtabular@expandtitle##1##2{%
+		\multicolumn{##1}{#1}{\upm@fmt@table@title{\ignorespaces##2\ignorespaces}}%
+	}
+}
+
+%-----
+%\mtabular[width]{ncolumns}{columns}
+\newenvironment{mtabular}[3][\linewidth]{%
+	\newcommand{\tabulartitle}[1]{%
+		\hline%
+		\upm@fmt@mtabular@expandtitle{#2}{##1} \\%
+		\hline%
+	}%
+	\newcommand{\tabulartitleinside}[1]{%
+		\hline\hline%
+		\upm@fmt@mtabular@expandtitle{#2}{##1} \\%
+		\hline%
+	}%
+	\newcommand*{\upm@fmt@mtabular@column@next}[1]{%
+		& \upm@fmt@table@column@title{\ignorespaces##1\ignorespaces}%
+		\addtocounter{upm@fmt@mtabular@columnnumber}{-1}%
+		\ifnum0<\value{upm@fmt@mtabular@columnnumber}%
+			\let\upm@fmt@mtabular@column@continue\upm@fmt@mtabular@column@next%
+		\else%
+			\\ \hline \let\upm@fmt@mtabular@column@continue\relax%
+		\fi%
+		\upm@fmt@mtabular@column@continue%
+	}
+	\newcommand*{\upm@fmt@mtabular@column@first}[1]{%
+		\upm@fmt@table@column@title{\ignorespaces##1\ignorespaces}%
+		\addtocounter{upm@fmt@mtabular@columnnumber}{-1}%
+		\ifnum0<\value{upm@fmt@mtabular@columnnumber}%
+			\let\upm@fmt@mtabular@column@continue\upm@fmt@mtabular@column@next%
+		\else%
+			\\ \hline \let\upm@fmt@mtabular@column@continue\relax%
+		\fi%
+		\upm@fmt@mtabular@column@continue%
+	}
+	\newcommand{\tabularheader}{%
+		\setcounter{upm@fmt@mtabular@columnnumber}{#2}%
+		\upm@fmt@mtabular@column@first%
+	}%
+	\newcommand{\tabularrowheader}[1]{%
+		\centering\upm@fmt@table@column@title{\ignorespaces##1}%
+	}%
+	\begingroup\tabularx{#1}{#3}%
+}{%
+	\endtabularx\endgroup%
+}
+
+%-----
+%\mtable[options]{width}{ncolumns}{columns}{caption}{label}
+% size=<length>
+\define@key[autolatex]{mtable}{size}{\gdef\@autolatex@mtable@size{#1}}
+% position: h t b p H !
+\define@key[autolatex]{mtable}{h}[\relax]{\gdef\@autolatex@mtable@position{[h]}}
+\define@key[autolatex]{mtable}{t}[\relax]{\gdef\@autolatex@mtable@position{[t]}}
+\define@key[autolatex]{mtable}{b}[\relax]{\gdef\@autolatex@mtable@position{[b]}}
+\define@key[autolatex]{mtable}{p}[\relax]{\gdef\@autolatex@mtable@position{[p]}}
+\define@key[autolatex]{mtable}{H}[\relax]{\gdef\@autolatex@mtable@position{[H]}}
+\define@key[autolatex]{mtable}{ht}[\relax]{\gdef\@autolatex@mtable@position{[ht]}}
+\define@key[autolatex]{mtable}{hb}[\relax]{\gdef\@autolatex@mtable@position{[hb]}}
+\define@key[autolatex]{mtable}{hp}[\relax]{\gdef\@autolatex@mtable@position{[hp]}}
+\define@key[autolatex]{mtable}{hH}[\relax]{\gdef\@autolatex@mtable@position{[hH]}}
+\define@key[autolatex]{mtable}{h!}[\relax]{\gdef\@autolatex@mtable@position{[h!]}}
+\define@key[autolatex]{mtable}{tb}[\relax]{\gdef\@autolatex@mtable@position{[tb]}}
+\define@key[autolatex]{mtable}{tp}[\relax]{\gdef\@autolatex@mtable@position{[tp]}}
+\define@key[autolatex]{mtable}{tH}[\relax]{\gdef\@autolatex@mtable@position{[tH]}}
+\define@key[autolatex]{mtable}{t!}[\relax]{\gdef\@autolatex@mtable@position{[t!]}}
+\define@key[autolatex]{mtable}{bp}[\relax]{\gdef\@autolatex@mtable@position{[bp]}}
+\define@key[autolatex]{mtable}{bH}[\relax]{\gdef\@autolatex@mtable@position{[bH]}}
+\define@key[autolatex]{mtable}{b!}[\relax]{\gdef\@autolatex@mtable@position{[b!]}}
+\define@key[autolatex]{mtable}{pH}[\relax]{\gdef\@autolatex@mtable@position{[pH]}}
+\define@key[autolatex]{mtable}{p!}[\relax]{\gdef\@autolatex@mtable@position{[p!]}}
+\define@key[autolatex]{mtable}{H!}[\relax]{\gdef\@autolatex@mtable@position{[H!]}}
+\define@key[autolatex]{mtable}{htb}[\relax]{\gdef\@autolatex@mtable@position{[htb]}}
+\define@key[autolatex]{mtable}{htp}[\relax]{\gdef\@autolatex@mtable@position{[htp]}}
+\define@key[autolatex]{mtable}{htH}[\relax]{\gdef\@autolatex@mtable@position{[htH]}}
+\define@key[autolatex]{mtable}{ht!}[\relax]{\gdef\@autolatex@mtable@position{[ht!]}}
+\define@key[autolatex]{mtable}{tbp}[\relax]{\gdef\@autolatex@mtable@position{[tbp]}}
+\define@key[autolatex]{mtable}{tbH}[\relax]{\gdef\@autolatex@mtable@position{[tbH]}}
+\define@key[autolatex]{mtable}{tb!}[\relax]{\gdef\@autolatex@mtable@position{[tb!]}}
+\define@key[autolatex]{mtable}{bpH}[\relax]{\gdef\@autolatex@mtable@position{[bpH]}}
+\define@key[autolatex]{mtable}{bp!}[\relax]{\gdef\@autolatex@mtable@position{[bp!]}}
+\define@key[autolatex]{mtable}{pH!}[\relax]{\gdef\@autolatex@mtable@position{[pH!]}}
+\define@key[autolatex]{mtable}{htbp}[\relax]{\gdef\@autolatex@mtable@position{[htbp]}}
+\define@key[autolatex]{mtable}{htbH}[\relax]{\gdef\@autolatex@mtable@position{[htbH]}}
+\define@key[autolatex]{mtable}{htb!}[\relax]{\gdef\@autolatex@mtable@position{[htb!]}}
+\define@key[autolatex]{mtable}{tbpH}[\relax]{\gdef\@autolatex@mtable@position{[tbpH]}}
+\define@key[autolatex]{mtable}{tbp!}[\relax]{\gdef\@autolatex@mtable@position{[tbp!]}}
+\define@key[autolatex]{mtable}{bpH!}[\relax]{\gdef\@autolatex@mtable@position{[bph!]}}
+\define@key[autolatex]{mtable}{htbpH}[\relax]{\gdef\@autolatex@mtable@position{[htbpH]}}
+\define@key[autolatex]{mtable}{htbp!}[\relax]{\gdef\@autolatex@mtable@position{[htbp!]}}
+\define@key[autolatex]{mtable}{htbpH!}[\relax]{\gdef\@autolatex@mtable@position{[htbpH!]}}
+%
+\newenvironment{mtable}[6][ht]{%
+	\gdef\@autolatex@mtable@position{[ht]}%
+	\gdef\@autolatex@mtable@size{\normalsize}%
+	\setkeys[autolatex]{mtable}{#1}%
+	%
+	\gdef\upm@table@caption{#5}%
+	\xdef\upm@table@label{tab:#6}%
+	\gdef\upm@table@note{}%
+	\newcommand{\captionastitle}{\tabulartitle{\upm@table@caption}}%
+	\newcommand{\tablenote}[1]{\gdef\upm@table@note{\bgroup ##1\egroup}}%
+	\expandafter\table\@autolatex@mtable@position%
+	\center\@autolatex@mtable@size%
+	\mtabular[#2]{#3}{#4}%
+}{%
+	\endmtabular\relax%
+	\caption{\upm@table@caption}%
+	\label{\upm@table@label}%
+	\endcenter%
+	\upm@table@note%
+	\endtable%
+	\global\let\upm@table@caption\relax%
+	\global\let\upm@table@label\relax%
+	\global\let\upm@table@note\relax%
+}
+
+%-----
+%\tabref{label}
+\newcommand{\tabref}[1]{\ref{tab:#1}}
+%-----
+%\tabpageref{label}
+\newcommand{\tabpageref}[1]{\pageref{tab:#1}}
+
+%----------------------------------------
+% PARAGRAPHS
+%----------------------------------------
+\setlength{\parindent}{0pt}
+\setlength{\parskip}{.2cm}
+
+%----------------------------------------
+% COLORIZED SECTION'S TITLES
+%----------------------------------------
+
+% PRIVATE COLORS
+\definecolor{sectiontitlecolor}{rgb}{0.93,0.41,0}
+\definecolor{chaptertitlecolor}{rgb}{0.24,0.33,0.48}
+\definecolor{parttitlecolor}{rgb}{0.24,0.33,0.48}
+
+% PRIVATE FORMATTING MACROS
+\newcounter{upm@format@section@sectionlevel}
+\setcounter{upm@format@section@sectionlevel}{0}
+
+\gdef\upm@format@partnum#1{\textcolor{parttitlecolor}{\expandafter\fontsize{40pt}{60pt}\selectfont#1\normalfont}}
+\gdef\upm@format@parttitle#1{\textcolor{parttitlecolor}{\huge\scshape #1}}
+\gdef\upm@format@chapternum#1{\textcolor{chaptertitlecolor}{\expandafter\fontsize{40pt}{60pt}\selectfont#1\normalfont}}
+\gdef\upm@format@chaptertitle#1{\textcolor{chaptertitlecolor}{\Huge\scshape #1}}
+\gdef\upm@format@sectionnum#1#2{\textcolor{sectiontitlecolor}{#2}}
+\gdef\upm@format@sectiontitle#1#2{\textcolor{sectiontitlecolor}{#2}}
+\gdef\upm@format@sectionnum@postfix{/}
+
+% PART
+\ifupmbookformat
+	\gdef\@part[#1]#2{%
+	    \ifnum \c@secnumdepth >-2\relax
+	      \refstepcounter{part}%
+	      \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
+	    \else
+	      \addcontentsline{toc}{part}{#1}%
+	    \fi
+	    \markboth{}{}%
+	    {\huge\centering
+	     \interlinepenalty \@M
+	     \normalfont
+	     \ifnum \c@secnumdepth >-2\relax
+	       \upm@format@partnum{\thepart}
+	       \par
+	       \vskip 20\p@
+	     \fi
+	     \upm@format@parttitle{\nohyphens{#2}}\par}%
+	    \@endpart}
+	\gdef\@spart#1{%
+	    {\centering
+	     \interlinepenalty \@M
+	     \normalfont
+	     \upm@format@parttitle{\nohyphens{#1}}\par}%
+	    \@endpart}
+\fi
+
+% CHAPTER
+\ifupmarticleformat\else
+	\newcommand{\upm@format@makechapterhead}[2]{%
+		  %\vspace*{50\p@}%
+		  {\parindent \z@ \Huge \raggedleft \normalfont
+		    \ifx\@empty#1\ifnum \c@secnumdepth >\m@ne
+			\upm@format@chapternum{\thechapter}
+			\par\nobreak
+			\vskip 20\p@
+		    \fi\fi
+		    \interlinepenalty\@M
+		    %\ifupmbookformat\doublespacing\fi
+		    \upm@format@chaptertitle{\nohyphens{#2}}\par\nobreak
+		    \vskip 80\p@
+		  }
+	}
+	%internal implementation of \chapter
+	\gdef\@makechapterhead#1{\upm@format@makechapterhead{\@empty}{#1}}
+	%internal implementation of \chapter*
+	\gdef\@makeschapterhead#1{\upm@format@makechapterhead{\relax}{#1}}
+\fi
+
+% SECTIONS
+\let\upm@format@sect@old\@sect
+\let\upm@format@ssect@old\@ssect
+
+% public implementation of sections.
+\renewcommand{\section}{\setcounter{upm@format@section@sectionlevel}{1}\@startsection{section}{1}{\z@}{-3.5ex \@plus -1ex \@minus -.2ex}{2.3ex \@plus.2ex}{\normalfont\Large\scshape}}
+\renewcommand{\subsection}{\setcounter{upm@format@section@sectionlevel}{2}\@startsection{subsection}{2}{\z@}{-3.25ex\@plus -1ex \@minus -.2ex}{1.5ex \@plus .2ex}{\normalfont\large\scshape}}
+\renewcommand{\subsubsection}{\setcounter{upm@format@section@sectionlevel}{3}\@startsection{subsubsection}{3}{\z@}{-3.25ex\@plus -1ex \@minus -.2ex}{1.5ex \@plus .2ex}{\normalfont\normalsize\scshape}}
+
+% internal implementations for sections.
+\gdef\@sect#1#2#3#4#5#6[#7]#8{\upm@format@sect@old{#1}{#2}{#3}{#4}{#5}{#6}[#7]{\upm@format@sectiontitle{\theupm@format@section@sectionlevel}{#8}}}
+\gdef\@ssect#1#2#3#4#5{\upm@format@ssect@old{#1}{#2}{#3}{#4}{\upm@format@sectiontitle{\theupm@format@section@sectionlevel}{#5}}}
+\gdef\@seccntformat#1{\upm@format@sectionnum{\theupm@format@section@sectionlevel}{\csname the#1\endcsname\upm@format@sectionnum@postfix}\quad}
+
+%----------------------------------------
+% PAGE LAYOUT
+%----------------------------------------
+
+% Change the factors for determining the element positions
+\renewcommand{\topfraction}{.99} % max fraction of floats at top
+\renewcommand{\bottomfraction}{.99} % max fraction of floats at bottom
+\renewcommand{\textfraction}{.5} % allow minimal text w. figs
+\renewcommand{\dbltopfraction}{.66} % fit big float above 2-col. text
+\renewcommand{\floatpagefraction}{0.99} % require fuller float pages | N.B.: floatpagefraction MUST be less than topfraction !!
+\renewcommand{\dblfloatpagefraction}{.66} % fit big float above 2-col. text
+
+% Update the format of the saved pages and sections
+\renewcommand{\sectionmark}[1]{\markright{\thesection\ \textsc{#1}}}
+\ifupmarticleformat\else
+\renewcommand{\chaptermark}[1]{\markboth{\textsc{#1}}{}}
+\renewcommand{\@mkboth}[2]{%
+    \let\upm@doc@MakeUppercase\MakeUppercase%
+    \gdef\MakeUppercase##1{##1}%
+    \chaptermark{#1}%
+    \let\MakeUppercase\upm@doc@MakeUppercase%
+    \let\upm@doc@MakeUppercase\relax%
+}
+\fi
+% Make sure that the page before a part or
+% a chapter title was empty
+\renewcommand{\cleardoublepage}{%
+  \clearpage%
+  \if@twoside\ifodd\c@page%
+  \else%
+  \thispagestyle{facingtochapter}%
+  \hbox{}\newpage%
+  \if@twocolumn\hbox{}\newpage%
+  \fi\fi\fi%
+}
+\newcommand{\ps@facingtochapter}{\ps@empty}
+
+%----------------------------------------
+% ADDITIONAL SECTIONS
+%----------------------------------------
+
+\gdef\upm@format@newsection@alignment{}
+
+%-----
+% Part without number but inside the TOC
+%\parttoc [toctitle]{title} % left-alignment inside TOC
+%\parttoc*[toctitle]{title} % right-alignment inside TOC
+\def\parttoc{\@ifstar%
+	{\gdef\upm@format@newsection@alignment{\protect\numberline{}}\expandafter\upm@format@newsection@part}%
+	{\gdef\upm@format@newsection@alignment{}\expandafter\upm@format@newsection@part}}
+\def\upm@format@newsection@part{\@ifnextchar [%
+	{\expandafter\upm@format@newsection@part@opt}%
+	{\expandafter\upm@format@newsection@part@nopt}}
+\def\upm@format@newsection@part@opt[#1]#2{%
+	\part*{#2\addcontentsline{toc}{part}{\upm@format@newsection@alignment{#1}}}%
+	\chaptermark{}%
+}
+\def\upm@format@newsection@part@nopt#1{%
+	\part*{#1\addcontentsline{toc}{part}{\upm@format@newsection@alignment{#1}}}%
+	\chaptermark{}%
+}
+
+%-----
+% Chapter without number but inside the TOC
+%\chaptertoc [toctitle]{title} % left-alignment inside TOC
+%\chaptertoc*[toctitle]{title} % right-alignment inside TOC
+\def\chaptertoc{\@ifstar%
+	{\gdef\upm@format@newsection@alignment{\protect\numberline{}}\expandafter\upm@format@newsection@chapter}%
+	{\gdef\upm@format@newsection@alignment{}\expandafter\upm@format@newsection@chapter}}
+
+\def\upm@format@newsection@chapter{\@ifnextchar[%
+	{\upm@format@newsection@chapter@a}%
+	{\upm@format@newsection@chapter@b}%
+}
+
+\def\upm@format@newsection@chapter@a[#1]#2{%
+	\expandafter\chapter*[#1]{#2}%
+	\addcontentsline{toc}{chapter}{\upm@format@newsection@alignment{#1}}%
+	\@ifundefined{minitoc}{}{%
+		\global\addtocounter{mtc}{1}%
+	}%
+}
+
+\def\upm@format@newsection@chapter@b#1{%
+	\expandafter\chapter*{#1}%
+	\addcontentsline{toc}{chapter}{\upm@format@newsection@alignment{#1}}%
+	\@ifundefined{minitoc}{}{%
+		\global\addtocounter{mtc}{1}%
+	}%
+}
+
+%-----
+% Section without number but inside the TOC
+%\sectiontoc [toctitle]{title} % left-alignment inside TOC
+%\sectiontoc*[toctitle]{title} % right-alignment inside TOC
+\def\sectiontoc{\@ifstar%
+	{\gdef\upm@format@newsection@alignment{\protect\numberline{}}\expandafter\upm@format@newsection@section}%
+	{\gdef\upm@format@newsection@alignment{}\expandafter\upm@format@newsection@section}}
+\def\upm@format@newsection@section{\@ifnextchar [%
+	{\expandafter\upm@format@newsection@section@opt}%
+	{\expandafter\upm@format@newsection@section@nopt}}
+\def\upm@format@newsection@section@opt[#1]#2{%
+	\section*{#2\addcontentsline{toc}{section}{\upm@format@newsection@alignment{#1}}}%
+}
+\def\upm@format@newsection@section@nopt#1{%
+	\section*{#1\addcontentsline{toc}{section}{\upm@format@newsection@alignment{#1}}}%
+}
+
+%-----
+% Subsection without number but inside the TOC
+%\subsectiontoc [toctitle]{title} % left-alignment inside TOC
+%\subsectiontoc*[toctitle]{title} % right-alignment inside TOC
+\def\subsectiontoc{\@ifstar%
+	{\gdef\upm@format@newsection@alignment{\protect\numberline{}}\expandafter\upm@format@newsection@subsection}%
+	{\gdef\upm@format@newsection@alignment{}\expandafter\upm@format@newsection@subsection}}
+\def\upm@format@newsection@subsection{\@ifnextchar [%
+	{\expandafter\upm@format@newsection@subsection@opt}%
+	{\expandafter\upm@format@newsection@subsection@nopt}}
+\def\upm@format@newsection@subsection@opt[#1]#2{%
+	\subsection*{#2\addcontentsline{toc}{subsection}{\upm@format@newsection@alignment{#1}}}%
+}
+\def\upm@format@newsection@subsection@nopt#1{%
+	\subsection*{#1\addcontentsline{toc}{subsection}{\upm@format@newsection@alignment{#1}}}%
+}
+
+%-----
+% Subsubsection without number but inside the TOC
+%\subsubsectiontoc [toctitle]{title} % left-alignment inside TOC
+%\subsubsectiontoc*[toctitle]{title} % right-alignment inside TOC
+\def\subsubsectiontoc{\@ifstar%
+	{\gdef\upm@format@newsection@alignment{\protect\numberline{}}\expandafter\upm@format@newsection@subsubsection}%
+	{\gdef\upm@format@newsection@alignment{}\expandafter\upm@format@newsection@subsubsection}}
+\def\upm@format@newsection@subsubsection{\@ifnextchar [%
+	{\expandafter\upm@format@newsection@subsubsection@opt}%
+	{\expandafter\upm@format@newsection@subsubsection@nopt}}
+\def\upm@format@newsection@subsubsection@opt[#1]#2{%
+	\subsubsection*{#2\addcontentsline{toc}{subsubsection}{\upm@format@newsection@alignment{#1}}}%
+}
+\def\upm@format@newsection@subsubsection@nopt#1{%
+	\subsubsection*{#1\addcontentsline{toc}{subsubsection}{\upm@format@newsection@alignment{#1}}}%
+}
+
+%-----
+% Chapter with different titles for in the TOC, the headers and on the pages
+%\chapterfull[in toc]{on page}{in header} % with number
+%\chapterfull*[in toc]{on page}{in header} % without number
+\def\chapterfull{\@ifstar%
+	{\gdef\upm@format@newsection@thesectionmacro{\chapter*}\upm@format@newsection@chapterfull}%
+	{\gdef\upm@format@newsection@thesectionmacro{\chapter}\upm@format@newsection@chapterfull}%
+}
+
+\def\upm@format@newsection@chapterfull{\@ifnextchar[%
+	\upm@format@newsection@chapterfull@a%
+	\upm@format@newsection@chapterfull@b%
+}
+
+\def\upm@format@newsection@chapterfull@a[#1]#2#3{%
+	\upm@format@newsection@thesectionmacro[#1]{#2}%
+	\chaptermark{#3}%
+}
+
+\def\upm@format@newsection@chapterfull@b#1#2{%
+	\upm@format@newsection@thesectionmacro{#1}%
+	\chaptermark{#2}%
+}
+
+%-----
+% Section with different titles for in the TOC, the headers and on the pages
+%\sectionfull[in toc]{on page}{in header} % with number
+%\sectionfull*[in toc]{on page}{in header} % without number
+\def\sectionfull{\@ifstar%
+	{\gdef\upm@format@newsection@thesectionmacro{\section*}\upm@format@newsection@sectionfull}%
+	{\gdef\upm@format@newsection@thesectionmacro{\section}\upm@format@newsection@sectionfull}%
+}
+
+\def\upm@format@newsection@sectionfull{\@ifnextchar[%
+	\upm@format@newsection@sectionfull@a%
+	\upm@format@newsection@sectionfull@b%
+}
+
+\def\upm@format@newsection@sectionfull@a[#1]#2#3{%
+	\upm@format@newsection@thesectionmacro[#1]{#2}%
+	\global\sectionmark{#3}%
+}
+
+\def\upm@format@newsection@sectionfull@b#1#2{%
+	\upm@format@newsection@thesectionmacro{#1}%
+	\global\sectionmark{#2}%
+}
+
+%----------------------------------------
+% BIBLIOGRAPHY
+%----------------------------------------
+
+%-----
+%\bibsize{size}
+\newcommand{\bibsize}[1]{\gdef\upm@bibsize{#1}}
+
+\gdef\upm@bibsize{\small}
+
+\gdef\@biblabel#1{{\upm@bibsize{[#1]}}}
+
+\gdef\@lbibitem[#1]#2{\item[\@biblabel{#1}\hfill]\upm@bibsize\if@filesw{%
+	\let\protect\noexpand\immediate\write\@auxout{\string\bibcite{#2}{#1}}}\fi\ignorespaces}
+
+\gdef\@bibitem#1{\item\upm@bibsize\if@filesw%
+	\immediate\write\@auxout{\string\bibcite{#1}{\the\value{\@listctr}}}\fi\ignorespaces}
+
+
+%----------------------------------------
+% TABLE OF CONTENT
+%----------------------------------------
+\setcounter{secnumdepth}{3}
+\setcounter{tocdepth}{3}
+
+% Change the color of the TOC for the "dotted" lines
+%\let\upm@format@dottedtocline@old\@dottedtocline
+%\gdef\@dottedtocline#1#2#3#4#5{%
+%	%{depth}{left margin}{right margin}{text}{page number}
+%	\upm@format@dottedtocline@old{#1}{#2}{#3}{#4}{#5}%
+%}
+
+% Change the color of the TOC for the parts
+\@ifundefined{l@part}{}{
+\let\upm@format@l@part@old\l@part
+\renewcommand*\l@part[2]{%
+	%{text}{page number}
+	\upm@format@l@part@old{\textcolor{parttitlecolor}{#1}}{\textcolor{parttitlecolor}{#2}}%
+}
+}
+
+% Change the color of the TOC for the chapters
+\@ifundefined{l@chapter}{}{
+\let\upm@format@l@chapter@old\l@chapter
+\renewcommand*\l@chapter[2]{%
+	%{text}{page number}
+	\upm@format@l@chapter@old{\textcolor{chaptertitlecolor}{#1}}{\textcolor{chaptertitlecolor}{#2}}%
+}
+}
+
+% Overide the color and font configurations of the MINITOC package
+\AtBeginDocument{
+	\@ifundefined{minitoc}{}{%
+		% Chapter
+		\gdef\mtifont{\normalfont\large\upshape\bfseries\color{chaptertitlecolor}}
+		% Section
+		\gdef\mtcSfont{\normalfont\small\upshape\bfseries\color{sectiontitlecolor}}
+		% Sub-Section and SubSub-Section
+		\gdef\mtcSSfont{\normalfont\small\upshape\mdseries\normalcolor}
+		\global\let\mtcSSSfont\mtcSSfont
+	}
+}
+
+%----------------------------------------
+% ENUMERATIONS
+%----------------------------------------
+\newcounter{upm@fmt@savedcounter}
+
+\newcommand{\savecounter}[1]{%
+	\setcounter{upm@fmt@savedcounter}{\value{#1}}%
+}
+\newcommand{\restorecounter}[1]{%
+	\setcounter{#1}{\theupm@fmt@savedcounter}%
+}
+
+\ifupm@use@override@standard@lists
+	\newcommand{\saveenumcounter}{\savecounter{@upm@fmt@enumdescription@cnt@}}
+	\newcommand{\restoreenumcounter}{\restorecounter{@upm@fmt@enumdescription@cnt@}}
+	\newcommand{\setenumcounter}[1]{\setcounter{@upm@fmt@enumdescription@cnt@}{#1}}
+	\newcommand{\getenumcounter}{\the@upm@fmt@enumdescription@cnt@}
+\else
+	\newcommand{\saveenumcounter}{\savecounter{@enumctr}}
+	\newcommand{\restoreenumcounter}{\restorecounter{@enumctr}}
+	\newcommand{\setenumcounter}[1]{\setcounter{@enumctr}{#1}\addtocounter{@enumctr}{-1}}
+	\newcommand{\getenumcounter}{\value{@enumctr}}
+\fi
+
+%----------------------------------------
+% FOOTNOTE
+%----------------------------------------
+
+\gdef\upm@footnoteref#1{\upm@textsuperscript{#1}}
+\gdef\upm@footnotepageref#1#2{\upm@textsuperscript{{#1\tiny(#2)}}}
+
+\def\upm@savefootnote#1#2{%
+	\footnote{#1\label{\upm@protect{footnote:#2}}}%
+	\upm@nameundef{footnote:#2:cmd}%
+}
+\def\upm@savefootnotestar#1#2{%
+	\upm@namedef{footnote:#2:cmd}{\upm@savefootnote{#1}{#2}}%
+}
+
+\DeclareRobustCommand\savefootnote{\@ifstar\upm@savefootnotestar\upm@savefootnote}
+
+\def\upm@reffootnote#1{%
+	\upm@ifdefinedname{footnote:#1:cmd}{%
+		\upm@nameuse{footnote:#1:cmd}}{%
+		\upm@footnoteref{\upm@getref{\upm@protect{footnote:#1}}}%
+	}%
+	\xspace%
+} 
+\def\upm@reffootnotestar#1{%
+	\upm@ifdefinedname{footnote:#1:cmd}{%
+		\upm@nameuse{footnote:#1:cmd}}{%
+		\xdef\upm@tmp@tmp{\upm@protect{footnote:#1}}%
+		\upm@footnotepageref{\expandafter\upm@getref{\upm@tmp@tmp}}{\expandafter\upm@getpageref{\upm@tmp@tmp}}%
+		\global\let\upm@tmp@tmp\relax%
+	}%
+	\xspace%
+} 
+
+\DeclareRobustCommand\reffootnote{\@ifstar\upm@reffootnotestar\upm@reffootnote}
+
+%----------------------------------------
+% IMAGES IN PARAGRAPHS
+%----------------------------------------
+
+\newenvironment{umlinpar}[2][width=.45\linewidth]{%
+\begin{window}[0,r,{\mbox{\hspace{.5cm}\includegraphics[#1]{#2}\vspace{.5cm}}},{}]
+}{%
+\end{window}}
+
+%----------------------------------------
+% DATE
+%----------------------------------------
+
+%Build a date that has the format supported by tex-upmethodology
+%\makedate{day}{month}{year}
+\let\makedate\upm@format@lang@makedate
+
+%-----
+%Replies the year corresponding to the given supported date
+%\extractyear{date}
+\let\extractyear\upm@format@lang@extractyear
+
+%-----
+%Replies the month corresponding to the given supported date
+%\extractmonth{date}
+\let\extractmonth\upm@format@lang@extractmonth
+
+%-----
+%Replies the day corresponding to the given supported date
+%\extractday{date}
+\let\extractday\upm@format@lang@extractday
+
+% Redefine the today function
+\AtBeginDocument{\global\edef\today{\makedate{\the\day}{\the\month}{\the\year}}}
+
+%----------------------------------------
+% PEOPLE NAME
+%----------------------------------------
+
+\def\makenamespacing#1{%
+	\upm@format@makenamespacing{#1}\xspace%
+}
+
+\def\upm@format@makenamespacing#1{%
+	\upm@foreach.\in#1\do{%
+		\ignorespaces\upm@foreach@term.\,%
+	}{%
+		\ignorespaces\upm@foreach@term%
+	}%
+}
+
+\gdef\upm@format@people@title#1{\textsc{#1}}
+\def\upm@format@firstname@format#1{%
+	{\smaller\textsc{\upm@format@makenamespacing{#1}}}%
+}
+\def\upm@format@von@format#1{\mbox{\smaller\ignorespaces#1}}
+\def\upm@format@lastname@format#1{\textsc{\ignorespaces#1}}
+
+%\upmmakename[von]{firstname}{lastname}{separator}
+\newcommand{\upmmakename}[4][\relax]{%
+	\ifx#1\relax%
+		{\upm@format@firstname@format{#2}#4\upm@format@lastname@format{#3}}%
+	\else%
+		{\upm@format@firstname@format{#2}#4\upm@format@von@format{#1}#4\upm@format@lastname@format{#3}}%
+	\fi%
+	\xspace%
+}
+\newcommand{\upmmakenamestar}[4][\relax]{%
+	\ifx#1\relax%
+		{\upm@format@lastname@format{#3}#4\upm@format@firstname@format{#2}}%
+	\else%
+		{\upm@format@lastname@format{#3}#4\upm@format@von@format{#1}#4\upm@format@firstname@format{#2}}%
+	\fi%
+	\xspace%
+}
+
+%\makename[von]{firstname}{lastname}
+\newcommand{\makename}[3][\relax]{%
+	\upmmakename[#1]{#2}{#3}{\ }%
+}
+
+%\makelastname[von]{lastname}
+\newcommand{\makelastname}[2][\relax]{%
+	\ifx#1\relax%
+		\upm@format@lastname@format{#2}%
+	\else%
+		\upm@format@von@format{#1}\ \upm@format@lastname@format{#2}%
+	\fi%
+	\xspace%
+}
+
+%\makefirstname{firstname}
+\newcommand{\makefirstname}[1]{%
+	\upm@format@firstname@format{#1}\xspace%
+}
+
+%\prname[von]{firstname}{lastname}
+%\prname*[von]{firstname}{lastname}
+\def\prname{\@ifstar\upm@prnamestar\upm@prname}
+\newcommand{\upm@prname}[3][\relax]{%
+	\upm@format@people@title{\upm@format@lang@professor}\,\upmmakename[#1]{#2}{#3}{\ }%
+}
+\newcommand{\upm@prnamestar}[3][\relax]{%
+	\upmmakename[#1]{#2}{#3}{\ }, \upm@format@people@title{\upm@format@lang@professor}%
+}
+
+%\drname[von]{firstname}{lastname}
+%\drname*[von]{firstname}{lastname}
+\def\drname{\@ifstar\upm@drnamestar\upm@drname}
+\newcommand{\upm@drname}[3][\relax]{%
+	\upm@format@people@title{\upm@format@lang@doctor}\,\upmmakename[#1]{#2}{#3}{\ }%
+}
+\newcommand{\upm@drnamestar}[3][\relax]{%
+	\upmmakename[#1]{#2}{#3}{\ }, \upm@format@people@title{\upm@format@lang@doctor}%
+}
+
+%\phdname[von]{firstname}{lastname}
+%\phdname*[von]{firstname}{lastname}
+\def\phdname{\@ifstar\upm@phdnamestar\upm@phdname}
+\newcommand{\upm@phdname}[3][\relax]{%
+	\upm@format@people@title{\upm@format@lang@phdoctor}\,\upmmakename[#1]{#2}{#3}{\ }%
+}
+\newcommand{\upm@phdnamestar}[3][\relax]{%
+	\upmmakename[#1]{#2}{#3}{\ }, \upm@format@people@title{\upm@format@lang@phdoctor}%
+}
+
+%\scdname[von]{firstname}{lastname}
+%\scdname*[von]{firstname}{lastname}
+\def\scdname{\@ifstar\upm@scdnamestar\upm@scdname}
+\newcommand{\upm@scdname}[3][\relax]{%
+	\upm@format@people@title{\upm@format@lang@scdoctor}\,\upmmakename[#1]{#2}{#3}{\ }%
+}
+\newcommand{\upm@scdnamestar}[3][\relax]{%
+	\upmmakename[#1]{#2}{#3}{\ }, \upm@format@people@title{\upm@format@lang@scdoctor}%
+}
+
+%\mdname[von]{firstname}{lastname}
+%\mdname*[von]{firstname}{lastname}
+\def\mdname{\@ifstar\upm@mdnamestar\upm@mdname}
+\newcommand{\upm@mdname}[3][\relax]{%
+	\upm@format@people@title{\upm@format@lang@mdoctor}\,\upmmakename[#1]{#2}{#3}{\ }%
+}
+\newcommand{\upm@mdnamestar}[3][\relax]{%
+	\upmmakename[#1]{#2}{#3}{\ }, \upm@format@people@title{\upm@format@lang@mdoctor}%
+}
+
+%\pengname[von]{firstname}{lastname}
+%\pengname*[von]{firstname}{lastname}
+\def\pengname{\@ifstar\upm@pengnamestar\upm@pengname}
+\newcommand{\upm@pengname}[3][\relax]{%
+	\upm@format@people@title{\upm@format@lang@professionalengineer}\,\upmmakename[#1]{#2}{#3}{\ }%
+}
+\newcommand{\upm@pengnamestar}[3][\relax]{%
+	\upmmakename[#1]{#2}{#3}{\ }, \upm@format@people@title{\upm@format@lang@professionalengineer}%
+}
+
+%\iengname[von]{firstname}{lastname}
+%\iengname*[von]{firstname}{lastname}
+\def\iengname{\@ifstar\upm@iengnamestar\upm@iengname}
+\newcommand{\upm@iengname}[3][\relax]{%
+	\upm@format@people@title{\upm@format@lang@incorporatedengineer}\,\upmmakename[#1]{#2}{#3}{\ }%
+}
+\newcommand{\upm@iengnamestar}[3][\relax]{%
+	\upmmakename[#1]{#2}{#3}{\ }, \upm@format@people@title{\upm@format@lang@incorporatedengineer}%
+}
+
+%----------------------------------------
+% INLINE ENUMERATION
+%----------------------------------------
+
+\newcounter{@@upm@fmt@inlineenumeration}
+\newcommand{\inlineenumerationlabel}[1]{(#1)}
+\let\upm@fmt@inlineenum@numberformat\roman
+\newenvironment{inlineenumeration}{%
+	\begingroup%
+	\let\upm@fmt@inlineenum@currentlabel\@currentlabel%
+	\renewcommand{\item}{\xdef\@currentlabel{\upm@fmt@inlineenum@numberformat{@@upm@fmt@inlineenumeration}}{\inlineenumerationlabel{\@currentlabel}{\addtocounter{@@upm@fmt@inlineenumeration}{1}}}~}%
+	\setcounter{@@upm@fmt@inlineenumeration}{1}%
+}{%
+	\global\let\@currentlabel\upm@fmt@inlineenum@currentlabel%
+	\endgroup%
+}
+
+%----------------------------------------
+% DESCRIPTION LIST WITH NUMBERS
+%----------------------------------------
+
+\newcounter{@upm@fmt@enumdescription@cnt@}
+\gdef\upm@fmt@enumdescription@savedlabel{}
+\gdef\upm@fmt@enumdescription@savedcounter{}
+\newcommand{\upm@fmt@enumdescription@fmt@}[1]{}
+\newcommand{\enumdescriptionlabel}[1]{\textbf{#1}}
+\newcommand{\enumdescriptioncounterseparator}{~-~}
+\newcommand{\enumdescriptionlabelseparator}{\upm@column@char}
+% #1: counter style.
+% #2: text before the counter.
+% #3: text after the counter.
+% #4: text between the counter and the description.
+% #5: text between the description and the rest of the text.
+% #6: text between the counter (no description) and the rest of the text.
+\newenvironment{upm@fmt@enumdescription}[6]{%
+	\begin{list}{}{%
+		\renewcommand{\upm@fmt@enumdescription@savedlabel}{\@currentlabel}%
+		\edef\upm@fmt@enumdescription@savedcounter{\the@upm@fmt@enumdescription@cnt@}%
+		\setcounter{@upm@fmt@enumdescription@cnt@}{1}%
+		\ifthenelse{\equal{#1}{a}}{%
+			\renewcommand{\upm@fmt@enumdescription@fmt@}[1]{#2\alph{##1}#3}%
+		}{%
+			\ifthenelse{\equal{#1}{A}}{%
+				\renewcommand{\upm@fmt@enumdescription@fmt@}[1]{#2\Alph{##1}#3}%
+			}{%
+				\ifthenelse{\equal{#1}{i}}{%
+					\renewcommand{\upm@fmt@enumdescription@fmt@}[1]{#2\roman{##1}#3}%
+				}{%
+					\ifthenelse{\equal{#1}{I}}{%
+						\renewcommand{\upm@fmt@enumdescription@fmt@}[1]{#2\Roman{##1}#3}%
+					}{%
+						\renewcommand{\upm@fmt@enumdescription@fmt@}[1]{#2\arabic{##1}#3}%
+					}%
+				}%
+			}%
+		}%
+		\renewcommand{\makelabel}[1]{%
+			\xdef\@currentlabel{\upm@fmt@enumdescription@fmt@{@upm@fmt@enumdescription@cnt@}}%
+			\enumdescriptionlabel{\@currentlabel#4##1\ifthenelse{\equal{a##1}{a}}{#6}{#5}}{\addtocounter{@upm@fmt@enumdescription@cnt@}{1}}}%
+		\expandafter\settowidth{\labelwidth}{#2iii#3}%
+	}
+}{%
+	\global\let\@currentlabel\upm@fmt@enumdescription@savedlabel%
+	\setcounter{@upm@fmt@enumdescription@cnt@}{\upm@fmt@enumdescription@savedcounter}%
+	\end{list}%
+}
+\newenvironment{enumdescriptionx}[3][i]{%
+	\begin{upm@fmt@enumdescription}{#1}{#2}{#3}{\enumdescriptioncounterseparator}{\enumdescriptionlabelseparator}{\enumdescriptionlabelseparator}%
+}{%
+	\end{upm@fmt@enumdescription}%
+}
+\newenvironment{enumdescription}[1][i]{%
+	\begin{upm@fmt@enumdescription}{#1}{}{}{\enumdescriptioncounterseparator}{\enumdescriptionlabelseparator}{\enumdescriptionlabelseparator}%
+}{%
+	\end{upm@fmt@enumdescription}%
+}
+
+%% Issue #14: enumerate behaves as enumdescription
+\ifupm@use@override@standard@lists
+	
+	\AtBeginDocument{
+		\message{*** Overriding the 'enumerate' environment. Pass option 'standardlists' for avoiding this override.}
+		\global\let\enumerate\@undefined
+		\global\let\endenumerate\@undefined
+		\global\NewEnviron{enumerate}[1][1\string.~]{%
+			% Parse the parameter for extracting the type of the enumeration, the prefix and the postfix
+			\in@{a}{#1}\ifin@
+				\gdef\upm@fmt@enumerate@style{a}%
+				\def\reserved@a##1a##2\@nil{%
+					\def\upm@fmt@enumerate@prefix{##1}%
+					\def\upm@fmt@enumerate@postfix{##2}%
+				}%
+				\reserved@a#1\@nil%
+			\else\in@{1}{#1}\ifin@
+				\gdef\upm@fmt@enumerate@style{1}%
+				\def\reserved@a##11##2\@nil{%
+					\def\upm@fmt@enumerate@prefix{##1}%
+					\def\upm@fmt@enumerate@postfix{##2}%
+				}%
+				\reserved@a#1\@nil%
+			\else\in@{A}{#1}\ifin@
+				\gdef\upm@fmt@enumerate@style{A}%
+				\def\reserved@a##1A##2\@nil{%
+					\def\upm@fmt@enumerate@prefix{##1}%
+					\def\upm@fmt@enumerate@postfix{##2}%
+				}%
+				\reserved@a#1\@nil%
+			\else\in@{i}{#1}\ifin@
+				\gdef\upm@fmt@enumerate@style{i}%
+				\def\reserved@a##1i##2\@nil{%
+					\def\upm@fmt@enumerate@prefix{##1}%
+					\def\upm@fmt@enumerate@postfix{##2}%
+				}%
+				\reserved@a#1\@nil%
+			\else\in@{I}{#1}\ifin@
+				\gdef\upm@fmt@enumerate@style{I}%
+				\def\reserved@a##1I##2\@nil{%
+					\def\upm@fmt@enumerate@prefix{##1}%
+					\def\upm@fmt@enumerate@postfix{##2}%
+				}%
+				\reserved@a#1\@nil%
+			\else%
+				\errmessage{Invalid format of the enumerate counter}
+			\fi\fi\fi\fi\fi%
+			\protected@xdef\upm@tmp{\protect\protect\protect\begin{upm@fmt@enumdescription}{\upm@fmt@enumerate@style}{\upm@fmt@enumerate@prefix}{\upm@fmt@enumerate@postfix}{}{\protect\enumdescriptionlabelseparator}{}}%
+			%
+			\upm@tmp%
+			%\protect\begin{upm@fmt@enumdescription}{#1}{}{\string.~}{}{\enumdescriptionlabelseparator}{}%
+			\BODY%
+			\protect\end{upm@fmt@enumdescription}%
+		}
+	}
+\fi
+
+%----------------------------------------
+% DESCRIPTION LIST WITH BULLETS
+%----------------------------------------
+\ifupm@use@override@standard@lists
+	\gdef\upm@fmt@itemizeddescription@separator{\upm@column@char\ }
+	\newcommand{\upm@fmt@itemizeddescription@formatdescription}[1]{\textbf{#1}}
+	\newcommand{\upm@fmt@itemizeddescription@desc}[2]{%
+		\upm@fmt@itemizeddescription@formatdescription{#1#2}%
+	}
+	\let\upm@fmt@olditem\item
+	\let\upm@item@param\upm@fmt@olditem
+	\let\upm@item@noparam\upm@fmt@olditem
+	\def\item{\@ifnextchar[\upm@item@param\upm@item@noparam}
+	\AtBeginDocument{
+		\message{*** Overriding the 'description' environment. Pass option 'standardlists' for avoiding this override.}
+		\global\let\description\@undefined
+		\global\let\enddescription\@undefined
+		\global\NewEnviron{description}[1][\upm@fmt@itemizeddescription@separator]{
+			\begin{itemize}%
+			\renewcommand{\upm@item@param}[1][]{\upm@fmt@olditem \upm@fmt@itemizeddescription@desc{##1}{#1}}%
+			\renewcommand{\upm@item@noparam}{\upm@fmt@olditem }%
+			\BODY%
+			\end{itemize}%
+		}
+	}
+\fi
+
+%----------------------------------------
+% SIZE MANAGEMENT
+%----------------------------------------
+\newenvironment{upmfontsize}[1]{%
+	\begingroup%
+	\let\upm@Huge\Huge%
+	\let\upm@huge\huge%
+	\let\upm@normalsize\normalsize%
+	\let\upm@small\small%
+	\let\upm@scriptsize\scriptsize%
+	\let\upm@footnotesize\footnotesize%
+	\let\upm@tiny\tiny%
+	%
+	\ifx#1\Huge%
+		\let\Huge\upm@Huge%
+		\let\huge\upm@Huge%
+		\let\small\upm@huge%
+		\let\scriptsize\upm@normalsize%
+		\let\footnotesize\upm@small%
+		\let\tiny\upm@scriptsize%
+	\else\ifx#1\huge%
+		\let\Huge\upm@Huge%
+		\let\huge\upm@Huge%
+		\let\small\upm@normalsize%
+		\let\scriptsize\upm@small%
+		\let\footnotesize\upm@scriptsize%
+		\let\tiny\upm@footnotesize%
+	\else\ifx#1\small%
+		\let\Huge\upm@huge%
+		\let\huge\upm@normalsize%
+		\let\small\upm@scriptsize%
+		\let\scriptsize\upm@footnotesize%
+		\let\footnotesize\upm@tiny%
+		\let\tiny\upm@tiny%
+	\else\ifx#1\scriptsize%
+		\let\Huge\upm@normalsize%
+		\let\huge\upm@small%
+		\let\small\upm@footnotesize%
+		\let\scriptsize\upm@tiny%
+		\let\footnotesize\upm@tiny%
+		\let\tiny\upm@tiny%
+	\else\ifx#1\footnotesize%
+		\let\Huge\upm@small%
+		\let\huge\upm@scriptsize%
+		\let\small\upm@tiny%
+		\let\scriptsize\upm@tiny%
+		\let\footnotesize\upm@tiny%
+		\let\tiny\upm@tiny%
+	\else\ifx#1\tiny%
+		\let\Huge\upm@scriptsize%
+		\let\huge\upm@footnotesize%
+		\let\small\upm@tiny%
+		\let\scriptsize\upm@tiny%
+		\let\footnotesize\upm@tiny%
+		\let\tiny\upm@tiny%
+	\fi%
+	\fi%
+	\fi%
+	\fi%
+	\fi%
+	\fi%
+	#1%
+}{\endgroup}
+
+%----------------------------------------
+% FRAMED MINIPAGE
+%----------------------------------------
+
+\newsavebox{\upm@framed@minipage}
+%\begin{framedminipage}{width}...\end{framedminipage}
+\newenvironment{framedminipage}[1]{%
+	\begin{lrbox}{\upm@framed@minipage}\begin{minipage}{#1}%
+	}{%
+	\end{minipage}\end{lrbox}\fbox{\usebox{\upm@framed@minipage}}}
+
+%\begin{framedcolorminipage}{width}{border}{background}...\end{framedcolorminipage}
+\newenvironment{framedcolorminipage}[3]{%
+	\newcommand{\upm@framed@minipage@border}{#2}%
+	\newcommand{\upm@framed@minipage@background}{#3}%
+	\begin{lrbox}{\upm@framed@minipage}\begin{minipage}{#1}%
+	}{%
+	\end{minipage}\end{lrbox}\fcolorbox{\upm@framed@minipage@border}{\upm@framed@minipage@background}{\usebox{\upm@framed@minipage}}}
+
+%----------------------------------------
+% HIGHLIGH BOXES
+%----------------------------------------
+
+\newsavebox{\upm@highlight@box@save}
+
+\newenvironment{upm@highligh@box}[2]{%
+	\par
+	\vspace{.5cm}
+	\begin{tabular}{|p{#1}|}
+	\hline
+	\begin{window}[0,l,{\mbox{\includegraphics[width=1cm]{#2}}},{}]
+}{%
+	\end{window}\\ \hline \end{tabular}
+	\vspace{.5cm}
+	\par
+}
+
+\newenvironment{upmcaution}[1][\linewidth]{%
+	\upm@highligh@box{#1}{upm_caution.png}%
+}{%
+	\endupm@highligh@box%
+}
+
+\newenvironment{upminfo}[1][\linewidth]{%
+	\upm@highligh@box{#1}{upm_info.png}%
+}{%
+	\endupm@highligh@box%
+}
+
+\newenvironment{upmquestion}[1][\linewidth]{%
+	\upm@highligh@box{#1}{upm_question.png}%
+}{%
+	\endupm@highligh@box%
+}
+
+%----------------------------------------
+% PROVIDE URL MACROS, WHICH WILL BE
+% OVERRIDDEN BY THE DOCUMENT CLASS
+%----------------------------------------
+
+\newcommand{\url}[2][]{\texttt{#2}}
+\newcommand{\href}[3][]{\texttt{#3}}
+
+%----------------------------------------
+% Exponents and Indices
+%----------------------------------------
+\gdef\textup#1{\textsuperscript{#1}\xspace}
+\def\@textsubscript#1{%
+  {\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}}
+\gdef\textsubscript#1{\@textsubscript{\selectfont#1}}
+\gdef\textdown#1{\textsubscript{#1}\xspace}
+
+
+%----------------------------------------
+% UNDERLINE
+%----------------------------------------
+
+\let\upm@oldunderline\underline
+\renewcommand{\underline}[1]{\upm@oldunderline{\smash{#1}}}
+
+%----------------------------------------
+% ENVIRONMENT FOR DEFINITIONS
+%----------------------------------------
+
+%-----
+% Defining the style for the definitions
+\colorlet{definitionbackground}{backtableheader}
+\colorlet{definitionheaderforeground}{fronttableheader}
+\colorlet{definitionborder}{fronttableheader}
+\colorlet{definitiontextforeground}{fronttableheader}
+
+\ifupmlang{french}{
+	\gdef\definitionname{D\'efinition}
+	\gdef\listdefinitionname{Liste des d\'efinitions}
+}{
+	\gdef\definitionname{Definition}
+	\gdef\listdefinitionname{List of Definitions}
+}
+
+\gdef\upm@definition@width{.9\linewidth}
+\gdef\upm@definition@rule@width{\linewidth}
+\gdef\upm@definition@rule@height{0.4pt}
+
+\newtheoremstyle{upmdefinition}% name of the style to be used
+	  {}% measure of space to leave above the theorem. E.g.: 3pt
+	  {}% measure of space to leave below the theorem. E.g.: 3pt
+	  {\normalfont}% name of font to use in the body of the theorem
+	  {}% measure of space to indent the head
+	  {\normalfont\bfseries}% name of head font
+	  {\\[-1em]{\textcolor{definitionborder}{\rule{\upm@definition@rule@width}{\upm@definition@rule@height}}}}% punctuation between head and body
+	  {\newline}% space after theorem head
+	  {\textcolor{definitionheaderforeground}{\thmname{#1}\thmnumber{~#2}\upm@column@char\thmnote{ #3}}\vspace{.25em}}% Manually specify head
+
+%-----
+% Declare a theorem with the standard UPM style
+% \declareupmtheorem[theorem_style]{name}{label}{list_label}
+\newcommand{\declareupmtheorem}[4][upmdefinition]{%
+	\global\declaretheorem[name={#3},style=#1]{upm#2}%
+	\global\newenvironment{#2}[1][]{%
+		\par\vspace{\parsep}\centering\begin{framedcolorminipage}{\upm@definition@width}{definitionborder}{definitionbackground}%
+		\color{definitiontextforeground}%
+		\begin{upm#2}[##1]%
+	}{%
+		\end{upm#2}%
+		\end{framedcolorminipage}\vspace{\parsep}\par%
+	}%
+	% Check the version of the thmtools because the TeXLive distribution
+	% gives a too old version.
+	\@ifpackagelater{thm-listof}{2012/05/03}{%
+		\global\@namedef{listof#2s}{%
+			\global\let\upm@definition@old@listtheoremname\listtheoremname%
+			\global\let\upm@definition@old@upmtheoremopt\upm@definition@upmtheoremopt%
+			\gdef\listtheoremname{#4}%
+			\renewcommand{\upm@definition@upmtheoremopt}[1]{}%
+			\expandafter\listoftheorems[ignoreall,show={upm#2}]%
+			\global\let\listtheoremname\upm@definition@old@listtheoremname%
+			\global\let\upm@definition@upmtheoremopt\upm@definition@old@upmtheoremopt%
+		}%
+	}{%
+		\@latex@warning{Your version of the thmtools is too old. I recommend you to install the version 2012/05/04, or later.}
+		\global\@namedef{listof#2s}{%
+			\global\let\upm@tmp\listtheoremname%
+			\gdef\listtheoremname{#4}%
+			\listoftheorems%
+			\global\let\listtheoremname\upm@tmp%
+		}%
+	}
+}
+\@onlypreamble\declareupmtheorem
+
+\gdef\thmtformatoptarg#1{\upm@column@char\ #1}%
+
+% Permits to define a part of the definition's name that is
+% rendered only in core part of the document, not in the
+% list of theorems
+\gdef\upm@definition@upmtheoremopt#1{#1}
+\gdef\upmtheoremopt#1{\protect\upm@definition@upmtheoremopt{#1}}
+
+%-----
+% Declare the definition environment
+\declareupmtheorem{definition}{\definitionname}{\listdefinitionname}
+
+%----------------------------------------
+% ENVIRONMENT FOR EMPHBOX
+%----------------------------------------
+
+%-----
+% Defining the style for the emphbox
+\colorlet{emphboxbackground}{backtableheader}
+\colorlet{emphboxborder}{fronttableheader}
+\colorlet{emphboxtext}{fronttableheader}
+
+\NewEnviron{emphbox}[1][\linewidth]{%
+	\begin{framedcolorminipage}{#1}{emphboxborder}{emphboxbackground}%
+		\centering\color{emphboxtext}\BODY%
+	\end{framedcolorminipage}%
+}
+
+\endinput
+
-- 
cgit v1.2.3

