Verzeichnis macros/latex/contrib/mathwrap
mathwrap
A LaTeX package to improve line-breaking in inline math mode
Lee Yiu Sing November 2026 — Version 1.0
Introduction
By default, LaTeX strongly avoids breaking lines inside inline math ($...$), frequently resulting in "Overfull \hbox" warnings for long lists or sequences. The mathwrap package modifies the math-mode comma and adjusts penalty parameters to allow breaks where appropriate, without affecting display math environments.
Installation
Place mathwrap.sty in your project directory or local texmf tree.
Usage
Load the package in your preamble:
\usepackage{mathwrap}
Package Options
By default, mathwrap lowers \binoppenalty and \relpenalty, and increases \emergencystretch. You can disable these global changes if they conflict with your document class:
nopenalties: Disables adjustments to\binoppenaltyand\relpenalty.nostretch: Disables adjustments to\emergencystretch.
Example:
\usepackage[nopenalties,nostretch]{mathwrap}
Commands
Activating the comma can occasionally conflict with parser-reliant packages (e.g., TikZ, pgfplots, siunitx). You can toggle the package behavior locally to resolve compilation errors inside specific environments:
\mathwrapOff: Restores the standard math comma.\mathwrapOn: Reactivates the mathwrap comma.
Example workaround for TikZ:
\mathwrapOff \begin{tikzpicture} \draw (0,0) -- (1,1); \end{tikzpicture} \mathwrapOn
License
This package is released under the LaTeX Project Public License (LPPL), version 1.3c or later.
Herunterladen des vollständigen Inhalts dieses Pakets in einem Zip-Archiv (163.6k).
Mathwrap – Automatic line breaking in inline math
mathwrap improves line breaking in inline math mode. By default, LaTeX avoids breaking lines inside inline math, which frequently results in Overfull \hbox warnings for long lists or sequences. The package makes the comma active in inline math to allow breaks after it, and optionally adjusts the penalties for binary operators and relations as well as \emergencystretch. Display math is not affected.
| Paket | Mathwrap |
| Version | 1.0 |
| Lizenzen | The LaTeX Project Public License 1.3c |
| Copyright | 2026 Lee Yiu Sing |
| Betreuer | Yiu Sing Lee |
| Enthalten in | TeX Live als mathwrap |
| Themen | Mathematik |