Skip to content
This repository has been archived by the owner on Aug 23, 2021. It is now read-only.

italic bold math font #46

Closed
ptoche opened this issue May 21, 2016 · 6 comments
Closed

italic bold math font #46

ptoche opened this issue May 21, 2016 · 6 comments

Comments

@ptoche
Copy link

ptoche commented May 21, 2016

As far as I understand there is currently no italic bold math font. Is that something that could be developed? The use case is some matrix notation (ISO/IEC convention). Or is there a workaround?

@khaledhosny
Copy link
Member

khaledhosny commented May 21, 2016

There is serif italic bold math alphabet, but no sans-serif italic bold one. There are italic bold math alphabets, both serif and sans serif, what makes you think otherwise?

@ptoche
Copy link
Author

ptoche commented May 22, 2016

Thanks for your help Khaled. I know nothing about fonts and I'm probably misunderstanding things. Apologies! Clarification: I was referring to a xits-math bold+italic font. So here was my reasoning.

First, I noticed that in http://tex.stackexchange.com/questions/43642 or more recently http://tex.stackexchange.com/questions/296603, you and other font experts only ever write

\setmathfont
[    Extension = .otf,
      BoldFont = *bold,
]{xits-math}

with no reference to bold italic math fonts. So that was my first clue. When I added the line

BoldItalicFont = *-bolditalic,

to the above, I received an error message 'fontspec error: "font-not-found". Second clue.

When I looked inside the font .otf files, I didn't see a bold-italic-math font. Third clue.

And when I tried to insert this in the preamble:

\DeclareMathAlphabet{\mathbit}{OML}{cmm}{b}{it}

which is something I read here (http://tex.stackexchange.com/questions/14395/bold-italic-vectors) about how to emulate a bold italic font, the outcome was very ugly. That was my fourth clue. But perhaps I just don't know how to set it up properly?

Below a MWE used for my experiments:

\documentclass{article}
\usepackage[bold-style=ISO]{unicode-math}
%\usepackage[bold-style=TEX]{unicode-math}
\setmainfont
[    Extension = .otf,
   UprightFont = *-regular,
      BoldFont = *-bold,
    ItalicFont = *-italic,
BoldItalicFont = *-bolditalic,
]{xits}
\setmathfont
[    Extension = .otf,
      BoldFont = *bold,
]{xits-math}
\DeclareMathAlphabet{\mathbit}{OML}{cmm}{b}{it}
\begin{document}
\begin{itemize}
\item
mainfont:
\[x(t)=\int_{-B}^B X(f)e^{j2\pi ft} df\] 
\item 
boldmath: 
{\boldmath
\[ x(t)=\int_{-B}^B X(f)e^{j2\pi ft} df\]
}
\item 
mathbf: 
\[\mathbf{x(t)=\int_{-B}^B X(f)e^{j2\pi ft} df}\] 
\item 
mathbit: 
\[\mathbit{x(t)=\int_{-B}^B X(f)e^{j2\pi ft} df}\] 
\end{itemize}    
\end{document}

@khaledhosny
Copy link
Member

khaledhosny commented May 22, 2016

The way OpenType math fonts is structured is different than traditional TeX fonts. All math alphabets are included in a single font file, so If you installed XITS Math in the system font directories (the recommended way), then all you need is \setmathfont{XITS Math}. The invocation you use is for loading the fonts by file name and in this case you need to load the bold font manually, however this bold font is not for bold math alphabets but for \boldmath, \boldsymbol and similar commands that expects a math font where everything is bold.

The \DeclareMathAlphabet is definitely wrong, you are trying to load the Computer Modern Math (cmm) bold italic font, you should drop it. \mathbf and \mathbi used to work with uncode-math out of box, but it seems that for some LaTeX people compatibility with crippled 8-bit TeX engines is more important than a system that works in the 21 century, so that was dropped and you now have to use \symbf and \symbfit instead, please refer to unicode-math documentation (hopefully it was updated, I didn’t check).

So your document should look like:

\documentclass{article}
\usepackage[bold-style=ISO]{unicode-math}
%\usepackage[bold-style=TEX]{unicode-math}
\setmainfont
[    Extension = .otf,
   UprightFont = *-regular,
      BoldFont = *-bold,
    ItalicFont = *-italic,
BoldItalicFont = *-bolditalic,
]{xits}
\setmathfont
[    Extension = .otf,
      BoldFont = *bold,
]{xits-math}
\begin{document}
\begin{itemize}
\item
mainfont:
\[x(t)=\int_{-B}^B X(f)e^{j2\pi ft} df\] 
\item 
boldmath: 
{\boldmath
\[ x(t)=\int_{-B}^B X(f)e^{j2\pi ft} df\]
}
\item 
mathbf: 
\[\symbf{x(t)=\int_{-B}^B X(f)e^{j2\pi ft} df}\] 
\item 
mathbit: 
\[\symbfit{x(t)=\int_{-B}^B X(f)e^{j2\pi ft} df}\] 
\end{itemize}    
\end{document}

@ptoche
Copy link
Author

ptoche commented May 23, 2016

Thanks Khaled! Your explanation clarifies a lot of things for me. I noticed \setmainfont{XITS} is throwing errors, so I'm going to look into my setup again.

I'm not seeing a big difference between \symbf and \symbfit and no difference at all between \symbf{A} and \symbfit{A}. See screenshot here: http://s33.postimg.org/gt176cu6n/tmp.png
Should there not be a difference ?

@khaledhosny
Copy link
Member

They are different in the font. You probably need to ask in unicode-math tracker, or some general TeX questions site like http://tex.stackexchange.com/.

@ptoche
Copy link
Author

ptoche commented May 23, 2016

Will do, thanks Khaled!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants