mathastext

A LaTeX package: mathastext
Copyright © 2011-2019, 2022-2024 Jean-François Burnol.
Current version is 1.4e (2024/10/26)
README, README.html, INSTALL.txt, ChangeLog.md, pdf, sty, dtx, mathastext.tds.zip, mathastexttestalphabets.tex, mathastexttestalphabets.pdf, showcase page, CTAN page.

This Work may be distributed and/or modified under the conditions of the The LaTeX Project Public License 1.3c.

  1. Philosophy
  2. Download
  3. Related
  4. Tips
  5. History

Philosophy

The package originates in some (even worse) macros I had been using many years ago to produce handouts as if done on a typewriter, or better said, to produce documents with a somewhat rough, but unified look, done by a real human and meaning to convey some message to real humans. The hope was to coerce the reader into making a real effort at assimilating the entirety of the material, text and math, not knowing in advance which piece would prove to be more important than the others.

Riemann1859.png
\usepackage[T1]{fontenc}
\usepackage[german]{babel}
\usepackage[variablett]{lmodern}
\renewcommand\familydefault\ttdefault
\usepackage[LGRgreek]{mathastext}
\MTgreekfont{lmtt}\Mathastext

In a well-crafted mathematical document, every single part is as important as any other one, or, rather, it is up to the reader to uncover the web of links between atoms.

The example above uses a typewriter font which well illustrates the purpose. But mathastext will work with all kinds of fonts and can produce less militant math: see the examples (be patient, this page with its embedded png images weighs circa 5 Mo!) A notable feature of mathastext is to give a simple interface to using many distinct math fonts in the same document: special example.

Optimal typographical results for documents containing mathematical symbols can only be hoped for with math fonts specifically designed to match a given text typeface. Although the list of freely available math fonts for (PDF)LaTeX is slowly expanding (Computer Modern, AMS fonts, PX fonts, TX fonts, Fourier-GUTenberg, Math Design, Kepler Project, newtx, mathabx, others ... ; and ([2012/10/27]) on the Unicode side (XeTeX/LuaTeX): Asana-Math, XITS, Latin Modern Math, TeX Gyre Pagella Math, TeX Gyre Termes Math) it remains limited. Chances are you will not find a math font which fits well with your favorite text font.

Try out mathastext: it will simply use the text font also for the math! (additionally to Latin letters, digits, punctuation signs, a few math symbols available in the ascii set, such as +,–,<,>,=, will also be picked up from the text font.) Often this gives quite satisfying results especially if, like the author, you aim at a very unified look for the document, and in particular prefer upright to slanted shapes for math (mathastext does have an option to maintain the usual slanted shape).

Examples (page last updated around 2018, examples last updated around 2012; be patient, the page with its embedded png images weighs circa 5 Mo! (wow...) It contains about 70 examples, as png images and/or as pdf files.)

Download

Tips

Abridged version history

2011/01/25 1.0
Initial version. (doc)
2011/02/01 1.1
bugs fixed; options italic and frenchmath; minus as endash.
2011/02/06 1.11
bugs fixed; \Mathastext admits optional math version name.
2011/03/11 1.13
bugs fixed; option LGRgreek.
2011/04/03 1.14b
bugs fixed; options LGRgreeks and selfGreeks.
2012/09/26 1.15
option subdued allowing the mathastext-ification to act locally.
2012/10/05 1.15c
commands to set-up distinct LGR Greek fonts in each math version.
2012/10/22 1.15e
improvements to subdued; automatic spaces after \forall and \exists.
2012/10/25 1.15g
improvements in \#, \&, \$, \%; code cleaned up and better documented.
2012/12/20 1.2
extended scope of the math alphabets; automatic space before the derivative glyph; documentation improved.
2013/12/31 1.2b
automatic italic corrections in math mode.
2013/01/10 1.2e
remaining technical issues with active characters in v1.2 and v1.2b solved; extended test files, documentation, and source code comments
2013/09/02 1.3
new command \MTsetmathskips.
2013/12/14 1.3c
mechanism of "inheritance" in the declaration of mathastext math versions; starred variant of \MTversion leaves untouched the text font.
2014/05/23 1.3d
new commands \MTstandardgreek and \MTcustomgreek.
2015/09/10 1.3e
bugfix (option ldelims badly redefined \lbrace and \rbrace).
2015/09/12 1.3f
info rather than warning viz. amsmath \resetMathstrut@. self extracting README.md with Markdown syntax.
2015/10/15 1.3g
compatibility patch with LaTeX 2015/10/01 regarding LuaLaTeX.
2015/10/31 1.3h
bugfix regarding options symbolgreek/selfGreek/selfGreeks.
2016/01/06 1.3i
compatibility layer with \url's use of math mode.
2016/01/15 1.3j
stronger subdued mode and related under-the-hood changes.
2016/01/24 1.3k
documentation fixes.
2016/01/29 1.3l
compatibility with TL2016 fontspec.
2016/04/22 1.3n
improved compatibility with amsmath.
2016/05/03 1.3o
patches around LuaLaTeX+luaotfload font issues in math mode.
2016/10/31 1.3q
option unicodeminus.
2018/08/22 1.3t
compatibility fix with fontspec relative to subdued option. no more redefinitions of \i and \j, only \imath and \jmath.
2019/08/20 1.3u
support for math versions with varying font encodings.
2019/09/19 1.3v
robust and protected math macros to match LaTeX 2019-10-01
2019/11/16 1.3w
workaround to a (provisory) LaTeX+amsmath bug regarding accents
2022/11/04 1.3y
  • options ncccomma, binarysemicolon and frenchmath*.
  • with LGRgreek: \...up and \...it variants for Greek letters
  • and \mathgreekup/\mathgreekit alphabets.
2023/09/01 1.3z
fix 1.3y regression regarding selfGreek option.
2023/12/20 1.3za
option LGRgreek+, documentation improvements.
2023/12/29 1.3zb
frenchmath* update, decimalcomma, modified build logs, documentation.
2024/07/20 1.4a
  • core internal refactoring: mathastext does not use \everymath anymore.
  • option activedigits.
  • option everymath to revert to legacy behavior.
  • bugfix regarding the babel-spanish dot in math mode.
  • update to a LuaLaTeX font related workaround.
  • conversion of this page to html5 (2024/07/21).
2024/07/27 1.4b
  • fix a 1.4a regression regarding nodigits option.
  • option noletters.
  • option everymath warns about its removal at next major release.
2024/10/21 1.4c
  • fix a 1.4 regression under XeLaTeX which caused a crash during package loading if document had loaded unicode-math and used \setmathfont.
2024/10/26 1.4d
  • fix a 1.4 regression which caused a crash with input such as f'' (except under option everymath).
2024/10/26 1.4e
  • fix a 1.4 regression which broke the unimathaccents option (which is not recommended anyhow).
  • fix a 1.3y regression which had made \MTversion{normal} cause breakage if with option LGRgreek or LGRgreeks (but not if subdued).