diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/optidef/optidef.sty | 74 |
1 files changed, 60 insertions, 14 deletions
diff --git a/Master/texmf-dist/tex/latex/optidef/optidef.sty b/Master/texmf-dist/tex/latex/optidef/optidef.sty index d01c65beb36..e1e114f313c 100644 --- a/Master/texmf-dist/tex/latex/optidef/optidef.sty +++ b/Master/texmf-dist/tex/latex/optidef/optidef.sty @@ -1,4 +1,4 @@ -% optidef - Version 2.6 +% optidef - Version 2.7 % %Copyright 2017 Jesus Lago % @@ -12,10 +12,11 @@ %This work consists of the file optidef.sty. \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{optidef}[2017/11/29 - version=2.6, Package for defining optimization problems] +\ProvidesPackage{optidef}[2018/05/23 - version=2.7, Package for defining optimization problems] \RequirePackage{environ} \RequirePackage{mathtools} + \RequirePackage{xifthen} \RequirePackage{etoolbox} \RequirePackage{xparse} @@ -27,6 +28,7 @@ % Default \newcommand{\defaultOCPConstraint}{,} \newcommand{\defaultProblemFormat}{l} +\newcommand{\defaultConstraintFormat}{0} \DeclareOption{short}{ \renewcommand{\defaultProblemFormat}{s} @@ -40,6 +42,16 @@ \renewcommand{\defaultOCPConstraint}{} } +\DeclareOption{c1}{ + \renewcommand{\defaultConstraintFormat}{1} +} +\DeclareOption{c2}{ + \renewcommand{\defaultConstraintFormat}{2} +} +\DeclareOption{c3}{ + \renewcommand{\defaultConstraintFormat}{3} +} + \ProcessOptions\relax % This command is required to avoid breakdown of the \equal fragile command. In particular, before I had \equal{#2}{} tp check if argumetn #2 was empty. However, if the argument was a bmatrix object the command was breaking. Now this command is robust. @@ -551,7 +563,7 @@ % 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{0} m m m m} +\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}} @@ -559,7 +571,7 @@ {\setFormatLong{minimize}{#2} \BaseMini{#2}{#3}{#4}{#5}{#6}{minimize}} }{\endBaseMini\toggletrue{bodyCon}} -\DeclareDocumentEnvironment{argmini}{D||{\defaultProblemFormat} O{0} m m m m} +\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}} @@ -569,7 +581,7 @@ % No reference -\DeclareDocumentEnvironment{mini*}{D||{\defaultProblemFormat} O{0} m m m m} +\DeclareDocumentEnvironment{mini*}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} m m m m} {\ifthenelse{\equal{#1}{s}} % Short version problem {\setFormatShort{min}{#2} \BaseMiniStar{#2}{#3}{#4}{#6}{min}} @@ -577,7 +589,7 @@ {\setFormatLong{minimize}{#2} \BaseMiniStar{#2}{#3}{#4}{#6}{minimize}} }{\endBaseMiniStar\toggletrue{bodyCon}} -\DeclareDocumentEnvironment{argmini*}{D||{l} O{0} m m m m} +\DeclareDocumentEnvironment{argmini*}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} m m m m} {\ifthenelse{\equal{#1}{s}} % Short version problem {\setFormatShort{arg~min}{#2}\BaseMiniStar{#2}{#3}{#4}{#6}{arg~min}} @@ -587,7 +599,7 @@ % Multiple reference -\DeclareDocumentEnvironment{mini!}{D||{\defaultProblemFormat} O{0} m m m m} +\DeclareDocumentEnvironment{mini!}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} m m m m} {\ifthenelse{\equal{#1}{s}} % Short version problem {\setFormatShort{min}{#2} \BaseMiniExclam{#2}{#3}{#4}{#5}{#6}{min}} @@ -595,7 +607,7 @@ {\setFormatLong{minimize}{#2} \BaseMiniExclam{#2}{#3}{#4}{#5}{#6}{minimize}} }{\endBaseMiniExclam\toggletrue{bodyCon}} -\DeclareDocumentEnvironment{argmini!}{D||{\defaultProblemFormat} O{0} m m m m} +\DeclareDocumentEnvironment{argmini!}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} m m m m} {\ifthenelse{\equal{#1}{s}} % Short version problem {\setFormatShort{arg~min}{#2}\BaseMiniExclam{#2}{#3}{#4}{#5}{#6}{arg~min}} @@ -605,11 +617,28 @@ +\DeclareDocumentEnvironment{minie}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} m m m m} +{\ifthenelse{\equal{#1}{s}} + % Short version problem + {\setFormatShort{min}{#2} \BaseMiniExclam{#2}{#3}{#4}{#5}{#6}{min}} + % Long version problem + {\setFormatLong{minimize}{#2} \BaseMiniExclam{#2}{#3}{#4}{#5}{#6}{minimize}} +}{\endBaseMiniExclam\toggletrue{bodyCon}} + +\DeclareDocumentEnvironment{argminie}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} 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}} +}{\endBaseMiniExclam\toggletrue{bodyCon}} + + %MAXIMIZATION ENVIRONMENTS % Single reference probems -\DeclareDocumentEnvironment{maxi}{D||{\defaultProblemFormat} O{0} m m m m} +\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}} @@ -617,7 +646,7 @@ {\setFormatLong{maximize}{#2} \BaseMini{#2}{#3}{#4}{#5}{#6}{maximize}} }{\endBaseMini\toggletrue{bodyCon}} -\DeclareDocumentEnvironment{argmaxi}{D||{\defaultProblemFormat} O{0} m m m m} +\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}} @@ -627,7 +656,7 @@ % No reference -\DeclareDocumentEnvironment{maxi*}{D||{\defaultProblemFormat} O{0} m m m m} +\DeclareDocumentEnvironment{maxi*}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} m m m m} {\ifthenelse{\equal{#1}{s}} % Short version problem {\setFormatShort{max}{#2} \BaseMiniStar{#2}{#3}{#4}{#6}{max}} @@ -635,7 +664,7 @@ {\setFormatLong{maximize}{#2} \BaseMiniStar{#2}{#3}{#4}{#6}{maximize}} }{\endBaseMiniStar\toggletrue{bodyCon}} -\DeclareDocumentEnvironment{argmaxi*}{D||{l} O{0} m m m m} +\DeclareDocumentEnvironment{argmaxi*}{D||{l} O{\defaultConstraintFormat} m m m m} {\ifthenelse{\equal{#1}{s}} % Short version problem {\setFormatShort{arg~max}{#2}\BaseMiniStar{#2}{#3}{#4}{#6}{arg~max}} @@ -645,7 +674,24 @@ % Multiple reference -\DeclareDocumentEnvironment{maxi!}{D||{\defaultProblemFormat} O{0} m m m m} +\DeclareDocumentEnvironment{maxi!}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} 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}} +}{\endBaseMiniExclam\toggletrue{bodyCon}} + +\DeclareDocumentEnvironment{argmaxi!}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} 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}} +}{\endBaseMiniExclam\toggletrue{bodyCon}} + +% Multiple reference +\DeclareDocumentEnvironment{maxie}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} m m m m} {\ifthenelse{\equal{#1}{s}} % Short version problem {\setFormatShort{max}{#2} \BaseMiniExclam{#2}{#3}{#4}{#5}{#6}{max}} @@ -653,7 +699,7 @@ {\setFormatLong{maximize}{#2} \BaseMiniExclam{#2}{#3}{#4}{#5}{#6}{maximize}} }{\endBaseMiniExclam\toggletrue{bodyCon}} -\DeclareDocumentEnvironment{argmaxi!}{D||{\defaultProblemFormat} O{0} m m m m} +\DeclareDocumentEnvironment{argmaxie}{D||{\defaultProblemFormat} O{\defaultConstraintFormat} m m m m} {\ifthenelse{\equal{#1}{s}} % Short version problem {\setFormatShort{arg~max}{#2}\BaseMiniExclam{#2}{#3}{#4}{#5}{#6}{arg~max}} |