summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-07-19 21:11:40 +0000
committerKarl Berry <karl@freefriends.org>2018-07-19 21:11:40 +0000
commit9d62c82177b2936bda55d6f29d8bda256bf08ba7 (patch)
tree01211bbb59c42f06b51030a673f413b86ed34027 /Master/texmf-dist/tex
parentb6d8bcb0726858b9b9e77624a875e495f38f602d (diff)
optidef (19jul18)
git-svn-id: svn://tug.org/texlive/trunk@48228 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/optidef/optidef.sty226
1 files changed, 144 insertions, 82 deletions
diff --git a/Master/texmf-dist/tex/latex/optidef/optidef.sty b/Master/texmf-dist/tex/latex/optidef/optidef.sty
index e1e114f313c..be29075b6e5 100644
--- a/Master/texmf-dist/tex/latex/optidef/optidef.sty
+++ b/Master/texmf-dist/tex/latex/optidef/optidef.sty
@@ -1,6 +1,6 @@
-% optidef - Version 2.7
+% optidef - Version 3.0
%
-%Copyright 2017 Jesus Lago
+%Copyright 2018 Jesus Lago
%
%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.
@@ -12,7 +12,7 @@
%This work consists of the file optidef.sty.
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{optidef}[2018/05/23 - version=2.7, Package for defining optimization problems]
+\ProvidesPackage{optidef}[2018/07/19 - version=3.0, Package for defining optimization problems]
\RequirePackage{environ}
\RequirePackage{mathtools}
@@ -26,9 +26,11 @@
% DEFINING PACKAGE OPTIONS
%%%%%%%%%%%%%%%%%%%%%%%
% Default
+
\newcommand{\defaultOCPConstraint}{,}
\newcommand{\defaultProblemFormat}{l}
\newcommand{\defaultConstraintFormat}{0}
+\newcommand{\labelOP}[1]{\stepcounter{equation}\tag{\theequation}\label{#1}}
\DeclareOption{short}{
\renewcommand{\defaultProblemFormat}{s}
@@ -519,6 +521,7 @@
% Base environment for the three possible types of referencing: 1 label, no label or multilabel
% Base environment defined using NewEnviron package because of \BODY command
\NewEnviron{BaseMini}[6]{%
+
\selectConstraint{#1}
\renewcommand{\localOptimalVariable}{#2}
\begin{equation}
@@ -527,24 +530,35 @@
\bodyobj{#2}{#3}{#6}{#5}
\BODY
\end{alignedat}
-\end{equation}
+\end{equation}
\setStandardMini
}
-\NewEnviron{BaseMiniStar}[5]{%
+\NewEnviron{BaseMiniStar}[6]{%
\selectConstraint{#1}
\renewcommand{\localOptimalVariable}{#2}
+\ifthenelse{\equal{#6}{b}}{
+ \begingroup
+ \allowdisplaybreaks
+}{}
\begin{alignat*}{5}
\bodyobj{#2}{#3}{#5}{#4}
\BODY
\end{alignat*}
+\ifthenelse{\equal{#6}{b}}{
+ \endgroup
+}{}
\setStandardMini
}
-\NewEnviron{BaseMiniExclam}[6]{%
+\NewEnviron{BaseMiniExclam}[7]{%
\selectConstraintMult{#1}
\renewcommand{\localOptimalVariable}{#2}
+\ifthenelse{\equal{#7}{b}}{
+ \begingroup
+ \allowdisplaybreaks
+}{}
\begin{subequations}
#4
\begin{alignat}{5}
@@ -552,6 +566,9 @@
\BODY
\end{alignat}
\end{subequations}
+\ifthenelse{\equal{#7}{b}}{
+ \endgroup
+}{}
\setStandardMini
}
@@ -563,146 +580,191 @@
% In the below definitions, \toggletrue{bodyCon} has to be added once the definition of the environment is finished. I tried to do inside the environment itself using \setStandardMini, but it produced some ugly text displacemente.
% Single reference probems
-\DeclareDocumentEnvironment{mini}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} m m m m}
-{\ifthenelse{\equal{#1}{s}}
-% Short version problem
-{\setFormatShort{min}{#2} \BaseMini{#2}{#3}{#4}{#5}{#6}{min}}
-% Long version problem
-{\setFormatLong{minimize}{#2} \BaseMini{#2}{#3}{#4}{#5}{#6}{minimize}}
-}{\endBaseMini\toggletrue{bodyCon}}
+\DeclareDocumentEnvironment{mini}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} D<>{} m m m m}{
+\ifthenelse{\equal{#3}{b}}
+{
+ \ifthenelse{\equal{#1}{s}}
+ % Short version problem
+ {\setFormatShort{min}{#2} \BaseMiniStar{#2}{#4}{#5}{#7}{min}{#3}}
+ % Long version problem
+ {\setFormatLong{minimize}{#2} \BaseMiniStar{#2}{#4}{#5}{#7}{minimize}{#3}}
+}
+{
+ \ifthenelse{\equal{#1}{s}}
+ % Short version problem
+ {\setFormatShort{min}{#2} \BaseMini{#2}{#4}{#5}{#6}{#7}{min}}
+ % Long version problem
+ {\setFormatLong{minimize}{#2} \BaseMini{#2}{#4}{#5}{#6}{#7}{minimize}}
+}
+}%
+{\endBaseMini\toggletrue{bodyCon}}
-\DeclareDocumentEnvironment{argmini}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} m m m m}
-{\ifthenelse{\equal{#1}{s}}
-% Short version problem
-{\setFormatShort{arg~min}{#2} \BaseMini{#2}{#3}{#4}{#5}{#6}{arg~min}}
-% Long version problem
-{\setFormatLong{arg~min}{#2} \BaseMini{#2}{#3}{#4}{#5}{#6}{arg~min}}
-}{\endBaseMini\toggletrue{bodyCon}}
+
+\DeclareDocumentEnvironment{argmini}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} D<>{} m m m m}{
+ \ifthenelse{\equal{#3}{b}}
+ {
+ \ifthenelse{\equal{#1}{s}}
+ % Short version problem
+ {\setFormatShort{arg~min}{#2} \BaseMiniStar{#2}{#4}{#5}{#7}{arg~min}{#3}}
+ % Long version problem
+ {\setFormatLong{arg~min}{#2} \BaseMiniStar{#2}{#4}{#5}{#7}{arg~min}{#3}}
+ }
+ {
+ \ifthenelse{\equal{#1}{s}}
+ % Short version problem
+ {\setFormatShort{arg~min}{#2} \BaseMini{#2}{#4}{#5}{#6}{#7}{arg~min}}
+ % Long version problem
+ {\setFormatLong{arg~min}{#2} \BaseMini{#2}{#4}{#5}{#6}{#7}{arg~min}}
+ }
+}%
+{\endBaseMini\toggletrue{bodyCon}}
% No reference
-\DeclareDocumentEnvironment{mini*}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} m m m m}
+\DeclareDocumentEnvironment{mini*}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} D<>{} m m m m}
{\ifthenelse{\equal{#1}{s}}
% Short version problem
- {\setFormatShort{min}{#2} \BaseMiniStar{#2}{#3}{#4}{#6}{min}}
+ {\setFormatShort{min}{#2} \BaseMiniStar{#2}{#4}{#5}{#7}{min}{#3}}
% Long version problem
- {\setFormatLong{minimize}{#2} \BaseMiniStar{#2}{#3}{#4}{#6}{minimize}}
+ {\setFormatLong{minimize}{#2} \BaseMiniStar{#2}{#4}{#5}{#7}{minimize}{#3}}
}{\endBaseMiniStar\toggletrue{bodyCon}}
-\DeclareDocumentEnvironment{argmini*}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} m m m m}
+\DeclareDocumentEnvironment{argmini*}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} D<>{} m m m m}
{\ifthenelse{\equal{#1}{s}}
% Short version problem
-{\setFormatShort{arg~min}{#2}\BaseMiniStar{#2}{#3}{#4}{#6}{arg~min}}
+{\setFormatShort{arg~min}{#2} \BaseMiniStar{#2}{#4}{#5}{#7}{arg~min}{#3}}
% Long version problem
-{\setFormatLong{arg~min}{#2} \BaseMiniStar{#2}{#3}{#4}{#6}{arg~min}}
+{\setFormatLong{arg~min}{#2} \BaseMiniStar{#2}{#4}{#5}{#7}{arg~min}{#3}}
}{\endBaseMiniStar\toggletrue{bodyCon}}
% Multiple reference
-\DeclareDocumentEnvironment{mini!}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} m m m m}
+\DeclareDocumentEnvironment{mini!}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} D<>{} m m m m}
{\ifthenelse{\equal{#1}{s}}
% Short version problem
- {\setFormatShort{min}{#2} \BaseMiniExclam{#2}{#3}{#4}{#5}{#6}{min}}
+ {\setFormatShort{min}{#2} \BaseMiniExclam{#2}{#4}{#5}{#6}{#7}{min}{#3}}
% Long version problem
- {\setFormatLong{minimize}{#2} \BaseMiniExclam{#2}{#3}{#4}{#5}{#6}{minimize}}
+ {\setFormatLong{minimize}{#2} \BaseMiniExclam{#2}{#4}{#5}{#6}{#7}{minimize}{#3}}
}{\endBaseMiniExclam\toggletrue{bodyCon}}
-\DeclareDocumentEnvironment{argmini!}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} m m m m}
+\DeclareDocumentEnvironment{argmini!}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} D<>{} m m m m}
{\ifthenelse{\equal{#1}{s}}
- % Short version problem
- {\setFormatShort{arg~min}{#2}\BaseMiniExclam{#2}{#3}{#4}{#5}{#6}{arg~min}}
- % Long version problem
- {\setFormatLong{arg~min}{#2} \BaseMiniExclam{#2}{#3}{#4}{#5}{#6}{arg~min}}
+% Short version problem
+{\setFormatShort{arg~min}{#2} \BaseMiniExclam{#2}{#4}{#5}{#6}{#7}{arg~min}{#3}}
+% Long version problem
+{\setFormatLong{arg~min}{#2} \BaseMiniExclam{#2}{#4}{#5}{#6}{#7}{arg~min}{#3}}
}{\endBaseMiniExclam\toggletrue{bodyCon}}
-
-\DeclareDocumentEnvironment{minie}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} m m m m}
+% Multiple reference
+\DeclareDocumentEnvironment{minie}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} D<>{} m m m m}
{\ifthenelse{\equal{#1}{s}}
% Short version problem
- {\setFormatShort{min}{#2} \BaseMiniExclam{#2}{#3}{#4}{#5}{#6}{min}}
+ {\setFormatShort{min}{#2} \BaseMiniExclam{#2}{#4}{#5}{#6}{#7}{min}{#3}}
% Long version problem
- {\setFormatLong{minimize}{#2} \BaseMiniExclam{#2}{#3}{#4}{#5}{#6}{minimize}}
+ {\setFormatLong{minimize}{#2} \BaseMiniExclam{#2}{#4}{#5}{#6}{#7}{minimize}{#3}}
}{\endBaseMiniExclam\toggletrue{bodyCon}}
-\DeclareDocumentEnvironment{argminie}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} m m m m}
+
+\DeclareDocumentEnvironment{argminie}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} D<>{} m m m m}
{\ifthenelse{\equal{#1}{s}}
% Short version problem
- {\setFormatShort{arg~min}{#2}\BaseMiniExclam{#2}{#3}{#4}{#5}{#6}{arg~min}}
+ {\setFormatShort{arg~min}{#2} \BaseMiniExclam{#2}{#4}{#5}{#6}{#7}{arg~min}{#3}}
% Long version problem
- {\setFormatLong{arg~min}{#2} \BaseMiniExclam{#2}{#3}{#4}{#5}{#6}{arg~min}}
+ {\setFormatLong{arg~min}{#2} \BaseMiniExclam{#2}{#4}{#5}{#6}{#7}{arg~min}{#3}}
}{\endBaseMiniExclam\toggletrue{bodyCon}}
-
%MAXIMIZATION ENVIRONMENTS
% Single reference probems
-\DeclareDocumentEnvironment{maxi}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} m m m m}
-{\ifthenelse{\equal{#1}{s}}
- % Short version problem
- {\setFormatShort{max}{#2} \BaseMini{#2}{#3}{#4}{#5}{#6}{max}}
- % Long version problem
- {\setFormatLong{maximize}{#2} \BaseMini{#2}{#3}{#4}{#5}{#6}{maximize}}
-}{\endBaseMini\toggletrue{bodyCon}}
+\DeclareDocumentEnvironment{maxi}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} D<>{} m m m m}{
+ \ifthenelse{\equal{#3}{b}}
+ {
+ \ifthenelse{\equal{#1}{s}}
+ % Short version problem
+ {\setFormatShort{max}{#2} \BaseMiniStar{#2}{#4}{#5}{#7}{max}{#3}}
+ % Long version problem
+ {\setFormatLong{maximize}{#2} \BaseMiniStar{#2}{#4}{#5}{#7}{maximize}{#3}}
+ }
+ {
+ \ifthenelse{\equal{#1}{s}}
+ % Short version problem
+ {\setFormatShort{max}{#2} \BaseMini{#2}{#4}{#5}{#6}{#7}{max}}
+ % Long version problem
+ {\setFormatLong{maximize}{#2} \BaseMini{#2}{#4}{#5}{#6}{#7}{maximize}}
+ }
+}%
+{\endBaseMini\toggletrue{bodyCon}}
-\DeclareDocumentEnvironment{argmaxi}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} m m m m}
-{\ifthenelse{\equal{#1}{s}}
- % Short version problem
- {\setFormatShort{arg~max}{#2} \BaseMini{#2}{#3}{#4}{#5}{#6}{arg~max}}
- % Long version problem
- {\setFormatLong{arg~max}{#2} \BaseMini{#2}{#3}{#4}{#5}{#6}{arg~max}}
-}{\endBaseMini\toggletrue{bodyCon}}
+\DeclareDocumentEnvironment{argmaxi}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} D<>{} m m m m}{
+ \ifthenelse{\equal{#3}{b}}
+ {
+ \ifthenelse{\equal{#1}{s}}
+ % Short version problem
+ {\setFormatShort{arg~max}{#2} \BaseMiniStar{#2}{#4}{#5}{#7}{arg~max}{#3}}
+ % Long version problem
+ {\setFormatLong{arg~max}{#2} \BaseMiniStar{#2}{#4}{#5}{#7}{arg~max}{#3}}
+ }
+ {
+ \ifthenelse{\equal{#1}{s}}
+ % Short version problem
+ {\setFormatShort{arg~max}{#2} \BaseMini{#2}{#4}{#5}{#6}{#7}{arg~max}}
+ % Long version problem
+ {\setFormatLong{arg~max}{#2} \BaseMini{#2}{#4}{#5}{#6}{#7}{arg~max}}
+ }
+}%
+{\endBaseMini\toggletrue{bodyCon}}
% No reference
-\DeclareDocumentEnvironment{maxi*}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} m m m m}
+\DeclareDocumentEnvironment{maxi*}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} D<>{} m m m m}
{\ifthenelse{\equal{#1}{s}}
- % Short version problem
- {\setFormatShort{max}{#2} \BaseMiniStar{#2}{#3}{#4}{#6}{max}}
- % Long version problem
- {\setFormatLong{maximize}{#2} \BaseMiniStar{#2}{#3}{#4}{#6}{maximize}}
+% Short version problem
+{\setFormatShort{max}{#2} \BaseMiniStar{#2}{#4}{#5}{#7}{max}{#3}}
+% Long version problem
+{\setFormatLong{maximize}{#2} \BaseMiniStar{#2}{#4}{#5}{#7}{maximize}{#3}}
}{\endBaseMiniStar\toggletrue{bodyCon}}
-\DeclareDocumentEnvironment{argmaxi*}{D||{l} O{\defaultConstraintFormat} m m m m}
+\DeclareDocumentEnvironment{argmaxi*}{D||{l} O{\defaultConstraintFormat} D<>{} m m m m}
{\ifthenelse{\equal{#1}{s}}
- % Short version problem
- {\setFormatShort{arg~max}{#2}\BaseMiniStar{#2}{#3}{#4}{#6}{arg~max}}
- % Long version problem
- {\setFormatLong{arg~max}{#2} \BaseMiniStar{#2}{#3}{#4}{#6}{arg~max}}
+% Short version problem
+{\setFormatShort{arg~max}{#2} \BaseMiniStar{#2}{#4}{#5}{#7}{arg~max}{#3}}
+% Long version problem
+{\setFormatLong{arg~max}{#2} \BaseMiniStar{#2}{#4}{#5}{#7}{arg~max}{#3}}
}{\endBaseMiniStar\toggletrue{bodyCon}}
% Multiple reference
-\DeclareDocumentEnvironment{maxi!}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} m m m m}
+\DeclareDocumentEnvironment{maxi!}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} D<>{} m m m m}
{\ifthenelse{\equal{#1}{s}}
- % Short version problem
- {\setFormatShort{max}{#2} \BaseMiniExclam{#2}{#3}{#4}{#5}{#6}{max}}
- % Long version problem
- {\setFormatLong{maximize}{#2} \BaseMiniExclam{#2}{#3}{#4}{#5}{#6}{maximize}}
+% Short version problem
+{\setFormatShort{max}{#2} \BaseMiniExclam{#2}{#4}{#5}{#6}{#7}{max}{#3}}
+% Long version problem
+{\setFormatLong{maximize}{#2} \BaseMiniExclam{#2}{#4}{#5}{#6}{#7}{maximize}{#3}}
}{\endBaseMiniExclam\toggletrue{bodyCon}}
-\DeclareDocumentEnvironment{argmaxi!}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} m m m m}
+\DeclareDocumentEnvironment{argmaxi!}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} D<>{} m m m m}
{\ifthenelse{\equal{#1}{s}}
- % Short version problem
- {\setFormatShort{arg~max}{#2}\BaseMiniExclam{#2}{#3}{#4}{#5}{#6}{arg~max}}
- % Long version problem
- {\setFormatLong{arg~max}{#2} \BaseMiniExclam{#2}{#3}{#4}{#5}{#6}{arg~max}}
+% Short version problem
+{\setFormatShort{arg~max}{#2} \BaseMiniExclam{#2}{#4}{#5}{#6}{#7}{arg~max}{#3}}
+% Long version problem
+{\setFormatLong{arg~max}{#2} \BaseMiniExclam{#2}{#4}{#5}{#6}{#7}{arg~max}{#3}}
}{\endBaseMiniExclam\toggletrue{bodyCon}}
% Multiple reference
-\DeclareDocumentEnvironment{maxie}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} m m m m}
+\DeclareDocumentEnvironment{maxie}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} D<>{} m m m m}
{\ifthenelse{\equal{#1}{s}}
% Short version problem
- {\setFormatShort{max}{#2} \BaseMiniExclam{#2}{#3}{#4}{#5}{#6}{max}}
+ {\setFormatShort{max}{#2} \BaseMiniExclam{#2}{#4}{#5}{#6}{#7}{max}{#3}}
% Long version problem
- {\setFormatLong{maximize}{#2} \BaseMiniExclam{#2}{#3}{#4}{#5}{#6}{maximize}}
+ {\setFormatLong{maximize}{#2} \BaseMiniExclam{#2}{#4}{#5}{#6}{#7}{maximize}{#3}}
}{\endBaseMiniExclam\toggletrue{bodyCon}}
-\DeclareDocumentEnvironment{argmaxie}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} m m m m}
+\DeclareDocumentEnvironment{argmaxie}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} D<>{} m m m m}
{\ifthenelse{\equal{#1}{s}}
% Short version problem
- {\setFormatShort{arg~max}{#2}\BaseMiniExclam{#2}{#3}{#4}{#5}{#6}{arg~max}}
+ {\setFormatShort{arg~max}{#2} \BaseMiniExclam{#2}{#4}{#5}{#6}{#7}{arg~max}{#3}}
% Long version problem
- {\setFormatLong{arg~max}{#2} \BaseMiniExclam{#2}{#3}{#4}{#5}{#6}{arg~max}}
+ {\setFormatLong{arg~max}{#2} \BaseMiniExclam{#2}{#4}{#5}{#6}{#7}{arg~max}{#3}}
}{\endBaseMiniExclam\toggletrue{bodyCon}} \ No newline at end of file