# Possible to use MnSymbol with LuaTex?

I want to use the Minion Pro font together with math symbols from MnSymbol (http://www.ctan.org/tex-archive/fonts/mnsymbol). Is this possible? It has already been discussed here -> http://www.latex-community.org/forum/viewtopic.php?f=48&t=16231. No solution has been found but this was over 2 years ago.

If I understand it correct unicode-math can directly use OTF fonts. I am wondering why this doesn't work for MnSymbol. At http://www.ctan.org/tex-archive/fonts/mnsymbol/otf you find OTF files but I don't know how to deal with them. Is it possible to convert them? Ideas?

Here an example. I don't have Minion Pro installed as a system font so you probably have to adjust the paths. The example works but I want the "functionality" of something like "\setmathfont{MnSymbol.otf}".

% !TEX TS-program = lualatex
\documentclass{article}
\usepackage{fontspec}
\usepackage{unicode-math}
\setmainfont[
BoldFont       = MinionPro-Bold,
BoldItalicFont = MinionPro-BoldIt,
Extension      = .otf,
ItalicFont     = MinionPro-It,
Ligatures      = TeX,
Path           = ../Font/MinionPro/
]{MinionPro-Regular}
\setmathfont{latinmodern-math.otf} % <-- here I want to use MnSymbol
\setmathfont[range=\mathup/{num,latin,Latin,greek,Greek}, Path = ../Font/MinionPro/]{MinionPro-Regular}
\setmathfont[range=\mathbfup/{num,latin,Latin,greek,Greek}, Path = ../Font/MinionPro/]{MinionPro-Bold}
\setmathfont[range=\mathit/{num,latin,Latin,greek,Greek}, Path = ../Font/MinionPro/]{MinionPro-It}
\setmathfont[range=\mathbfit/{num,latin,Latin,greek,Greek}, Path = ../Font/MinionPro/]{MinionPro-BoldIt}
\begin{document}
$\forall x$
\end{document}

• Just for the sake of completeness: The issue was also discussed here. Unfortunately the "solution" is also rather a work-around, at least the OP was satisfied. If I understand the correctly, the idea is simply to replace the main math font by a font which better fits to MinionPro. – bluenote10 Mar 17 '14 at 17:02
• Well, not a solution, but I'm using MinionPro+MnSynbol exactly as in pdfTeX (almost, because I'm using luainputenc). Currently I'm using LuaTeX on a regular basis, even if I don't need Unicode fonts. – Javier Bezos Mar 17 '14 at 19:33

Note that this explanation is actually a guess. I do not know enough about how these things work to be sure. Caveat emptor.

It would be great to have a real solution to this problem.

A real solution requires extending the opentype versions of MnSymbol quite significantly, I think. (I explain why below - I don't mean that the coverage is insufficient.)

In theory the mentioned OpenType version of MnSymbol should allow a proper solution, right?

No. This is not correct.

Furthermore, an explanation why setting up MinionPro+MnSymbol is not straightforward in the first place would be great. After all, MinionPro+MnSymbol is possible in plain pdflatex, and it would be somewhat disappointing if it does not work in lualatex, which is supposed to improve working with fonts.

It is unfortunately more complicated even in the case of text. It is several times of magnitude more complex again in the case of maths. I begin with the text case because it is simpler.

# Text

What XeTeX and LuaTeX do is enable you to access all of the bells and whistles featured in sophisticated opentype fonts. This is fantastic in terms of providing access to 'regular' fonts. Suddenly, you do not need any special support package to write your text - or maths - using the same fonts used by any other application on your system.

The downside of this is that the opentype fonts need the bells and whistles. For example:

otfinfo -f fonts/opentype/public/lm/lmroman10-regular.otf aalt Access All Alternates cpsp Capital Spacing dlig Discretionary Ligatures frac Fractions kern Kerning liga Standard Ligatures lnum Lining Figures onum Oldstyle Figures pnum Proportional Figures size Optical Size tnum Tabular Figures zero Slashed Zero  So opentype will allow you to access the oldstyle figures, say, via the onum feature of the font. What does this mean? It means that the font has the relevant characters, of course. That is, it has to actually include 0, 1, 2 etc. oldstyle figures. But it also needs to do something else as this screenshot from fontforge shows: If the font contained the characters but not the mappings needed for the font feature onum, we'd be stuck. In contrast, (pdf)TeX cannot use fonts without specialised support files. This of course limits the fonts you may use. Even if you know how to prepare such files yourself, it is time-consuming and fiddly to do so. On the other hand, the information the fonts themselves need to provide is relatively minimal. Essentially, they need to provide the glyphs (the pictures of each character), some basic information about each character (width, height etc.) and, ideally, kerning information (which says how the spacing should be adjusted when particular pairs of characters occur), and some general information about the font itself (name, encoding, x-height etc.). If some of this information is wrong, you can actually compensate for it in preparing the support files. For example, you can tell TeX that the character in slot 83 is a comma even if the font itself claims it is the capital A. That's more work, but it is doable. Furthermore, any bells and whistles get specified in the support files. For example, suppose that you want to enable e.swash as an end-of-word swash character. In an opentype font, you must hope that the font specifies this as part of a font feature which can be accessed straightforwardly via Xe/LuaTeX. In (pdf)TeX, you don't have to hope - there's no point. This can't be specified in type1 fonts and (pdf)TeX couldn't use that information anyway. Instead, the support files must provide TeX with this information. So whoever writes those files specifies the relevant relationships. So the onus in the case of Xe/LuaTeX and opentype fonts (absent special work arounds etc.) is very much on the font features being configured correctly. Xe/LuaTeX provide a general interface to any font, provided that font has the relevant features. The onus in the case of (pdf)TeX with type1 (or truetype for pdfTeX) fonts is to a much larger extent on the font features being configured in the TeX support files. This is why it can make sense, for example, to write a package such as cfr-lm which provides access to exactly the same type1 fonts as lmodern. cfr-lm provides access to features of the fonts not supported by lmodern (which is why I wrote it). So whether or not LuaTeX or XeTeX provide improved access depends very much on the font in question. In the case of a font with no TeX support files or no type1/truetype format, any access is obviously an improvement. In the case of fonts with sophisticated TeX support packages, Lua/XeTeX may or may not provide improved access, depending on • the features of the opentype fonts involved • any general limitations in the support TeX can provide relevant to the specific type1/truetype fonts involved • e.g. features requiring more than 256 characters in a single font • any specific limitations in the support files actually available for the specific type1/truetype fonts involved • e.g. lmodern does not provide access to oldstyle, proportional figures for use as default in text even though this access can be provided as cfr-lm demonstrates. # Maths Mathematics is more complex. (pdf)TeX requires specially designed fonts plus specialised support files in order to typeset maths correctly. Unlike the text case, you cannot get very far trying to create support files for arbitrary fonts. As far as the fonts themselves are concerned, the issue here is primarily to do with coverage - you need various symbols and they need to fit together for the whole thing to work. Generally, only fonts designed for TeX have these. Xe/LuaTeX similarly requires coverage i.e. the needed characters must be there. However, just as something more was required in the text case in the form of the relevant font features (e.g. onum), something more is required in the case of maths as well. As I understand it, unicode-math provides access to the mathematical extension of the opentype specification developed by Microsoft for Office 2007. This essentially defines something a little like opentype features for text but for maths. Merely having a font with the requisite characters in opentype format is not sufficient. The font also needs to implement the relevant parts of the maths extension. To see the problem, consider the following screenshots from fontforge. These were taken using Element > Other Info > Math Info > Exten Shapes. The first shows part of this table for Latin Modern Math: The second is the table for MnSymbol at 10pt: Similar comparisons can be done for other aspects of the maths configuration of these fonts. # Conclusion In conclusion, MinionPro + MnSymbol is better supported by (pdf)TeX than it can be by unicode-math. To work straightforwardly with Xe/LuaTeX and unicode-math, the opentype versions of MnSymbol would need to be extended to support the relevant parts of the opentype maths extension. # Postscript It turns out that there is a further problem with the opentype version of MnSymbol in combination with LuaTeX which has nothing to do with its lack of support for maths. This is actually why LuaLaTeX fails with a fatal error rather than just producing a crappy-looking PDF. The following MWE can be used to reproduce the error: \documentclass{article} \usepackage{fontspec} \newfontfamily \mymnsymbolfont {MnSymbol10.otf} \begin{document} \mymnsymbolfont + \end{document}  LuaLaTeX fails with a fatal error. XeLaTeX compiles the document fine. I am not sure whether this is a bug in LuaLaTeX or MnSymbol or both. The analogous document using MdSymbol works OK with both engines. ## Seeing the effect of using an opentype font without support for maths To see why an opentype font which does not support the maths extension cannot be used straightforwardly, I therefore use MdSymbol with MinionPro. The following example compares this combination with Latin Modern with Latin Modern Math, which is default. \documentclass{article} \usepackage{amsmath} \usepackage{unicode-math} \begin{document} \section*{Latin Modern with Latin Modern Math} \begin{align*} p(A_j/B) &= \frac{p(B/A_j) p(A_j)}{p(B)}\\ &= \frac{p(B/A) p(A)}{\sum_{i=1}^{n} p(B/A_i) p(A_i)}\\ \end{align*} $v( A_i ) = \sum_{j=1}^\mathrm{n} v(A_i | B_j) \times p(B_j)$ \begin{gather*} \max_{i=1,2} v(A_i|B_j) \neq \min_{i=1,2} v(A_i|B_j)\quad j=1,2\\ \text{but}\; \bigl(\max_{i=1,2} v(A_i|B_2) - \min_{i=1,2} v(A_i|B_2)\bigr) > \bigl(\max_{i=1,2} v(A_i|B_1) - \min_{i=1,2} v(A_i|B_1)\bigr) \end{gather*} \setmainfont[ Ligatures = TeX, ]{Minion Pro} \setmathfont{MdSymbol} \setmathfont[range=\mathup/{num,latin,Latin,greek,Greek}]{MinionPro-Regular} \setmathfont[range=\mathbfup/{num,latin,Latin,greek,Greek}]{MinionPro-Bold} \setmathfont[range=\mathit/{num,latin,Latin,greek,Greek}]{MinionPro-It} \setmathfont[range=\mathbfit/{num,latin,Latin,greek,Greek}]{MinionPro-BoldIt} \section*{Minion Pro with MdSymbol} \begin{align*} p(A_j/B) &= \frac{p(B/A_j) p(A_j)}{p(B)}\\ &= \frac{p(B/A) p(A)}{\sum_{i=1}^{n} p(B/A_i) p(A_i)}\\ \end{align*} $v( A_i ) = \sum_{j=1}^\mathrm{n} v(A_i | B_j) \times p(B_j)$ \begin{gather*} \max_{i=1,2} v(A_i|B_j) \neq \min_{i=1,2} v(A_i|B_j)\quad j=1,2\\ \text{but}\; \bigl(\max_{i=1,2} v(A_i|B_2) - \min_{i=1,2} v(A_i|B_2)\bigr) > \bigl(\max_{i=1,2} v(A_i|B_1) - \min_{i=1,2} v(A_i|B_1)\bigr) \end{gather*} \end{document}  • good commentary, but one picture says it all -- the math table shown for MnSymbol. we need two resources, really -- good documentation for what's in the otf math table, and some very dedicated font experts willing to create such tables for the relevant fonts. – barbara beeton Mar 18 '14 at 14:45 • @barbarabeeton Indeed, I tried to look into these issues using fontforge, but as I completely lack knowledge about such font stuff and as there was nothing (I found) around explaining it, I couldn't achieve nothing. Interesting sidenote: MdSymbol (for use with MyriadPro) seems to work without problems in LuaTeX. – John Mar 18 '14 at 20:26 • @John MdSymbol does not work in LuaTeX with the equivalent invocation i.e. \setmathfont{MdSymbol-Regular.otf} for, I assume, just the same reasons as MnSymbol fails. It just doesn't fail as spectacularly. That is, it compiles a pdf without error. So instead of no pdf, you get a pdf containing a complete mess. (Missing symbols, incorrect sizes of symbols, incorrect spacing.) – cfr Mar 18 '14 at 22:32 • @cfr Works for me: See edit of my answer above – John Mar 19 '14 at 17:30 • @john See also my comments. It does not work. It just doesn't fail spectacularly. – cfr Mar 20 '14 at 2:55 I only found one approach for LuaLaTeX, which is very messy, but works: 1. Don't load unicode-math 2. After loading amsmath and amsthm, load fontspec. 3. After \setmainfont{} etc. write \usepackage[retainmissing,abx]{MnSymbol} 4. If you want to write e.g. \sum 3x$, you have to write $\sum \text{3}\textit{x}$, so that's the ugly part (I'm pretty sure this can be avoided, but I lack the needed knowledge :/ ) I hope it helps nonetheless and I would also be very interested in a "clean" solution EDIT: Using MdSymbol (for MyriadPro) seems quite good: \documentclass[tikz,border=0.125cm]{standalone} \usepackage{fontspec} \usepackage{unicode-math} \setmathfont{MdSymbol-Regular.otf} \setmathfont[range=\mathup/{num,latin,Latin,greek,Greek}]{Minion Pro} \setmathfont[range=\mathbfup/{num,latin,Latin,greek,Greek}]{MinionPro-Bold} \setmathfont[range=\mathit/{num,latin,Latin,greek,Greek}]{MinionPro-It} \setmathfont[range=\mathbfit/{num,latin,Latin,greek,Greek}]{MinionPro-BoldIt} \setmathfont[range=\mathscr,StylisticSet={1}]{MinionPro-It} \begin{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% $$% \sum\int a\otimes b \vec{c} \label{eq:test}%$$% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \end{document}  • Welcome to TeX.SX! Markup-tip: backticks () are used to indicate inline code, as you see in my edit. – Torbjørn T. Feb 7 '14 at 13:50 • Seems there is no clean solution? – John Feb 14 '14 at 14:13 • Have you tried MdSymbol with more complex mathematics? For example, try it with an example in which different sizes of delimiter are required or in which a large, display-size symbol is required. Or in which more complex spacing requirements are involved. Your example only works because none of those features are required. – cfr Mar 19 '14 at 18:53 • You are right, though one can use \bigl( and \bigr) to get at least another size for delimiters. Strangely \big\int leads to a big integral, while throwing out an error. I still suspct MdSymbol is much closer to usability than MnSymbol. – John Mar 19 '14 at 19:21 • @John I agree that MdSymbol is closer to usability. However, I am not sure it has anything to do with its support for mathematics. The opentype versions of MnSymbol seem to be buggy qua fonts - independently of any support for maths. For example MnSymbol10.otf fails fontlint whereas MdSymbol-Regular.otf passes. And the fatal error involves a complaint about an invalid character in the font or file. Neither font supports mathematics but MdSymbol seems perfectly OK as a font, while MnSymbol is just buggy regardless. – cfr Mar 19 '14 at 22:41 You should think about bying the MinionMath, which is not really expensive! \documentclass{article} \usepackage{unicode-math} \setmainfont[ BoldFont = MinionPro-Bold, BoldItalicFont = MinionPro-BoldIt, ItalicFont = MinionPro-It, Ligatures = TeX, ]{MinionPro-Regular} \setmathfont{MinionMath-Regular} \begin{document}$\forall x$\end{document}  voss@shania:~/tmp> pdffonts test.pdf name type encoding emb sub uni object ID --------------------------- ------------ ----------- --- --- --- --------- WCXZLN+MinionMath-Regular CID Type 0C Identity-H yes yes yes 4 0 BXDYTB+MinionPro-Regular CID Type 0C Identity-H yes yes yes 5 0 ` • I don't think that 699.72 € (full set) or 218.96 € (basic set) qualify for “not really expensive”. Compare to the$140 asked for Lucida (full set, individual license). – egreg Feb 5 '14 at 12:02
• @egreg, you are comparing apples and oranges. The basic set still contains more weights and optical sizes than Lucida, and a ton more symbols. But you don't even need that. Most users can live by just buying the bold and regular weights in the normal optical size. That will cost you 2 * € 68, which is very affordable. – Ingo Feb 12 '14 at 11:09
• @Ingo At the “Pricing” page I see (VAT included) 162 €, which in my opinion doesn't qualify for very affordable. – egreg Feb 12 '14 at 11:16
• It's just a matter of opinion. No need for further discussions. – Ingo Feb 12 '14 at 16:58
• How does Lualatex+MinionPro+MinionMath compare to not using Lualatex at all, i.e., pdflatex+MinionPro+MnSymbol? In other words: Why would anyone want to spend so much money if one can get almost the same (?) for free? After all, the main motivation for most people to use Lualatex is to make "working with fonts easier", isn't it? – bluenote10 Mar 19 '14 at 8:51