texlive[41559] Master/texmf-dist: optidef (28jun16)

commits+karl at tug.org commits+karl at tug.org
Tue Jun 28 23:01:33 CEST 2016


Revision: 41559
          http://tug.org/svn/texlive?view=revision&revision=41559
Author:   karl
Date:     2016-06-28 23:01:33 +0200 (Tue, 28 Jun 2016)
Log Message:
-----------
optidef (28jun16)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/optidef/README.md
    trunk/Master/texmf-dist/doc/latex/optidef/optidef.pdf
    trunk/Master/texmf-dist/doc/latex/optidef/optidef.tex
    trunk/Master/texmf-dist/tex/latex/optidef/optidef.sty

Modified: trunk/Master/texmf-dist/doc/latex/optidef/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/optidef/README.md	2016-06-28 21:01:23 UTC (rev 41558)
+++ trunk/Master/texmf-dist/doc/latex/optidef/README.md	2016-06-28 21:01:33 UTC (rev 41559)
@@ -69,7 +69,7 @@
 
 Github: https://github.com/jeslago/optidef
 
-## Latest stable version: Optidef 1.1
+## Latest stable version: Optidef 1.2
 
 CTAN: https://www.ctan.org/pkg/optidef
 

Modified: trunk/Master/texmf-dist/doc/latex/optidef/optidef.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/optidef/optidef.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/optidef/optidef.tex	2016-06-28 21:01:23 UTC (rev 41558)
+++ trunk/Master/texmf-dist/doc/latex/optidef/optidef.tex	2016-06-28 21:01:33 UTC (rev 41559)
@@ -2,9 +2,12 @@
 \usepackage{remreset}
 \usepackage{optidef}
 \usepackage{listings}
-
+\lstset{
+	language=TeX,
+	breaklines=true,
+}
 % Title Page
-\title{\textit{\textbf{Optidef}} \\ A Latex library for optimization problems\\ \textnormal{Version - 1.1}}
+\title{\textit{\textbf{Optidef}} \\ A Latex library for optimization problems\\ \textnormal{Version - 1.2}}
 
 \author{Jesus Lago Garcia}
 
@@ -259,7 +262,7 @@
 	\addConstraint{g(w)}{=0 \label{eq:C1Example3}}
 	\addConstraint{n(w)}{= 6 \label{eq:C2Example3}}
 	\addConstraint{L(w)+r(x)}{=Kw+p \label{eq:C3Example3}}
-	\addConstraint{h(x)}{=0. \label{eq:C4Example3}}
+	\addConstraint{h(x)}{=0.\label{eq:C4Example3}}
 \end{mini!}
 
 \subsubsection{Example 4 - mini + problem result}
@@ -399,7 +402,7 @@
 \end{mini*}
 
 
-\subsubsection{Example 7 - mini environment on the unconstrained case}
+\subsubsection{Example 9 - mini environment on the unconstrained case}
 
 \begin{verbatim}
 
@@ -499,42 +502,23 @@
 	\addConstraint{r(x_0,x_N)}{= 0.  \label{dOCP:boundary}}
 \end{mini!}
 
-\noindent If you want to increase the size of the optimization variables:
-\noindent A possible way to avoid this is to stack them with the command: \begin{verbatim}
-\substack{\displaystyle x_0,u_0,x_1,\hdots,\\ \displaystyle u_{N-1},x_N}
-\end{verbatim}
-
-\begin{mini!}
-	{\substack{\displaystyle x_0,u_0,x_1,\hdots,\\ \displaystyle u_{N-1},x_N}}
-	{\sum_{k=0}^{N-1} L(x_k,u_k)\!\!+\!\!E(x_N)\label{OCPobj}}
-	{\label{eq:OCP}}{}
-	\addConstraint{x_{k+1}-f(x_k,u_k)}{=  0, \label{dOCP:modelc}\quad k=0,\dots,N-1}
-	\addConstraint{h(x_k,u_k)}{\leq 0,  \quad k=0,\dots,N-1}
-	\addConstraint{r(x_0,x_N)}{= 0.  \label{dOCP:boundary}}
-\end{mini!}
-
 \section{Code definition}
-\begin{verbatim}
-%optidef - Version 1.1
+\begin{lstlisting}
+% optidef - Version 1.2
+%
 %Copyright 2016 J. Lago Garcia
-
-%This work may be distributed and/or modified under the conditions of the LaTeX
-%Project Public License, either version 1.3 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.3 or later is part of all distributions of LaTeX version 2005/12/01 or 
-%later.
-
-%This work has the LPPL maintenance status 'maintained'. The Current Maintainer 
-% of this work is J. Lago Garcia, under the supervision of Prof. Dr. Moritz Diehl 
-%and Prof. Dr. Sebastien Gross.
-
+%
+%This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 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.3 or later is part of all distributions of LaTeX version 2005/12/01 or later.
+%
+%This work has the LPPL maintenance status 'maintained'. The Current Maintainer of this work is J. Lago Garcia, under the supervision of Prof. Dr. Moritz Diehl and Prof. Dr. Sebastien Gross.
+%
 %E-mail: jesus.lago.garcia at venus.uni-freiburg.de
-
+%
 %This work consists of the file optidef.sty.
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{optidef}[2016/06/26 - version=1.1,  Package for defining optimization problems]
+\ProvidesPackage{optidef}[2016/06/28 - version=1.2,  Package for defining optimization problems]
 
 \RequirePackage{environ}
 \RequirePackage{mathtools}	
@@ -541,11 +525,18 @@
 \RequirePackage{xifthen}	
 \RequirePackage{etoolbox}	
 \RequirePackage{xparse}	
+\RequirePackage{multirow}	
+
+% Toogle to indicate if during the addConstraint command the first constraint should be built together with "subject to"
 \newtoggle{bodyCon}
 \toggletrue{bodyCon}
 
-% Input minimization evironments
+% If the previous constraints has 3 elements, we avoid setting \span\span at the beginning of the next constraint. If there is no previous third element, \span\span must be included for correct alignment
+\newtoggle{previousThird}
+\togglefalse{previousThird}
+\newcommand{\spanit}{}
 
+
 % Macros for objective definition, constraint definition and extra constraint definition
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 % % -------- DEFINITION COMMAND OBJECTIVE  -----------
@@ -554,10 +545,12 @@
 {
 \ifthenelse{\isempty{#4}}
 {
-&\underset{\displaystyle #1}{\mathrm{#3}} \quad #2\span\span\span\span
+%&\underset{\displaystyle #1}{\mathrm{#3}} \quad #2\span\span\span\span
+&\underset{\displaystyle #1}{\mathrlap{\mathrm{#3}}\phantom{\mathrm{subject~to}}} \quad #2\span\span\span\span
 }
 {
-#4 ~~ &\underset{\displaystyle #1}{\mathrm{#3}} \quad #2\span\span\span\span
+%#4 ~~ &\underset{\displaystyle #1}{\mathrm{#3}} \quad #2\span\span\span\span
+#4 ~~ &\underset{\displaystyle #1}{\mathrlap{\mathrm{#3}}\phantom{\mathrm{subject~to}}} \quad #2\span\span\span\span
 }
 }
 
@@ -568,7 +561,7 @@
 
 \DeclareDocumentCommand{\bodyconst}{m G{}}
 {	\ifthenelse{\equal{#2}{}}{
-\\ &\mathrm{subject~to} \quad &&#1 #2
+\\ &\mathrm{subject~to} \quad &&#1 #2 
 }{
 \\ &\mathrm{subject~to} \quad &#1 & #2
 }
@@ -575,55 +568,108 @@
 }
 
 % Standard version
-\DeclareDocumentCommand{\bodyconstRight}{m G{}}
-{	\ifthenelse{\equal{#2}{}}{
-\\ &\mathrm{subject~to} \quad &&#1 #2
+\DeclareDocumentCommand{\bodyconstRight}{m G{} G{}}
+{	\ifthenelse{\equal{#3}{}}{
+\ifthenelse{\equal{#2}{}}{
+\\ &\mathrm{subject~to} \quad &&#1 #2 	
 }{
-\\ &\mathrm{subject~to} \quad &#1 & #2
+\\ &\mathrm{subject~to} \quad &#1 & #2 
 }
+\togglefalse{previousThird}
+}{
+\ifthenelse{\equal{#2}{}}{
+\\ &\mathrm{subject~to} \quad &&#1 #2 &&#3
+}{
+\\ &\mathrm{subject~to} \quad &#1 & #2 &&#3
 }
+\toggletrue{previousThird}
+}
+}
 
 % Single alignment point
-\DeclareDocumentCommand{\bodyconstOneAlign}{m G{}}
+\DeclareDocumentCommand{\bodyconstOneAlign}{m G{} G{}}
 {
-\\ &\mathrm{subject~to} \quad &&#1 #2
+\ifthenelse{\equal{#3}{}}{
+\\ &\mathrm{subject~to} \quad &&#1 #2 	\togglefalse{previousThird}
+}{
+\\ &\mathrm{subject~to} \quad &&#1 #2 &&#3
+\toggletrue{previousThird}
 }
+}
 
 % Contraints below subject to and with a single alignment point
-\DeclareDocumentCommand{\bodyconstOneAlignBelow}{m G{}}
+\DeclareDocumentCommand{\bodyconstOneAlignBelow}{m G{} G{}}
 {
-\\ &\mathrm{subject~to} \span\span \\
-&&&#1 #2		
+\ifthenelse{\equal{#3}{}}{
+\\ &\mathrm{subject~to} \span\span\span\span \\
+&&&#1 #2 \togglefalse{previousThird}
+}{
+\\ &\mathrm{subject~to} \span\span\span\span \\
+&&&#1 #2 &&#3	
+\toggletrue{previousThird}
+}	
 }
 
 % Contraints below subject to
-\DeclareDocumentCommand{\bodyconstBelow}{m G{}}
-{	\ifthenelse{\equal{#2}{}}{
+\DeclareDocumentCommand{\bodyconstBelow}{m G{} G{}}
+{
+\ifthenelse{\equal{#3}{}}{
+\ifthenelse{\equal{#2}{}}{
 \\ &\mathrm{subject~to} \span\span\span\span \\
-&&&#1 #2		
+&&&#1 #2 
 }{
 \\ &\mathrm{subject~to} \span\span\span\span \\
-&&#1 & #2
+&&#1 & #2 
 }
+\togglefalse{previousThird}
+}{
+\ifthenelse{\equal{#2}{}}{
+\\ &\mathrm{subject~to} \span\span\span\span \\
+&&&#1 #2 &&#3
+}{
+\\ &\mathrm{subject~to} \span\span\span\span \\
+&&#1 & #2 &&#3
 }
+\toggletrue{previousThird}	
+}
+}
 
 % Contraints below subject to for the case of having multiple equations
-\DeclareDocumentCommand{\bodyconstBelowMult}{m G{}}
-{	\ifthenelse{\equal{#2}{}}{
+\DeclareDocumentCommand{\bodyconstBelowMult}{m G{} G{}}
+{
+\ifthenelse{\equal{#3}{}}{
+\ifthenelse{\equal{#2}{}}{
 \\ &\mathrm{subject~to} \span\span\span\span \nonumber \\
-&&&#1 #2		
+&&&#1 #2	
 }{
 \\ &\mathrm{subject~to} \span\span\span\span \nonumber \\
-&&#1 & #2
+&&#1 & #2 
 }
+\togglefalse{previousThird}
+}{
+\ifthenelse{\equal{#2}{}}{
+\\ &\mathrm{subject~to} \span\span\span\span \nonumber \\
+&&&#1 #2	&&#3
+}{
+\\ &\mathrm{subject~to} \span\span\span\span \nonumber \\
+&&#1 & #2 &&#3
 }
+\toggletrue{previousThird}	
+}
+}
 
 % Contraints below subject to and with a single alignment point for the case of having several equations
-\DeclareDocumentCommand{\bodyconstOneAlignBelowMult}{m G{}}
+\DeclareDocumentCommand{\bodyconstOneAlignBelowMult}{m G{} G{}}
 {
+\ifthenelse{\equal{#3}{}}{
 \\ &\mathrm{subject~to} \span\span\span\span \nonumber \\
-&&&#1 #2		
+&&&#1 #2		\togglefalse{previousThird}
+}{
+\\ &\mathrm{subject~to} \span\span\span\span \nonumber \\
+&&&#1 #2 &&	#3
+\toggletrue{previousThird}
 }
+}
 
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -631,12 +677,13 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 \DeclareDocumentCommand{\addConstraint}{m G{} G{}}{
+\ifthenelse{\equal{#3}{}}{	
 \ifthenelse{\equal{#2}{}}{
 \iftoggle{bodyCon}{
 \bodyconst{#1}
 \togglefalse{bodyCon}
 }{
-,\\&\quad &&#1 #2
+,\\&\quad &&#1 #2\span\span
 \togglefalse{bodyCon}
 }
 }{
@@ -644,23 +691,53 @@
 \bodyconst{#1}{#2}
 \togglefalse{bodyCon}
 }{
-,\\&\quad &#1 & #2
+,\\&\quad &#1 & #2\span\span
 \togglefalse{bodyCon}
 }
 }
+\togglefalse{previousThird}
+}{
+\iftoggle{bodyCon}{
+\bodyconst{#1}{#2}{#3}
+\togglefalse{bodyCon}
+}{
+\ifthenelse{\equal{#2}{}}{
+,\\&\quad &&#1 #2 && #3
+}{
+,\\&\quad &#1 & #2 && #3
 }
+\togglefalse{bodyCon}
+}
+\toggletrue{previousThird}
+}
+}
 
 % Standard version of adding constraints
 \DeclareDocumentCommand{\standardAddConstraint}{m G{} G{}}{
+\iftoggle{previousThird}
+{\renewcommand{\spanit}{}}
+{\renewcommand{\spanit}{\span\span}}
 \iftoggle{bodyCon}{
-\bodyconstRight{#1}{#2}
+\bodyconstRight{#1}{#2}{#3}
 \togglefalse{bodyCon}
 }{
 \ifthenelse{\equal{#2}{}}{
-,\\&\quad &&#1 #2
+\ifthenelse{\equal{#3}{}}{
+,\spanit\\&\quad &&#1 #2 
+\togglefalse{previousThird}
 }{
-,\\&\quad &#1 & #2
+,\spanit\\&\quad &&#1 #2 && #3
+\toggletrue{previousThird}
 }
+}{
+\ifthenelse{\equal{#3}{}}{
+,\spanit\\&\quad &#1 & #2 
+\togglefalse{previousThird}
+}{
+,\spanit\\&\quad &#1 & #2 && #3
+\toggletrue{previousThird}
+}
+}
 \togglefalse{bodyCon}
 }
 }
@@ -668,13 +745,24 @@
 % Adding constraints below subject to
 \DeclareDocumentCommand{\BelowAddConstraint}{m G{} G{}}{
 \iftoggle{bodyCon}{
-\bodyconstBelow{#1}{#2}
+\bodyconstBelow{#1}{#2}{#3}
 \togglefalse{bodyCon}
 }{
 \ifthenelse{\equal{#2}{}}{
-,\\&&&#1  #2
+\ifthenelse{\equal{#3}{}}{
+,\spanit\\&&&#1  #2 		\togglefalse{previousThird}
 }{
-,\\ &&#1  &#2}
+,\spanit\\&&&#1  #2 && #3
+\toggletrue{previousThird}		
+}
+}{
+\ifthenelse{\equal{#3}{}}{
+,\spanit\\ &&#1  &#2 \togglefalse{previousThird}
+}{
+,\spanit\\ &&#1  &#2 && #3
+\toggletrue{previousThird}
+}
+}
 \togglefalse{bodyCon}
 }
 }
@@ -682,10 +770,15 @@
 % Adding constraints for a single alignment point
 \DeclareDocumentCommand{\oneAlignAddConstraint}{m G{} G{}}{
 \iftoggle{bodyCon}{
-\bodyconstOneAlign{#1}{#2}
+\bodyconstOneAlign{#1}{#2}{#3}
 \togglefalse{bodyCon}
 }{
-,\\&\quad &&#1  #2
+\ifthenelse{\equal{#3}{}}{
+,\spanit\\&\quad &&#1  #2 \togglefalse{previousThird}
+}{
+,\spanit\\&\quad &&#1  #2 && #3
+\toggletrue{previousThird}
+}
 \togglefalse{bodyCon}
 }
 }
@@ -693,14 +786,59 @@
 % Adding constraints for a single alignment point and with the constraints below
 \DeclareDocumentCommand{\oneAlignBelowAddConstraint}{m G{} G{}}{
 \iftoggle{bodyCon}{
-\bodyconstOneAlignBelow{#1}{#2}
+\bodyconstOneAlignBelow{#1}{#2}{#3}
 \togglefalse{bodyCon}
 }{
-,\\& &&#1  #2
+\ifthenelse{\equal{#3}{}}{
+,\spanit\\& &&#1  #2\togglefalse{previousThird}
+}{
+,\spanit\\& &&#1  #2 && #3
+\toggletrue{previousThird}
+}
 \togglefalse{bodyCon}
 }
 }
 
+% Adding constraints below subject to for multiple references
+\DeclareDocumentCommand{\BelowAddConstraintMult}{m G{} G{}}{
+\iftoggle{bodyCon}{
+\bodyconstBelowMult{#1}{#2}{#3}
+\togglefalse{bodyCon}
+}{
+\ifthenelse{\equal{#3}{}}{
+\ifthenelse{\equal{#2}{}}{
+,\spanit\\&&&#1  #2
+}{
+,\spanit\\ &&#1  &#2
+}
+\togglefalse{previousThird}
+}{
+\ifthenelse{\equal{#2}{}}{
+,\spanit\\&&&#1  #2 && #3
+}{
+,\spanit\\ &&#1  &#2&& #3}
+\toggletrue{previousThird}
+}
+\togglefalse{bodyCon}
+}
+}
+
+% Adding constraints for a single alignment point and with the constraints below for multiple references
+\DeclareDocumentCommand{\oneAlignBelowAddConstraintMult}{m G{} G{}}{
+\iftoggle{bodyCon}{
+\bodyconstOneAlignBelowMult{#1}{#2}
+\togglefalse{bodyCon}
+}{
+\ifthenelse{\equal{#3}{}}{
+,\spanit\\& &&#1  #2 \togglefalse{previousThird}
+}{
+,\spanit\\& &&#1  #2 && #3
+\toggletrue{previousThird}
+}
+\togglefalse{bodyCon}
+}
+}
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %  ------------- SELECTING TYPE OF FORMAT  -----------%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -713,11 +851,28 @@
 }{
 \ifthenelse{\equal{#1}{3}}{
 \let\addConstraint\oneAlignBelowAddConstraint
-}{}
+}{
+\let\addConstraint\standardAddConstraint}
 }
 }
 }
 
+% Selecting for multiple references
+\newcommand{\selectConstraintMult}[1]{
+\ifthenelse{\equal{#1}{1}}{
+\let\addConstraint\BelowAddConstraintMult
+}{
+\ifthenelse{\equal{#1}{2}}{
+\let\addConstraint\oneAlignAddConstraint
+}{
+\ifthenelse{\equal{#1}{3}}{
+\let\addConstraint\oneAlignBelowAddConstraintMult
+}{
+\let\addConstraint\standardAddConstraint}
+}
+}
+}
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %  ------------- SETTING DEFAULT FORMAT  -------------%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -735,9 +890,10 @@
 
 \NewEnviron{mini}[5][]{%
 \selectConstraint{#1}
+\let\addConstraint\standardAddConstraint
 \begin{equation}
 #4
-\begin{alignedat}{4}
+\begin{alignedat}{5}
 \bodyobj{#2}{#3}{minimize}{#5}
 \BODY
 \end{alignedat}
@@ -749,8 +905,8 @@
 \selectConstraint{#1}
 \begin{equation}
 #4
-\begin{alignedat}{4}
-\bodyobj{#2}{#3}{arg min}{#5}
+\begin{alignedat}{5}
+\bodyobj{#2}{#3}{arg~min}{#5}
 \BODY
 \end{alignedat}
 \end{equation}
@@ -759,36 +915,28 @@
 
 \NewEnviron{mini*}[5][]{%
 \selectConstraint{#1}
-\begin{equation*}
-#4
-\begin{alignedat}{4}
+\begin{alignat*}{5}
 \bodyobj{#2}{#3}{minimize}{#5}
 \BODY
-\end{alignedat}
-\end{equation*}
+\end{alignat*}
 \setStandardMini
 }
 
 \NewEnviron{argmini*}[5][]{%
 \selectConstraint{#1}
-\begin{equation*}
-#4
-\begin{alignedat}{4}
-\bodyobj{#2}{#3}{arg min}{#5}
+\begin{alignat*}{5}
+\bodyobj{#2}{#3}{arg~mini}{#5}
 \BODY
-\end{alignedat}
-\end{equation*}
+\end{alignat*}
 \setStandardMini	
 }
 
 
 \NewEnviron{mini!}[5][]{%
-\ifthenelse{\equal{#1}{1}}{
-\let\bodyconst\bodyconstBelowMult
-}{}
+\selectConstraintMult{#1}
 \begin{subequations}
 #4
-\begin{alignat}{4}
+\begin{alignat}{5}
 \bodyobj{#2}{#3}{minimize}{#5}
 \BODY
 \end{alignat}
@@ -797,13 +945,11 @@
 }
 
 \NewEnviron{argmini!}[5][]{%
-\ifthenelse{\equal{#1}{1}}{
-\let\bodyconst\bodyconstBelowMult
-}{}
+\selectConstraintMult{#1}
 \begin{subequations}
 #4
-\begin{alignat}{4}
-\bodyobj{#2}{#3}{arg min}{#5}
+\begin{alignat}{5}
+\bodyobj{#2}{#3}{arg~min}{#5}
 \BODY
 \end{alignat}
 \end{subequations}	
@@ -816,7 +962,7 @@
 \selectConstraint{#1}
 \begin{equation}
 #4
-\begin{alignedat}{4}
+\begin{alignedat}{5}
 \bodyobj{#2}{#3}{maximize}{#5}
 \BODY
 \end{alignedat}
@@ -828,8 +974,8 @@
 \selectConstraint{#1}
 \begin{equation}
 #4
-\begin{alignedat}{4}
-\bodyobj{#2}{#3}{arg maxi}{#5}
+\begin{alignedat}{5}
+\bodyobj{#2}{#3}{arg~maxi}{#5}
 \BODY
 \end{alignedat}
 \end{equation}
@@ -838,36 +984,28 @@
 
 \NewEnviron{maxi*}[5][]{%
 \selectConstraint{#1}
-\begin{equation*}
-#4
-\begin{alignedat}{4}
+\begin{alignat*}{5}
 \bodyobj{#2}{#3}{maximize}{#5}
 \BODY
-\end{alignedat}
-\end{equation*}
+\end{alignat*}
 \setStandardMini
 }
 
 \NewEnviron{argmaxi*}[5][]{%
 \selectConstraint{#1}
-\begin{equation*}
-#4
-\begin{alignedat}{4}
-\bodyobj{#2}{#3}{arg maxi}{#5}
+\begin{alignat*}{5}
+\bodyobj{#2}{#3}{arg~maxi}{#5}
 \BODY
-\end{alignedat}
-\end{equation*}
+\end{alignat*}
 \setStandardMini
 }
 
 
 \NewEnviron{maxi!}[5][]{%
-\ifthenelse{\equal{#1}{1}}{
-\let\bodyconst\bodyconstBelowMult
-}{}
+\selectConstraintMult{#1}
 \begin{subequations}
 #4
-\begin{alignat}{4}
+\begin{alignat}{5}
 \bodyobj{#2}{#3}{maximize}{#5}		
 \BODY
 \end{alignat}
@@ -876,18 +1014,16 @@
 }
 
 \NewEnviron{argmaxi!}[5][]{%
-\ifthenelse{\equal{#1}{1}}{
-\let\bodyconst\bodyconstBelowMult
-}{}
+\selectConstraintMult{#1}
 \begin{subequations}
 #4
-\begin{alignat}{4}
-\bodyobj{#2}{#3}{arg maxi}{#5}		
+\begin{alignat}{5}
+\bodyobj{#2}{#3}{arg~maxi}{#5}		
 \BODY
 \end{alignat}
 \end{subequations}
 \setStandardMini			
 }
-\end{verbatim}
+\end{lstlisting}
 
 \end{document}          

Modified: trunk/Master/texmf-dist/tex/latex/optidef/optidef.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/optidef/optidef.sty	2016-06-28 21:01:23 UTC (rev 41558)
+++ trunk/Master/texmf-dist/tex/latex/optidef/optidef.sty	2016-06-28 21:01:33 UTC (rev 41559)
@@ -1,4 +1,4 @@
-% optidef - Version 1.1
+% optidef - Version 1.2
 %
 %Copyright 2016 J. Lago Garcia
 %
@@ -12,7 +12,7 @@
 %This work consists of the file optidef.sty.
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{optidef}[2016/06/26 - version=1.1,  Package for defining optimization problems]
+\ProvidesPackage{optidef}[2016/06/28 - version=1.2,  Package for defining optimization problems]
 
 \RequirePackage{environ}
 \RequirePackage{mathtools}	
@@ -39,10 +39,12 @@
 {
 	\ifthenelse{\isempty{#4}}
 	{
-		&\underset{\displaystyle #1}{\mathrm{#3}} \quad #2\span\span\span\span
+		%&\underset{\displaystyle #1}{\mathrm{#3}} \quad #2\span\span\span\span
+		&\underset{\displaystyle #1}{\mathrlap{\mathrm{#3}}\phantom{\mathrm{subject~to}}} \quad #2\span\span\span\span
 	}
 	{
-		#4 ~~ &\underset{\displaystyle #1}{\mathrm{#3}} \quad #2\span\span\span\span
+		%#4 ~~ &\underset{\displaystyle #1}{\mathrm{#3}} \quad #2\span\span\span\span
+		#4 ~~ &\underset{\displaystyle #1}{\mathrlap{\mathrm{#3}}\phantom{\mathrm{subject~to}}} \quad #2\span\span\span\span
 	}
 }
 
@@ -398,7 +400,7 @@
 	\begin{equation}
 	#4
 	\begin{alignedat}{5}
-	\bodyobj{#2}{#3}{arg min}{#5}
+	\bodyobj{#2}{#3}{arg~min}{#5}
 	\BODY
 	\end{alignedat}
 	\end{equation}
@@ -441,7 +443,7 @@
 	\begin{subequations}
 		#4
 		\begin{alignat}{5}
-		\bodyobj{#2}{#3}{arg min}{#5}
+		\bodyobj{#2}{#3}{arg~min}{#5}
 		\BODY
 		\end{alignat}
 	\end{subequations}	
@@ -467,7 +469,7 @@
 	\begin{equation}
 	#4
 	\begin{alignedat}{5}
-	\bodyobj{#2}{#3}{arg maxi}{#5}
+	\bodyobj{#2}{#3}{arg~maxi}{#5}
 	\BODY
 	\end{alignedat}
 	\end{equation}
@@ -486,7 +488,7 @@
 \NewEnviron{argmaxi*}[5][]{%
 \selectConstraint{#1}
 	\begin{alignat*}{5}
-	\bodyobj{#2}{#3}{arg maxi}{#5}
+	\bodyobj{#2}{#3}{arg~maxi}{#5}
 	\BODY
 	\end{alignat*}
 \setStandardMini
@@ -510,7 +512,7 @@
 	\begin{subequations}
 		#4
 		\begin{alignat}{5}
-		\bodyobj{#2}{#3}{arg maxi}{#5}		
+		\bodyobj{#2}{#3}{arg~maxi}{#5}		
 		\BODY
 		\end{alignat}
 	\end{subequations}



More information about the tex-live-commits mailing list