# mpformulation — typesetting mathematical programs

Version 2.0, September 28, 2026

`mpformulation` typesets optimization models (linear, integer, nonlinear
programs) the way they appear in operations research journals: an
objective function, a "subject to" line, and one constraint per line with
its quantifier (∀ i ∈ I) aligned right or in a common column, and an
equation number.

```latex
\usepackage{mpformulation}
...
\begin{mpformulation}
  \objective[obj]{KP}{Maximize}{\sum_{j \in J} p_j x_j}
  \constraint[cap]{\sum_{j \in J} w_j x_j \leq W}{}
  \constraint[bin]{x_j \in \{0, 1\}}{\forall j \in J}
\end{mpformulation}
```

Main features:

- "subject to" and the final period added automatically;
- numbering per constraint, per model (1a, 1b, …) or one number per model;
- constraints too wide for the line (e.g. in two-column journals) are
  reorganized automatically: shorter indent, quantifier broken at its
  commas or moved below, optional breaks in long expressions and
  objectives;
- optional alignment on the relation symbol and left-aligned quantifiers;
- no page break after the objective or "subject to", nor before the last
  constraint.

## Files

- `mpformulation.sty` — the package
- `mpformulation-doc.pdf` — user manual
- `mpformulation-doc.tex` — source of the manual
- `mpformulation_example.tex`, `mpformulation_example_twocolumn.tex` —
  complete examples (one-column and two-column layouts)

## Installation

Put `mpformulation.sty` in a directory searched by TeX, for instance
`TEXMFHOME/tex/latex/mpformulation/`, or in the directory of your document.

Requirements: LaTeX 2021-06-01 or later; `amsmath` and `keyval` (loaded by
the package). The manual also uses `tcolorbox`, `listings`, `booktabs`,
`mathtools`, `hyperref` and `cleveref`.

## License

Copyright (c) 2025-2026 FYP

This work may be distributed and/or modified under the conditions of the
LaTeX Project Public License, either version 1.3c of this license or (at
your option) any later version. The latest version of this license is in
https://www.latex-project.org/lppl.txt

This work has the LPPL maintenance status "maintained". The Current
Maintainer of this work is FYP. This work consists of the files
listed above.

## Contact

Report bugs and comments to mpformulation.sty@gmail.com
