summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-04-18 22:37:22 +0000
committerKarl Berry <karl@freefriends.org>2015-04-18 22:37:22 +0000
commit05b27402165b238cbda0324fa156d076bfcf6480 (patch)
tree287a5d3c70b5c1fb01bcc5fa5046ee91758b2152
parentda033fbc4dff395803682eb5dbc0b3e5b253c994 (diff)
lpform (18apr15)
git-svn-id: svn://tug.org/texlive/trunk@36918 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/generic/lpform/lpform-doc.pdfbin262483 -> 278850 bytes
-rw-r--r--Master/texmf-dist/doc/generic/lpform/lpform-doc.tex76
-rw-r--r--Master/texmf-dist/tex/generic/lpform/lpform.sty8
3 files changed, 51 insertions, 33 deletions
diff --git a/Master/texmf-dist/doc/generic/lpform/lpform-doc.pdf b/Master/texmf-dist/doc/generic/lpform/lpform-doc.pdf
index d914003aa3d..df093e973ba 100644
--- a/Master/texmf-dist/doc/generic/lpform/lpform-doc.pdf
+++ b/Master/texmf-dist/doc/generic/lpform/lpform-doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/generic/lpform/lpform-doc.tex b/Master/texmf-dist/doc/generic/lpform/lpform-doc.tex
index 37d899b9b35..8a0e52c6a10 100644
--- a/Master/texmf-dist/doc/generic/lpform/lpform-doc.tex
+++ b/Master/texmf-dist/doc/generic/lpform/lpform-doc.tex
@@ -23,17 +23,17 @@
\section{Introduction}
-The \textsc{lpform} package is designed for easily writing linear programming formulations one restriction at a time. With this package, one can easily label equations, formulations can span multiple pages and several elements of the layout (such as spacing, texts and equation tags) are also customizable. Besides linear programming formulations, this package can also be used to display any series of aligned equations with easy labeling/referencing and other customization options.
+The \textsc{lpform} package allows users to easily write linear programming formulations one restriction at a time. With this package, one can easily label equations, formulations can span multiple pages and several elements of the layout (such as spacing, texts and equation tags) are also customizable. Besides linear programming formulations, this package can also be used to display any series of aligned equations with easy labeling, referencing and other customization options.
-To start using the \textsc{lpform} package, write this in your document preamble:
+To start using the \textsc{lpform} package, put this in your document preamble:
\begin{Verbatim}[frame=single]
\usepackage{lpform}
\end{Verbatim}
-The `lpform.sty' file should also be in the same folder as your .tex file.
+The `lpform.sty' file should also be in the same folder as your .tex file.
-There is also an optional \textit{noforall} argument. Its purposes are explained in Section \ref{sec:optional}.
+There are also the optional \textit{noforall} and \textit{alignedforall} arguments. Its purposes are explained in Section \ref{sec:optional}.
\section{Commands}
@@ -115,10 +115,12 @@ The \textbackslash lpobj, \textbackslash lpeq, \textbackslash lpnewsubeq and \te
\end{lpformulation}
\end{Verbatim}
-\subsection{Optional arguments}
+\section{Optional arguments}
\label{sec:optional}
-The \textsc{lpform} package has an optional \textit{noforall} argument, which can be used by writing
+\subsection{\textit{noforall}}
+
+The \textsc{lpform} package has an optional \textit{noforall} argument, which can be used by putting
\begin{Verbatim}[frame=single]
\usepackage[noforall]{lpform}
@@ -142,6 +144,23 @@ in your document preamble. This argument removes the `for all' arguments from th
\lpsubeq{\phi^2 - \phi - 1 = 0}{}
\end{lpformulation}
+\subsection{\textit{alignedforall}}
+\label{sec:optionalalign}
+
+The optional \textit{alignedforall} argument can be used by putting
+
+\begin{Verbatim}[frame=single]
+\usepackage[alignedforall]{lpform}
+\end{Verbatim}
+
+in your document preamble. This argument aligns the `for all' arguments of all equations in the \textbackslash lpformulation environment. The alignment is either around the center of the page or to the right of the longest equation if this equation is longer than half of the page. Using this argument is equivalent to using
+
+\begin{Verbatim}[frame=single]
+\renewcommand{\lpforall}[1]{&& \forall #1}
+\end{Verbatim}
+
+For examples of this argument in use, see Section \ref{sec:aligned}.
+
\section{Internal variables}
This package uses several internal variables to determine how the equations are displayed. These variables can also be redefined in order to customize the layout.
@@ -149,43 +168,35 @@ This package uses several internal variables to determine how the equations are
\begin{itemize}
\item \textbf{\textbackslash lpsubjectto}
-This is the text which is shown in the `subject to'-line. Default value is `s.t.'. Use
+This is the text which is shown in the `subject to'-line. Default value is `s.t.'. To change this variable to \textit{value}, use
\begin{Verbatim}[frame=single]
\renewcommand{\lpsubjectto}{value}
\end{Verbatim}
-to change this to \textit{value}.
-
\item \textbf{\textbackslash lpforall}
-This is the way the \textit{for all} argument is displayed. Default value is `\textbackslash quad \textbackslash forall \#1'. Use
+This is the way the \textit{for all} argument is displayed. Default value is `\textbackslash quad \textbackslash forall \#1'. To change this variable to \textit{value}, use
\begin{Verbatim}[frame=single]
\renewcommand{\lpforall}[1]{value}
\end{Verbatim}
-to change this to \textit{value}.
-
\item \textbf{\textbackslash lpindent}
-This is the size of the left indent. Default value is `\textbackslash hspace\{20pt\}'. Use
+This is the size of the left indent. Default value is `\textbackslash hspace\{20pt\}'. To change this variable to \textit{value}, use
\begin{Verbatim}[frame=single]
\renewcommand{\lpindent}{value}
\end{Verbatim}
-to change this to \textit{value}.
-
\item \textbf{\textbackslash lpsubeqtag}
-This is the way that sub-equations are tagged. Default value is `\textbackslash theequation\textbackslash alph\{subcounter\}', where subcounter is the counter of the sub-equation in the list. Use
+This is the way that sub-equations are tagged. Default value is `\textbackslash theequation\textbackslash alph\{subcounter\}', where subcounter is the counter of the sub-equation in the list. To change this variable to \textit{value}, use
\begin{Verbatim}[frame=single]
\renewcommand{\lpsubeqtag}{value}
\end{Verbatim}
-
-to change this to \textit{value}.
\end{itemize}
\section{Custom layout examples}
@@ -221,6 +232,7 @@ This is an example of using the custom names, custom equation tags and custom sp
\end{lpformulation}
\subsection{Aligned `for all' arguments}
+\label{sec:aligned}
Since each equation is put in an align environment, the `for all' arguments can be aligned by letting a new column start before the argument is shown. This can be achieved by using
@@ -228,7 +240,7 @@ Since each equation is put in an align environment, the `for all' arguments can
\renewcommand{\lpforall}[1]{&& \forall #1}
\end{Verbatim}
-Note that this aligns the `for all' arguments either around the center of the page or just to the right of the longest equation if this equation is long.
+or by using the \textit{alignedforall} argument in the document preamble. The `for all' arguments will be aligned either around the center of the page or just to the right of the longest equation if this equation is longer than half of the page.
\example An arbitrary problem.
@@ -236,10 +248,10 @@ Note that this aligns the `for all' arguments either around the center of the pa
\begin{Verbatim}[frame=single]
\renewcommand{\lpforall}[1]{&& \forall #1}
\begin{lpformulation}
-\lpobj{max}{\sum_{i \in I} u_ix_i - ...
- ... \sum_{i \in I} \sum_{j \in J} v_iy_{ij}}
-\lpeq{\sum_{i \in I} y_{ij} - \sum_{i \in I} x_i ...
- ... \le 3.141592653589793238462643...}{j \in J}
+\lpobj{max}{\sum_{i \in I} u_ix_i
+ - \sum_{i \in I} \sum_{j \in J} v_iy_{ij}}
+\lpeq{\sum_{i \in I} y_{ij} - \sum_{i \in I} x_i
+ \le 3.141592653589793238462643...}{j \in J}
\lpeq{\sum_{i \in I} x_i \le 5}{}
\lpeq{\sum_{j \in J} y_{ij} \ge 5}{i \in I}
\lpnewsubeq{x_i \in \{0,1\}}{i \in I}
@@ -262,21 +274,21 @@ Note that this aligns the `for all' arguments either around the center of the pa
\subsection{Splitting long equations}
\label{sec:split}
-Sometimes an equation can be too long to fit on just one line, which has some undesirable results. In these situation you can use \textbackslash lpnewline to break up the equation and divide it over multiple lines. Additional spacing can be added manually.
+Sometimes an equation can be too long to fit on just one line, which has some undesirable results. In these situations the \textbackslash lpnewline command can be used to break up the equation and divide it over multiple lines. Additional spacing can be added manually.
\example Breaking up a long equation.
\vspace{2ex}
\begin{Verbatim}[frame=single]
\begin{lpformulation}
-\lpeq{1+\frac{1}{2}+\frac{1}{4}+\frac{1}{8}+\frac{1}{16}+ ...
- ... +\frac{1}{32}+\frac{1}{64}+\frac{1}{128}+ ...
- ... +\frac{1}{256}+\frac{1}{512}+\frac{1}{1024}+ ...
- ... +\frac{1}{2048}+...=2}{}
-\lpeq{1+\frac{1}{2}+\frac{1}{4}+\frac{1}{8}+\frac{1}{16}+ ...
- ... +\frac{1}{32}+\frac{1}{64}+\frac{1}{128}+ ...
- ... +... \lpnewline\qquad ...+\frac{1}{256}+ ...
- ... +\frac{1}{512}+\frac{1}{1024}+\frac{1}{2048}+...=2}{}
+\lpeq{1+\frac{1}{2}+\frac{1}{4}+\frac{1}{8}+\frac{1}{16}
+ +\frac{1}{32}+\frac{1}{64}+\frac{1}{128}
+ +\frac{1}{256}+\frac{1}{512}+\frac{1}{1024}
+ +\frac{1}{2048}+...=2}{}
+\lpeq{1+\frac{1}{2}+\frac{1}{4}+\frac{1}{8}+\frac{1}{16}
+ +\frac{1}{32}+\frac{1}{64}+\frac{1}{128}+...
+ \lpnewline\qquad ...+\frac{1}{256}+\frac{1}{512}
+ +\frac{1}{1024}+\frac{1}{2048}+...=2}{}
\end{lpformulation}
\end{Verbatim}
\renewcommand{\lpforall}[1]{\quad \forall #1}
diff --git a/Master/texmf-dist/tex/generic/lpform/lpform.sty b/Master/texmf-dist/tex/generic/lpform/lpform.sty
index 75a228a425f..59760c4e81c 100644
--- a/Master/texmf-dist/tex/generic/lpform/lpform.sty
+++ b/Master/texmf-dist/tex/generic/lpform/lpform.sty
@@ -1,5 +1,5 @@
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lpform}[2014/07/14]
+\ProvidesPackage{lpform}[2015/04/18]
\usepackage{xifthen}
@@ -64,6 +64,12 @@
\renewcommand{\@lpsubeq}[2][]{\ifthenelse{\value{eqcounter} = 0}{}{\displaybreak[0]\\}\stepcounter{eqcounter}&\lpindent\refstepcounter{subcounter} #2 \tag{\lpsubeqtag}\ifthenelse{\isempty{#1}}{}{\label{#1}}&}
\renewcommand{\@@lpsubeq}[2][]{\ifthenelse{\value{eqcounter} = 0}{}{\displaybreak[0]\\}\stepcounter{eqcounter}&\lpindent #2 \nonumber\ifthenelse{\isempty{#1}}{}{\label{#1}}&}
}
+
+% Using the alignedforall option
+\DeclareOption{alignedforall}{
+ \renewcommand{\lpforall}[1]{&& \forall #1}
+}
+
\ExecuteOptions{}
\ProcessOptions\relax