# Tag Info

68

(Please note that this answer has been revised to reflect issues raised in the comments.) unicode-math The unicode-math and mathspec packages have very different goals. The unicode-math package is designed to map math markup into unicode characters as supplied by real OpenType math fonts such as the Latin Modern Math, STIX, Asana Math. It also allows (as ...

50

mathspec is a clever attempt to make it possible to use math in XeLaTeX documents, with system fonts for the letters and symbols from standard math fonts. With unicode-math one can basically use only specially tailored OpenType math fonts such as Latin Modern Math, TeX Gyre Termes Math, TeX Gyre Pagella Math, XITS Math, Asana Math (among the free ones) or ...

30

unicode-math is mainly concerned about facilitating the use of using Unicode math fonts, namely OpenType math fonts in LaTeX. While mathspec is about allowing to take math alphabets from text fonts in the absence of matching math font. Unicode defines a large set of math symbols and many fonts include them, but proper math typesetting requires many font ...

11

mathfont and mathspec have similar purpose, but mathfont works not only with xelatex but also with lualatex. Both packages allow to change the font of various math symbols and math alphabets. Both packages have in my view the same deficiency: they care only about the look of the math and not about the mathematical meaning of the symbols. The difference ...

10

Yes. If you want to use mathspec, then at present you need to run XeLaTeX. (The mathspec package pre-dates wide availability of LuaTeX.) There are few technical reasons for this, but mathspec does use one primitive that would need to be emulated in LuaTeX before it could fully supported: \XeTeXglyphbounds — this is used in the \" and " definitions to ...

8

You can simply remove the option math when loading mathspec. MWE \documentclass[11pt]{article} \usepackage{mathspec} \setprimaryfont{Linux Libertine O} \begin{document} 1 $1$ $\mathrm{1}$ $\text{1}$ \end{document} Output Loading mathspec with the math option forces mathspec to load fontspec without the no-math option. And the fontspec manual states: ...

8

The right order to load those packages is amsthm, newtxmath, mathspec \usepackage{amsthm} \usepackage[libertine]{newtxmath} \usepackage{mathspec} You don't need to load amsmath since it is already loaded by newtxmath. That's also the reason why mathspec complains when you load newtxmath after it. Moreover, note that both amsthm and newtxmath define the \...

7

I'm not absolutely certain what you're asking, especially because your example is not compilable nor does it make a lot of sense. unicode-math doesn't work with mathspec or mathalfa. All those packages are mutually exclusive. That said, I think what you want to achieve can already be done in the default settings of unicode-math. \documentclass{article} \...

7

This is clearly due to the new LaTeX kernel using b as the default value for \bfseries. Probably fontspec should also define bx weight for compatibility, but in the meantime you can patch mathspec to use b instead of bx. \documentclass{article} \usepackage{mathspec} \usepackage{xpatch} \xpatchcmd{\setmathrm}{bx}{b}{}{} \xpatchcmd{\setmathrm}{bx}{b}{}{} \...

6

It's not impossible when you have established a math font which has the symbols you need. It's just time consuming. \documentclass[a4paper,twoside,12pt]{article} \usepackage{amsmath} \usepackage{mathspec} \setmainfont[Ligatures=TeX]{Linux Libertine O} \setsansfont[Ligatures=TeX]{Linux Biolinum O} \setmathsfont(Digits,Latin)[Uppercase=Regular,Lowercase=...

6

XeTeX fails to set the correct italic correction in math (http://tug.org/pipermail/xetex/2011-March/020318.html) when open type fonts are used. I would suggest to use the normal T1-encoded font for the letters_ \documentclass{beamer} \usepackage{fontspec} \AtBeginDocument{% \DeclareSymbolFont{pureletters}{T1}{lmss}{\mddefault}{it}% } \begin{document} ...

6

Like this? \documentclass{article} \usepackage{amsmath} \begin{document} \begin{align} y& =f\biggl( \sum_{i=1}^{N} w_ix_i+w_0\biggr), \\ U&=i \end{align} \end{document} P.S.: avoid $$$$...$$$$; use $$$...$$$ or $$...$$ instead.

6

You can add a declaration so that the text font knows bx too: \documentclass{article} \usepackage{mathspec} \setallmainfonts{Times New Roman} \DeclareFontShape{TU}{\familydefault}{bx}{n}{<-> ssub*\familydefault/b/n}{} \begin{document} $$\nabla \times \mathbf{B} = \mu_0 \mathbf{J}$$ \end{document} fontspec will ...

5

Here's a workaround with fontspec only. The trick is to define a new math symbol font for the lining figures. I wouldn't use detect-all: numbers in \SI or \num should always be typeset in math mode (hence with lining figures). \begin{filecontents}{test.bib} @Article{Hay2011, Title = {Can humans force a return to a Cretaceous' climate?}...

5

You're forgetting the proper mathspec way: \documentclass{article} \usepackage{amsmath} \usepackage{mathspec} \setmainfont{Gotham Book} \setmathrm{Gotham Book} \setmathfont(Digits,Latin){Gotham Book} \begin{document} \begin{align*} "f'(x) &= x^2 \\ f'(x) &= x^2 \\ f\,'(x) &= x^2 \end{align*} \end{document} With the italic font (that I managed ...

5

I'm not sure if this is accepted, but I'm going to answer my own question in case someone finds this page. It appears that minionpro (and myriadpro) DOES deal with math specific kerning and spacing. I used the FontPro scripts to convert the MinionPro opentype font included in Adobe CS to the Type1 format and install the 'minionpro' package (the script deals ...

5

The default beamer theme uses the sans serif font. So if you want to change the font in beamer you either have to set the sans font with \setsansfont or change to the serif font theme \usefonttheme{serif}. fontspec usually does a very good job setting the font features automatically, if you load them by font name. So in case of the Alegreya font it should ...

5

I don't have Arno Pro available, so I used the free Crimson instead. \documentclass{article} \usepackage{blindtext} \usepackage{unicode-math} \setmainfont{Crimson} % Set baseline math font (Crimson goes well with Pagella) \setmathfont{TeX Gyre Pagella Math} % Get alphabets from text font \setmathfont[range={up}]{Crimson-Roman.otf} \setmathfont[range={it}]{...

5

Iteration 1 \documentclass[10pt]{article} \usepackage[MnSymbol]{mathspec} % Includes amsmath. \setmathsfont(Digits,Latin,Greek,Symbols)[Numbers={Lining,Proportional}]{Calibri} \setmainfont[Mapping=tex-text, Ligatures={NoRequired,NoCommon,NoContextual}]{Calibri} \usepackage[italic]{mathastext} \begin{document} ABCDEFGHIJKLMNOPQRSTUVWXYZ \begin{align} ...

5

As @Mico and @oliversm pointed out, there are two basic ways to do this. Solution 1: using the cases package \documentclass{article} \usepackage{cases} \begin{document} \begin{numcases}{f(x)=} x, & $$x \geq 0$$ \nonumber \\ 0, & $$x < 0$$ \nonumber \end{numcases} \end{document} Solution 2: using the cases environment of the amsmath ...

5

(Tom from Overleaf Support here.) The advice on how to disable the code check for a part of the document is given in: https://www.overleaf.com/learn/how-to/Code_Check#Disabling_Code_Check_for_part_of_a_file You can use %%begin novalidate and %%end novalidate to mark the part not to be code checked. \documentclass{...} % Here is the preamble blablabla %%...

4

It's a well known problem with mathspec; you have to precede the letter with " in order that superscripts are better placed: \documentclass{article} \usepackage{amsmath} \usepackage{sfmath} \usepackage{mathspec} %\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase} \setmainfont{Universalis ADF Std} \setmathfont{XITS Math} \setmathsfont(Digits,Latin){...

4

Redefine \% to do the right thing: \documentclass[a4paper]{scrartcl} \usepackage[]{mathspec} \setmainfont[Numbers=OldStyle,BoldFont={Fira Sans SemiBold}]{Fira Sans Book} \setsansfont[Numbers=OldStyle,BoldFont={Fira Sans SemiBold}]{Fira Sans Book} \setmonofont{Fira Mono} \setmathsfont(Digits,Latin,Greek){Fira Sans Book} \setmathsf[]{Fira Sans Book} \...

4

url uses math to typeset the url and as mathspec changes mathcodes you get the wrong font. You could reset them: \documentclass[12pt,a4paper]{article} \usepackage[hidelinks]{hyperref} \usepackage{mathspec} \setallmainfonts{Times New Roman} \setallmonofonts{Courier New} \makeatletter \def\Url@FormatString{% \UrlFont \Url@MathSetup \mathcode"30=28720 %0 \...

4

This here should work. \documentclass{article} \usepackage{mathspec} \usepackage{icomma} \usepackage[locale=DE]{siunitx} \setmainfont{DejaVu Serif} \setmathsfont(Digits,Latin,Greek){DejaVu Serif} \makeatletter \DeclareMathSymbol{,}{\mathpunct}{\eu@DigitsArabic@symfont}{,} \makeatother \begin{document} 1,5 $$1,5$$ $$\num{1,5}$$ $$1, 5$$ %larger ...

4

\documentclass{article} \usepackage{mathspec} \usepackage{textcomp} \usepackage{siunitx} \sisetup{math-degree=\mbox{\textdegree},text-degree=\textdegree} \sisetup{math-celsius=\mbox{\textdegree}C,text-celsius=\textdegree C} \begin{document} \ang{30}, \SI{20}{\celsius} \end{document}

4

You can use the right Unicode character: \documentclass{article} \usepackage{amsmath} \usepackage{mathspec} \usepackage{siunitx} \sisetup{ text-degree=°, math-degree=\textup{°}, text-celsius=℃, math-celsius=\textup{℃}, } \begin{document} \ang{30}, \SI{20}{\celsius} \end{document}

Only top voted, non community-wiki answers of a minimum length are eligible