Be patient, the page with all its embedded png images weighs about 5 MB...

A LaTeX package: mathastext

mathastext is a package to allow to use the text font also in mathematics mode, thus giving a very unified look to the produced document. As a side-effect it alleviates somewhat the problem of the scarcity of free math fonts for TeX typesetting . . . (back to mathastext.html).

Examples:

...and as pdf files
Further examples
(latex+dvipng or xelatex+gs)
(dvipdfmx/xelatex)
(latex+dvipng and mainly latex+dvips+gs)
PDF files with some pages as PNG images in this page: PDF only examples:

All fonts(1) are freely available (the LaTeX Font Catalogue is a very useful resource), most of them being already included in the standard TeX distributions or downloadable as ready-made packages from CTAN. In one instance (Vollkorn) the fonts were available as ttf files, and were installed for LaTeX using the otfinst script.

(1) most of the xelatex's examples are with fonts provided with the system on a mac os x machine, some use opentype fonts included in the TeXLive distribution, and two examples use opentype fonts bundled inside a freely distributed PDF viewer.

The examples numbered 42-52 illustrate the italic option of the package. However, when using italic letters in math mode, their protruding characteristics (most notable in the case of the letter f') often lead to overlapping problems with delimiters or other symbols (the math italic fonts reestablish sufficient kerning around letters compared to text italic). This is one reason why most examples here are with upright letters. The other reason being that the author believes that using upright letters in math mode is esthetically more pleasing.(2) There is no reason to have such a contrast as has been practiced in scientific typography (and re-inforced as the "no way to do otherwise" de facto default for the TeX users of the last three decades) between the text and the formulas, because the text is a formula in its own right (and vice versa). And this remark is particularly valid for the italic shape, whose application is inconsistent (to the point that there are battles of «experts» about whether the d' in dx' should be upright or slanted, that the x' is slanted is anyhow accepted as a definitive axiom.)

(2) it seems that it is only during the last few years, as a result of the widespread use of the beamer package that scientific users of TeX have discovered that math could be displayed in other fonts than the defaults, in that case in sans serif! (but again they now all use the same fonts...)

Regarding the large mathematical symbols (sums, products, integrals), nothing is done by the package. The examples in this page are either with the default Computer Modern fonts, or the Fourier-GUTenberg fonts, or the PX/TX fonts. In alphabetical order, some of the packages (that I have either looked at or heard about) providing access to math fonts (either alongside text fonts, or designed to match a pre-existing typeface): anttor, arev, ccfonts, cmbright, concmath, fourier, iwona, kpfonts, kurier, mathdesign (garamond, charter, utopia), mathpazo, mathtime, mathptmx, mbtimes, ncfourier, newtx, pxfonts, txfonts,...  The differences for some among these packages are not in the math symbols but only in the (Greek and Latin) letters in math mode. Some links:

Go to the bottom for a (partial!) discussion of Greek letters, as have been used on the present page.

The XeTeX examples are provided just to show that mathastext is Unicode compatible, but let's recall that it is only concerned with a tiny Basic Latin subrange of the Unicode glyphs; mathspec and unicode-math are packages specially tailored to Unicode and you should look at them first.

mathastext can accomodate many math-as-text fonts in the same document. This is illustrated by this (very special...) example. The preamble of the LaTeX source is here.

Regarding this web page: the png images were converted from dvi files with the help of dvipng (it turns out the outcome is at 100dpi, so they will show in your browser at their real size only if your screen device has a 100dpi resolution), and from pdf files with gs (with -r500 -dDownScaleFactor=5 to get 100 pixels per inch of the original contents). The pdf files in the middle column above were produced via latex+dvipdfmx (some with latex+dvips+gs), or via xelatex. Earlier, most had been done via pdflatex (probably because it had been easier for me to do pdflatex rather than latex+dvips+gs simultaneously on dozens of files), but on 2012/10/07, I re-did them with dvipdfmx, which gave impressive size gains (indeed dvipdfmx has a compressed embedding of fonts): typically a ratio of 1 to 4, and in the case of Libertine/Biolinum, an improvement of 1 to 10! as the fonts may have changed, I re-did a pdflatex to double-check. In some cases, the pdf viewer complained of not being able to display the embedded font glyphs and I had to do dvips+gs in those cases rather than dvipdfmx.

In the first few images below, the symbols which do not match the other letters are not from the text font (mathastext does nothing for things such as \partial or \nabla or \ell or \wp). Everything following the math excerpt (the abc...z ABC...Z line for example) is typeset in math mode. The digits are in the .tex file given as $0\,1\,2\,3\,4\,5\,6\,7\,8\,9$, hence the spacings. In some instances the no dot j'' is absent from the font and appears as a black rectangle.

EXAMPLES WITH THE ITALIC OPTION

• Various:
• Logarithme et exponentielle (French Cursive)
This needed quite a bit of preparation work on the source as it made extensive use of the letter r in mathematical mode, see the warning above.
Note to the experts: the \fontdimen6 parameter is small and this impacts LaTeX in its use of the em dimension unit in certain macros, for example for typesetting tables of contents. So I had to modify the \DeclareFontFamily{T1}{frc}{} in order to increase by 50% the value of 1em and manage to get the table of contents right.

• Formule d'inversion de Lagrange (Latin Modern Typewriter Proportional)

• Exponentielle complexe et nombre Pi (Electrum)

• Gramiens et Inégalités. Uses Droid Serif for text and Droid Sans for math, with PX fonts for large mathematical symbols; this is done with the following in the preamble:
\usepackage[T1]{fontenc}
\usepackage{pxfonts}
\usepackage{droid}
\renewcommand{\familydefault}{\sfdefault} % <== Droid Sans for math
\usepackage[LGRgreek]{mathastext}         %
\renewcommand{\familydefault}{\rmdefault} % <== Droid Serif for text
\renewcommand{\bfseries}{\fontfamily{\sfdefault}% <== Droid Sans for section names etc...
\fontseries{\bfdefault}\selectfont}


• Gramiens et Inégalités. Same document as above, but with Libertine for text and Biolinum for Latin and Greek letters in math (large math symbols are from the TX fonts). The same set-up is used for this document.
\usepackage{txfonts}
\usepackage{libertine}
\usepackage[style=French,biolinum]{libgreek}
\renewcommand{\familydefault}{\sfdefault}
\usepackage[defaultmathsizes]{mathastext}
\renewcommand{\familydefault}{\rmdefault}
\renewcommand{\bfseries}{\fontfamily{\sfdefault}\fontseries{\bfdefault}\selectfont}

[2012/10/08: bizarrement, il y a des espaces -- cf «supposée» en page 2, ligne 7 par exemple -- avant ou après certaines lettres accentuées dans ces images produites par dvipng, mais par contre le pdf produit par dvipdfmx n'a pas ce problème]

• Gramiens et Inégalités. Same document but with the TX Typewriter font (and the TX fonts for math symbols and Greek). In order to allow hyphenation and variable interword spaces, a t1txvtt.fd file was prepared, which differs from the original t1txtt.fd in the following lines (naturally, all occurrences of "txtt" in the \DeclareFontShape declarations were replaced by "txvtt"):
\DeclareFontFamily{T1}{txvtt}{\hyphenchar\font=127%
\fontdimen2\font=0.33333\fontdimen6\font%
\fontdimen3\font=0.16666\fontdimen6\font%
\fontdimen4\font=0.11111\fontdimen6\font}

Then, the LaTeX source of the document contains:
\usepackage[T1]{fontenc}
\usepackage{txfonts}
\usepackage[upright]{txgreeks}
\renewcommand{\familydefault}{\ttdefault}
\renewcommand{\ttdefault}{txvtt}
\usepackage{mathastext}


Another document uses also this, and, additionally, a further math version based on the TX Times roman font, thus illustrating the capability of the package to manage multiple math versions.
• Un exposé assez complet sur les normes lp (Latin Modern Typewriter Proportional)
• Polynômes d'endomorphismes et applications (Latin Modern Typewriter Proportional)
• Corps de Galois. Polynômes cyclotomiques (New Century Schoolbook)

• Text 1:
• Text 2:

Various possibilities for the Greek letters

This section was written in March 2011, and I added a little to the discussion of the LGR encoded fonts for this current version of October 2012. The tables have been extended with the LGR encoded CM fonts, serif, sans and typewriter (part of the cbfonts).

The Greek letters can be either set up by other packages (such as eulervm, fourier, kpfonts, mathdesign, pxfonts, txfonts, ... in brief, any package setting up math fonts) or decided by an option passed to mathastext: LGRgreek, symbolgreek, eulergreek, selfGreek (the eleven uppercase Greek letters in OT1-encoding).

In the examples presented here, the Greek letters in math mode may be:

• from the text font itself in LGR encoding (LGRgreek package option): Latin Modern Typewriter, Droid Serif (first and second examples), Droid Sans (first and second examples), Comfortaa, GFS Bodoni, GFS Didot, GFS NeoHellenic, Epigrafica. Not illustrated with examples here, some other free font packages providing LGR encoded fonts: txfontsb, kerkis, dejavu, opensans. And the Latin Modern (lmodern), CM-LGC (cmlgc) and CM fonts have LGR encoded font files (for CM/LM these LGR fonts belong to the cbfonts distribution, the font definition files being distributed with the babel package).
• from the Linux-Libertine (or Biolinum) font with the help of the libgreek package by the author (used here only for the Libertine and Biolinum examples, but can be used with any other text font of course), [added note 2012/10: currently Libertine type 1 fonts for TeX/LaTeX with Greek letters are only in the libertine-legacy package on CTAN: there are no-Greek glyphs in the libertine-type1 or biolinum-type1 packages; fortunately libgreek will still work as long as the libertine-legacy package is installed on your system. The current CTAN libertine package loads libertine-type1 and/or biolinum-type1, which however do not contain fonts for Greek. But as long as libertine-legacy (which has been removed from TeXLive) is on your system, libgreek will work.]
• from the Fourier-GUTenberg fonts (this uses \usepackage{fourier} or \usepackage[upright]{fourier}),
• from the PX/TX fonts (this uses \usepackage{pxfonts} or \usepackage{txfonts}; and in the Antykwa Półtawskiego and Vollkorn cases use has been made of the author's txgreeks package to get the Greek letters from the TX fonts in upright shape),
• from the Symbol font (option symbolgreek),
• from the Euler font (option eulergreek),
• or finally from the Computer Modern fonts (the Electrum ADF example shows how to get them in upright shape with the help of the LGRgreek option; these LGR encoded "CM" fonts [displayed here in the two tables] are in fact part of the Claudio Beccari cbfonts.)

On each line lowercase and uppercase Greek letters are taken from the same font. But as TeX defaults to upright uppercase and italic lowercase, typically this will also be the default set-up when loading a package providing math fonts (for example \usepackage{fourier}), except of course for Euler and Symbol which do not exist in slanted shape. The author's packages libgreek, txgreeks, and pxgreeks facilitate the shape selection when using, respectively, Libertine/Biolinum or the TX/PX fonts.

• We only show the var' letters available in the default CM fonts (some of the fonts displayed have further var' letters).
• The glyphs \varrho and \varsigma are missing from Euler; and \varepsilon and \varrho are missing from Symbol.
• Depending on the font, \epsilon may be curly' and \varepsilon straight' or vice versa. And similarly for \phi vs \varphi.
• Not shown is the glyph for \omicron: the macro is not defined in default TeX (one is supposed to just type o) and additionally some math fonts providing upright Greek letters do not make provision for an upright \omicron (supposed to be taken from the Roman font via \mathrm{o}, I guess).
• When a text font is also available in LGR encoding it provides Greek letters (by definition! and of course this encoding is for typesetting the Modern and Ancient Greek languages, with many diacritics). But apart from the \varsigma this encoding does not give (I think) the `var' variants present in the default TeX font cmmi.

To conclude, a table with these fonts in Bold series (sometimes the bold series is like the medium series). The Libertine Bold Italic misses the Greek glyphs (this issue arose when the libertine package, now called libertine-legacy, entered into its version number 5; note that these tables use the font files for (pdf)latex of libertine-legacy, not the opentype font files now distributed with the package libertineotf). But the slanted shape glyphs do exist.

A PDF file including the above figures and text.