CTAN Comprehensive TeX Archive Network

Directory macros/latex/contrib/mpformulation

README.md

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.

\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 , for instance TEXMFHOME/tex/latex/mpformulation/, or in the directory of your document.

Requirements: 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 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

Download the contents of this package in one zip archive (433.3k).

Mpformulation – Typesetting mathematical programs (optimization models)

Typesets linear, integer and nonlinear programs as in operations research journals: objective, automatic subject to, one constraint per line with its quantifier, per-constraint or per-model numbering. Constraints too wide for the line are reorganized automatically, which suits two-column journals. Optional alignment on the relation symbol and left-aligned quantifiers.

PackageMpformulation
Bug tracker
Repository
Developers
Version2.0
LicensesThe Project Public License 1.3c
Copyright2025–2026 FYP
MaintainerFYP
TopicsOptimise
Maths system equations
Maths
...
Guest Book Sitemap Contact Contact Author