summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/lpform
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-07-14 22:42:51 +0000
committerKarl Berry <karl@freefriends.org>2014-07-14 22:42:51 +0000
commiteea6b3d634666a714ba391fa8c3894d79708a831 (patch)
tree9de68c6b319a7551fcfa8a8e50017f78eee27a0b /Master/texmf-dist/doc/generic/lpform
parent04e70106b8a3bbfeeadc2621838dbf10a29ed06c (diff)
lpform (14jul14)
git-svn-id: svn://tug.org/texlive/trunk@34608 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/generic/lpform')
-rw-r--r--Master/texmf-dist/doc/generic/lpform/README17
-rw-r--r--Master/texmf-dist/doc/generic/lpform/lpform-doc.pdfbin0 -> 262483 bytes
-rw-r--r--Master/texmf-dist/doc/generic/lpform/lpform-doc.tex288
3 files changed, 305 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/generic/lpform/README b/Master/texmf-dist/doc/generic/lpform/README
new file mode 100644
index 00000000000..4f0f9456a47
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/lpform/README
@@ -0,0 +1,17 @@
+This is the README file for the lpform package.
+
+Author: Marijn Waltman
+E-mail: marijnwaltman AT hotmail DOT com
+Date: July 14, 2014
+
+Description:
+The 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.
+
+Included files:
+lpform-doc.pdf - The package documentation.
+lpform-doc.tex - The package documentation source file.
+lpform.sty - The style file for use in LaTeX.
+
+This package requires the xifthen package.
+
+This package is licensed under the LaTeX Project Public License. \ No newline at end of file
diff --git a/Master/texmf-dist/doc/generic/lpform/lpform-doc.pdf b/Master/texmf-dist/doc/generic/lpform/lpform-doc.pdf
new file mode 100644
index 00000000000..d914003aa3d
--- /dev/null
+++ 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
new file mode 100644
index 00000000000..37d899b9b35
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/lpform/lpform-doc.tex
@@ -0,0 +1,288 @@
+\documentclass{article}
+
+\usepackage{amsmath}
+\usepackage{amsfonts}
+\usepackage{amsthm}
+\usepackage[english]{babel}
+\usepackage[T1]{fontenc}
+\usepackage{lmodern}
+\usepackage{graphicx}
+\usepackage{lpform}
+\usepackage[parfill]{parskip}
+\usepackage{fancyvrb}
+
+\newcommand{\example}{\textbf{Example: }}
+
+\begin{document}
+\title{\textsc{lpform} Package Documentation}
+\author{by Marijn Waltman}
+\date{\today}
+
+\maketitle
+\tableofcontents
+
+\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.
+
+To start using the \textsc{lpform} package, write 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.
+
+There is also an optional \textit{noforall} argument. Its purposes are explained in Section \ref{sec:optional}.
+
+\section{Commands}
+
+This is a list of all commands which are included in the package.
+
+\begin{itemize}
+\item \textbf{\textbackslash begin\{lpformulation\}[name] ... \textbackslash end\{lpformulation\}}
+
+This is the environment in which the commands below should be placed. Each restriction is an equation and is aligned using an align environment.
+\begin{itemize}
+\item \textit{name} is an optional argument, which is the name given to the formulation (e.g. (P1)) and is displayed on the left of the formulation before the first line.
+\end{itemize}
+
+\item \textbf{\textbackslash lpobj[label]\{min/max\}\{objective function\}}
+
+This displays the objective function, followed by the ``subject to'' text.
+\begin{itemize}
+\item \textit{label} is an optional argument which is the label text used for referencing.
+\item \textit{min/max} is the text before the objective function, which is usually either min or max.
+\item \textit{objective function} is where you put the objective function in math text.
+\end{itemize}
+
+\item \textbf{\textbackslash lpeq[label]\{constraint\}\{for all\}}
+
+This displays a constraint as an equation with only an equation number (e.g. (1)).
+\begin{itemize}
+\item \textit{constraint} is the constraint, which is automatically formatted in a math environment.
+\item \textit{for all} is the for all argument. The `for all' argument is automatically formatted in a math environment. If there is no for all argument for your constraint, then this argument should be left empty.
+\end{itemize}
+
+\item \textbf{\textbackslash lpnewsubeq[label]\{constraint\}\{for all\}}
+
+This is the same as \textbackslash lpeq but it also starts a new list of subequations, which are indexed by the letters a,b,c,... (e.g. (2a)).
+
+\item \textbf{\textbackslash lpsubeq[label]\{constraint\}\{for all\}}
+
+This is the same as \textbackslash lpeq but it continues a previously started list of subequations (e.g. (2b)).
+
+\item \textbf{\textbackslash lplabel\{label name\}}
+
+This works the same as \textbackslash label and can be placed anywhere in the formulation to label it with \textit{label name}; the \textbackslash ref command then displays the name of the formulation given in lpformulation.
+
+\item \textbf{\textbackslash lpnewline}
+
+This can be placed inside the \textbackslash lpobj, \textbackslash lpeq, \textbackslash lpnewsubeq and \textbackslash lpsubeq commands in order to split the equation over multiple lines. For an example of using this command, see Section \ref{sec:split}.
+\end{itemize}
+
+The \textbackslash lpobj, \textbackslash lpeq, \textbackslash lpnewsubeq and \textbackslash lpsubeq commands all have starred versions, which hides the equation number at the end of the line.
+
+\example Formulation \ref{lp:form} is a knapsack problem with additional constraints \eqref{eq:add1} and \eqref{eq:add2}.
+
+\vspace{2ex}
+\begin{Verbatim}[frame=single]
+\begin{lpformulation}[(P)]
+\lpobj{max}{\sum_{i \in I} u_ix_i}
+\lpeq*{\sum_{i \in I} w_ix_i \le W}{}
+\lpnewsubeq[eq:add1]{\sum_{i \in I} x_i \le 5}{}
+\lpsubeq[eq:add2]{x_1 = 1}{}
+\lpeq{x_i \in \{0,1\}}{i \in I}
+\lplabel{lp:form}
+\end{lpformulation}
+\end{Verbatim}
+\begin{lpformulation}[(P)]
+\lplabel{lp:form}
+\lpobj{max}{\sum_{i \in I} u_ix_i}
+\lpeq*{\sum_{i \in I} w_ix_i \le W}{}
+\lpnewsubeq[eq:add1]{\sum_{i \in I} x_i \le 5}{}
+\lpsubeq[eq:add2]{x_1 = 1}{}
+\lpeq{x_i \in \{0,1\}}{i \in I}
+\end{lpformulation}
+
+\textbf{Important:} When adding equations inside the lpformulation environment, it is important that there are NO empty lines, as this will cause an error to occur. An example of using empty lines:
+
+\begin{Verbatim}[frame=single]
+\begin{lpformulation}
+\lpeq{5+1=6}{}
+
+\lpeq{5+2=7}{}
+\end{lpformulation}
+\end{Verbatim}
+
+\subsection{Optional arguments}
+\label{sec:optional}
+
+The \textsc{lpform} package has an optional \textit{noforall} argument, which can be used by writing
+
+\begin{Verbatim}[frame=single]
+\usepackage[noforall]{lpform}
+\end{Verbatim}
+
+in your document preamble. This argument removes the `for all' arguments from the \textbackslash lpeq, \textbackslash lpnewsubeq and \textbackslash lpsubeq commands. This can be useful if you want to make a simple list of equations without having to leave the `for all' argument empty each time, or if you want to typeset the `for all' arguments manually.
+
+\example An arbitrary list of equations (with \textit{noforall} on).
+
+\vspace{2ex}
+\begin{Verbatim}[frame=single]
+\begin{lpformulation}
+\lpeq{e^{i\pi} = -1}
+\lpnewsubeq{\phi = \frac{1+\sqrt{5}}{2}}
+\lpsubeq{\phi^2 - \phi - 1 = 0}
+\end{lpformulation}
+\end{Verbatim}
+\begin{lpformulation}
+\lpeq{e^{i\pi} = -1}{}
+\lpnewsubeq{\phi = \frac{1+\sqrt{5}}{2}}{}
+\lpsubeq{\phi^2 - \phi - 1 = 0}{}
+\end{lpformulation}
+
+\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.
+
+\begin{itemize}
+\item \textbf{\textbackslash lpsubjectto}
+
+This is the text which is shown in the `subject to'-line. Default value is `s.t.'. 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
+
+\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
+
+\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
+
+\begin{Verbatim}[frame=single]
+\renewcommand{\lpsubeqtag}{value}
+\end{Verbatim}
+
+to change this to \textit{value}.
+\end{itemize}
+
+\section{Custom layout examples}
+
+\subsection{Custom names, tags and spacing}
+
+This is an example of using the custom names, custom equation tags and custom spacing options. In this example the left indent has been removed, `max' has been changed to ``Maximize:'', the `subject to' line has been changed to ``Subject to:'' and the sub-equations are tagged by numbers instead of letters.
+
+\example A knapsack problem with additional constraints.
+
+\vspace{2ex}
+\begin{Verbatim}[frame=single]
+\renewcommand{\lpindent}{\hspace{0pt}}
+\renewcommand{\lpsubjectto}{Subject to:}
+\renewcommand{\lpsubeqtag}{\theequation .\arabic{subcounter}}
+\begin{lpformulation}
+\lpobj{Maximize:}{\sum_{i \in I} u_ix_i}
+\lpeq*{\sum_{i \in I} w_ix_i \le W}{}
+\lpnewsubeq{\sum_{i \in I} x_i \le 5}{}
+\lpsubeq{x_1 = 1}{}
+\lpeq{x_i \in \{0,1\}}{i \in I}
+\end{lpformulation}
+\end{Verbatim}
+\renewcommand{\lpindent}{\hspace{0pt}}
+\renewcommand{\lpsubjectto}{Subject to:}
+\renewcommand{\lpsubeqtag}{\theequation .\arabic{subcounter}}
+\begin{lpformulation}
+\lpobj{Maximize:}{\sum_{i \in I} u_ix_i}
+\lpeq*{\sum_{i \in I} w_ix_i \le W}{}
+\lpnewsubeq{\sum_{i \in I} x_i \le 5}{}
+\lpsubeq{x_1 = 1}{}
+\lpeq{x_i \in \{0,1\}}{i \in I}
+\end{lpformulation}
+
+\subsection{Aligned `for all' arguments}
+
+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
+
+\begin{Verbatim}[frame=single]
+\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.
+
+\example An arbitrary problem.
+
+\vspace{2ex}
+\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}
+\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}
+\lpsubeq{y_{ij} \in \{0,1\}}{i \in I, j \in J}
+\end{lpformulation}
+\end{Verbatim}
+\renewcommand{\lpindent}{\hspace{20pt}}
+\renewcommand{\lpsubjectto}{s.t.}
+\renewcommand{\lpsubeqtag}{\theequation\alph{subcounter}}
+\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}
+\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}
+\lpsubeq{y_{ij} \in \{0,1\}}{i \in I, j \in J}
+\end{lpformulation}
+
+\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.
+
+\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}{}
+\end{lpformulation}
+\end{Verbatim}
+\renewcommand{\lpforall}[1]{\quad \forall #1}
+\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}{}
+\end{lpformulation}
+
+\end{document} \ No newline at end of file