# 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: ```latex \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 `\binoppenalty` and `\relpenalty`. * `nostretch`: Disables adjustments to `\emergencystretch`. Example: ```latex \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: ```latex \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.