texlive[42154] Master/texmf-dist: optidef (26sep16)

commits+karl at tug.org commits+karl at tug.org
Mon Sep 26 22:52:50 CEST 2016


Revision: 42154
          http://tug.org/svn/texlive?view=revision&revision=42154
Author:   karl
Date:     2016-09-26 22:52:50 +0200 (Mon, 26 Sep 2016)
Log Message:
-----------
optidef (26sep16)

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-09-26 20:52:37 UTC (rev 42153)
+++ trunk/Master/texmf-dist/doc/latex/optidef/README.md	2016-09-26 20:52:50 UTC (rev 42154)
@@ -60,11 +60,11 @@
 
 ## Contact for issue reporting or suggestions
 
-E-mail: jesus.lago.garcia at venus.uni-freiburg.de
+E-mail: j.lagogarcia at tudelft.nl
 
 Github: https://github.com/jeslago/optidef
 
-## Latest stable version: Optidef 2.0
+## Latest stable version: Optidef 2.1
 
 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-09-26 20:52:37 UTC (rev 42153)
+++ trunk/Master/texmf-dist/doc/latex/optidef/optidef.tex	2016-09-26 20:52:50 UTC (rev 42154)
@@ -1,16 +1,13 @@
 \documentclass[a4paper]{article}
 \usepackage{remreset}
-\usepackage{optidef}
+\usepackage[short]{optidef}
 \usepackage{listings}
 \usepackage{enumitem}
 \usepackage{hyperref}
 
-\lstset{
-	language=TeX,
-	breaklines=true,
-}
+\lstset{basicstyle=\ttfamily,breaklines=true}
 % Title Page
-\title{\textit{\textbf{Optidef}} \\ A Latex library for optimization problems\\ \textnormal{Version - 2.0}}
+\title{\textit{\textbf{Optidef}} \\ A Latex library for optimization problems\\ \textnormal{Version - 2.1}}
 
 \author{Jesus Lago Garcia}
 
@@ -40,6 +37,19 @@
 \item Four different type of problems: \textit{minimize}, \textit{maximize}, \textit{arg min} and \textit{arg max}.
 \end{enumerate}
 
+\section{Using the package}
+The package can be imported by directly adding
+\begin{lstlisting}
+\usepackage{optidef}
+\end{lstlisting}
+to the document preamble. When importing the packages two options can be used, \verb|short| and \verb|nocomma|:
+
+\begin{lstlisting}
+\usepackage[short,nocomma]{optidef}
+\end{lstlisting}
+
+For an explanation of the \verb|short| option check Section \ref{sec:longshort}. For the \verb|nocomma| option check Section \ref{sec:comma}. For a detailed description of how to use the package keep reading the next section.
+
 \section{Environment Syntax Definition}
 Considering that \verb|Const.i| stands for constraint $i$, \verb|LHS.i| stands for the left-hand-side of constraint $i$, and \verb|RHS.i| for the right-hand-side counterpart, the basic structure to define a general optimization problem with $N$ constraints is:
 \begin{verbatim}
@@ -171,6 +181,12 @@
 	\addConstraint{g(w)}{=0}
 \end{mini*}
 
+\noindent By the default the long format is used. To change the default to  the short format the package must be imported with the \verb|short| option:
+
+\begin{lstlisting}
+\usepackage[short]{optidef}
+\end{lstlisting}
+
 \section{Alignment of Equations}
 \label{sec:alignment}
 
@@ -244,7 +260,14 @@
  		\addConstraint{t(w)}{=0.}
  	\end{mini} 	
 
+\section{Default comma at the end of the constraint}
+\label{sec:comma}
+By default, the algorithms adds a comma at the end of any constraint that is not the last one. This feature was implemented due to correctness of mathematical notation. However, this behavior can be removed by adding the option \verb|nocomma| when importing the package:
 
+\begin{lstlisting}
+\usepackage[nocomma]{optidef}
+\end{lstlisting}
+
 \section{Examples}
 \subsection{Example 1 - mini environment}
 The code:
@@ -586,7 +609,7 @@
 
 \section{Code definition}
 \begin{lstlisting}
-% optidef - Version 2.0
+% optidef - Version 2.1
 %
 %Copyright 2016 J. Lago Garcia
 %
@@ -600,11 +623,11 @@
 %This work consists of the file optidef.sty.
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{optidef}[2016/08/07 - version=2.0,  Package for defining optimization problems]
+\ProvidesPackage{optidef}[2016/09/25 - version=2.1,  Package for defining optimization problems]
 
 \RequirePackage{environ}
 \RequirePackage{mathtools}	
-\RequirePackage{xifthen}	
+\RequirePackage{xifthen}
 \RequirePackage{etoolbox}	
 \RequirePackage{xparse}	
 \RequirePackage{calc}	
@@ -613,6 +636,7 @@
 % DEFINING PACKAGE OPTIONS
 %%%%%%%%%%%%%%%%%%%%%%%
 % Default
+\newcommand{\defaultOCPConstraint}{,}
 \newcommand{\defaultProblemFormat}{l}
 
 \DeclareOption{short}{
@@ -623,6 +647,10 @@
 \renewcommand{\defaultProblemFormat}{l}
 }
 
+\DeclareOption{nocomma}{
+\renewcommand{\defaultOCPConstraint}{}
+}
+
 \ProcessOptions\relax
 
 %%%%%%%%%%%%%%%%%%%%%%%
@@ -852,7 +880,7 @@
 \bodyconst{#1}
 \togglefalse{bodyCon}
 }{
-,\\&\quad &&#1 #2\span\span
+\defaultOCPConstraint\\&\quad &&#1 #2\span\span
 \togglefalse{bodyCon}
 }
 }{
@@ -860,7 +888,7 @@
 \bodyconst{#1}{#2}
 \togglefalse{bodyCon}
 }{
-,\\&\quad &#1 & #2\span\span
+\defaultOCPConstraint\\&\quad &#1 & #2\span\span
 \togglefalse{bodyCon}
 }
 }
@@ -871,9 +899,9 @@
 \togglefalse{bodyCon}
 }{
 \ifthenelse{\equal{#2}{}}{
-,\\&\quad &&#1 #2 && #3
+\defaultOCPConstraint\\&\quad &&#1 #2 && #3
 }{
-,\\&\quad &#1 & #2 && #3
+\defaultOCPConstraint\\&\quad &#1 & #2 && #3
 }
 \togglefalse{bodyCon}
 }
@@ -892,18 +920,18 @@
 }{
 \ifthenelse{\equal{#2}{}}{
 \ifthenelse{\equal{#3}{}}{
-,\spanit\\&\quad &&#1 #2 
+\defaultOCPConstraint\spanit\\&\quad &&#1 #2 
 \togglefalse{previousThird}
 }{
-,\spanit\\&\quad &&#1 #2 && #3
+\defaultOCPConstraint\spanit\\&\quad &&#1 #2 && #3
 \toggletrue{previousThird}
 }
 }{
 \ifthenelse{\equal{#3}{}}{
-,\spanit\\&\quad &#1 & #2 
+\defaultOCPConstraint\spanit\\&\quad &#1 & #2 
 \togglefalse{previousThird}
 }{
-,\spanit\\&\quad &#1 & #2 && #3
+\defaultOCPConstraint\spanit\\&\quad &#1 & #2 && #3
 \toggletrue{previousThird}
 }
 }
@@ -919,16 +947,16 @@
 }{
 \ifthenelse{\equal{#2}{}}{
 \ifthenelse{\equal{#3}{}}{
-,\spanit\\&&&#1  #2 		\togglefalse{previousThird}
+\defaultOCPConstraint\spanit\\&&&#1  #2 		\togglefalse{previousThird}
 }{
-,\spanit\\&&&#1  #2 && #3
+\defaultOCPConstraint\spanit\\&&&#1  #2 && #3
 \toggletrue{previousThird}		
 }
 }{
 \ifthenelse{\equal{#3}{}}{
-,\spanit\\ &&#1  &#2 \togglefalse{previousThird}
+\defaultOCPConstraint\spanit\\ &&#1  &#2 \togglefalse{previousThird}
 }{
-,\spanit\\ &&#1  &#2 && #3
+\defaultOCPConstraint\spanit\\ &&#1  &#2 && #3
 \toggletrue{previousThird}
 }
 }
@@ -943,9 +971,9 @@
 \togglefalse{bodyCon}
 }{
 \ifthenelse{\equal{#3}{}}{
-,\spanit\\&\quad &&#1  #2 \togglefalse{previousThird}
+\defaultOCPConstraint\spanit\\&\quad &&#1  #2 \togglefalse{previousThird}
 }{
-,\spanit\\&\quad &&#1  #2 && #3
+\defaultOCPConstraint\spanit\\&\quad &&#1  #2 && #3
 \toggletrue{previousThird}
 }
 \togglefalse{bodyCon}
@@ -959,9 +987,9 @@
 \togglefalse{bodyCon}
 }{
 \ifthenelse{\equal{#3}{}}{
-,\spanit\\& &&#1  #2\togglefalse{previousThird}
+\defaultOCPConstraint\spanit\\& &&#1  #2\togglefalse{previousThird}
 }{
-,\spanit\\& &&#1  #2 && #3
+\defaultOCPConstraint\spanit\\& &&#1  #2 && #3
 \toggletrue{previousThird}
 }
 \togglefalse{bodyCon}
@@ -976,16 +1004,16 @@
 }{
 \ifthenelse{\equal{#3}{}}{
 \ifthenelse{\equal{#2}{}}{
-,\spanit\\&&&#1  #2
+\defaultOCPConstraint\spanit\\&&&#1  #2
 }{
-,\spanit\\ &&#1  &#2
+\defaultOCPConstraint\spanit\\ &&#1  &#2
 }
 \togglefalse{previousThird}
 }{
 \ifthenelse{\equal{#2}{}}{
-,\spanit\\&&&#1  #2 && #3
+\defaultOCPConstraint\spanit\\&&&#1  #2 && #3
 }{
-,\spanit\\ &&#1  &#2&& #3}
+\defaultOCPConstraint\spanit\\ &&#1  &#2&& #3}
 \toggletrue{previousThird}
 }
 \togglefalse{bodyCon}
@@ -999,9 +1027,9 @@
 \togglefalse{bodyCon}
 }{
 \ifthenelse{\equal{#3}{}}{
-,\spanit\\& &&#1  #2 \togglefalse{previousThird}
+\defaultOCPConstraint\spanit\\& &&#1  #2 \togglefalse{previousThird}
 }{
-,\spanit\\& &&#1  #2 && #3
+\defaultOCPConstraint\spanit\\& &&#1  #2 && #3
 \toggletrue{previousThird}
 }
 \togglefalse{bodyCon}

Modified: trunk/Master/texmf-dist/tex/latex/optidef/optidef.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/optidef/optidef.sty	2016-09-26 20:52:37 UTC (rev 42153)
+++ trunk/Master/texmf-dist/tex/latex/optidef/optidef.sty	2016-09-26 20:52:50 UTC (rev 42154)
@@ -1,4 +1,4 @@
-% optidef - Version 2.0
+% optidef - Version 2.1
 %
 %Copyright 2016 J. Lago Garcia
 %
@@ -12,11 +12,11 @@
 %This work consists of the file optidef.sty.
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{optidef}[2016/08/07 - version=2.0,  Package for defining optimization problems]
+\ProvidesPackage{optidef}[2016/09/25 - version=2.1,  Package for defining optimization problems]
 
 \RequirePackage{environ}
 \RequirePackage{mathtools}	
-\RequirePackage{xifthen}	
+\RequirePackage{xifthen}
 \RequirePackage{etoolbox}	
 \RequirePackage{xparse}	
 \RequirePackage{calc}	
@@ -25,6 +25,7 @@
 % DEFINING PACKAGE OPTIONS
 %%%%%%%%%%%%%%%%%%%%%%%
 % Default
+\newcommand{\defaultOCPConstraint}{,}
 \newcommand{\defaultProblemFormat}{l}
 
 \DeclareOption{short}{
@@ -35,6 +36,10 @@
 \renewcommand{\defaultProblemFormat}{l}
 }
 
+\DeclareOption{nocomma}{
+	\renewcommand{\defaultOCPConstraint}{}
+}
+
 \ProcessOptions\relax
 
 %%%%%%%%%%%%%%%%%%%%%%%
@@ -264,7 +269,7 @@
 				\bodyconst{#1}
 				\togglefalse{bodyCon}
 			}{
-			,\\&\quad &&#1 #2\span\span
+			\defaultOCPConstraint\\&\quad &&#1 #2\span\span
 			\togglefalse{bodyCon}
 				}
 		}{
@@ -272,7 +277,7 @@
 				\bodyconst{#1}{#2}
 				\togglefalse{bodyCon}
 			}{
-			,\\&\quad &#1 & #2\span\span
+			\defaultOCPConstraint\\&\quad &#1 & #2\span\span
 			\togglefalse{bodyCon}
 			}
 		}
@@ -283,9 +288,9 @@
 				\togglefalse{bodyCon}
 			}{
 				\ifthenelse{\equal{#2}{}}{
-					,\\&\quad &&#1 #2 && #3
+					\defaultOCPConstraint\\&\quad &&#1 #2 && #3
 				}{
-					,\\&\quad &#1 & #2 && #3
+					\defaultOCPConstraint\\&\quad &#1 & #2 && #3
 				}
 				\togglefalse{bodyCon}
 			}
@@ -304,18 +309,18 @@
 }{
 	\ifthenelse{\equal{#2}{}}{
 		\ifthenelse{\equal{#3}{}}{
-			,\spanit\\&\quad &&#1 #2 
+			\defaultOCPConstraint\spanit\\&\quad &&#1 #2 
 			\togglefalse{previousThird}
 		}{
-			,\spanit\\&\quad &&#1 #2 && #3
+			\defaultOCPConstraint\spanit\\&\quad &&#1 #2 && #3
 			\toggletrue{previousThird}
 		}
 	}{
 		\ifthenelse{\equal{#3}{}}{
-			,\spanit\\&\quad &#1 & #2 
+			\defaultOCPConstraint\spanit\\&\quad &#1 & #2 
 			\togglefalse{previousThird}
 		}{
-			,\spanit\\&\quad &#1 & #2 && #3
+			\defaultOCPConstraint\spanit\\&\quad &#1 & #2 && #3
 			\toggletrue{previousThird}
 		}
 }
@@ -331,16 +336,16 @@
 	}{
 		\ifthenelse{\equal{#2}{}}{
 			\ifthenelse{\equal{#3}{}}{
-				,\spanit\\&&&#1  #2 		\togglefalse{previousThird}
+				\defaultOCPConstraint\spanit\\&&&#1  #2 		\togglefalse{previousThird}
 			}{
-				,\spanit\\&&&#1  #2 && #3
+				\defaultOCPConstraint\spanit\\&&&#1  #2 && #3
 				\toggletrue{previousThird}		
 			}
 		}{
 			\ifthenelse{\equal{#3}{}}{
-				,\spanit\\ &&#1  &#2 \togglefalse{previousThird}
+				\defaultOCPConstraint\spanit\\ &&#1  &#2 \togglefalse{previousThird}
 			}{
-				,\spanit\\ &&#1  &#2 && #3
+				\defaultOCPConstraint\spanit\\ &&#1  &#2 && #3
 				\toggletrue{previousThird}
 			}
 		}
@@ -355,9 +360,9 @@
 			\togglefalse{bodyCon}
 		}{
 			\ifthenelse{\equal{#3}{}}{
-				,\spanit\\&\quad &&#1  #2 \togglefalse{previousThird}
+				\defaultOCPConstraint\spanit\\&\quad &&#1  #2 \togglefalse{previousThird}
 			}{
-				,\spanit\\&\quad &&#1  #2 && #3
+				\defaultOCPConstraint\spanit\\&\quad &&#1  #2 && #3
 				\toggletrue{previousThird}
 			}
 		\togglefalse{bodyCon}
@@ -371,9 +376,9 @@
 		\togglefalse{bodyCon}
 	}{
 		\ifthenelse{\equal{#3}{}}{
-			,\spanit\\& &&#1  #2\togglefalse{previousThird}
+			\defaultOCPConstraint\spanit\\& &&#1  #2\togglefalse{previousThird}
 		}{
-			,\spanit\\& &&#1  #2 && #3
+			\defaultOCPConstraint\spanit\\& &&#1  #2 && #3
 			\toggletrue{previousThird}
 		}
 		\togglefalse{bodyCon}
@@ -388,16 +393,16 @@
 	}{
 		\ifthenelse{\equal{#3}{}}{
 			\ifthenelse{\equal{#2}{}}{
-				,\spanit\\&&&#1  #2
+				\defaultOCPConstraint\spanit\\&&&#1  #2
 			}{
-			,\spanit\\ &&#1  &#2
+			\defaultOCPConstraint\spanit\\ &&#1  &#2
 			}
 			\togglefalse{previousThird}
 		}{
 			\ifthenelse{\equal{#2}{}}{
-				,\spanit\\&&&#1  #2 && #3
+				\defaultOCPConstraint\spanit\\&&&#1  #2 && #3
 			}{
-			,\spanit\\ &&#1  &#2&& #3}
+			\defaultOCPConstraint\spanit\\ &&#1  &#2&& #3}
 		\toggletrue{previousThird}
 		}
 		\togglefalse{bodyCon}
@@ -411,9 +416,9 @@
 		\togglefalse{bodyCon}
 	}{
 		\ifthenelse{\equal{#3}{}}{
-			,\spanit\\& &&#1  #2 \togglefalse{previousThird}
+			\defaultOCPConstraint\spanit\\& &&#1  #2 \togglefalse{previousThird}
 		}{
-			,\spanit\\& &&#1  #2 && #3
+			\defaultOCPConstraint\spanit\\& &&#1  #2 && #3
 			\toggletrue{previousThird}
 		}
 	\togglefalse{bodyCon}



More information about the tex-live-commits mailing list