I am trying to figure out how to have fine grain control over typesetting my documents. I have been looking at this pdf but I can't seem to figure out how to set symbols such as '(), +, -, =,...' to become slightly heavier than the rest of the math. Is this possible? I also know that unicode math breaks a lot of options with other packages but I use it to achieve a different typeface for the latin and greek characters. I am open to the possibility of removing the dependency on unicode if I can achieve the same thing without it but I would prefer a solution that keeps this package in mind.
There are two issues here: the first is finding a font that actually contains the glyphs you want, and the second is getting them to appear where you want them.
Here are the currently available OpenType math fonts that offer multiple weights:
- Lucida Bright Math offers Regular and Demibold
- Minion Math offers Regular, Medium, Semibold, and Bold (each in five optical sizes)
- XITS Math offers Regular and Bold
So let's say you're using Minion Math Regular as your main math font, and have decided that Minion Math Semibold is "slightly" bolder in just the way you like (lighter than the bold math version, I presume?). Then, if you want a given symbol to appear semibold throughout your document, you can use the range
key of \setmathfont
in your preamble, for example as follows:
% Ignoring optical sizes
\setmathfont{MinionMath-Regular.otf}
\setmathfont[
range = { "002B,"2212,"003C,"003E,"003D,"007B,"007D,"007C,"0028,"0029 } % +-<>={}|()
]{MinionMath-Semibold.otf}
You can find codes for additional Unicode slots or ranges in unimath-symbols.pdf
.
If you want to apply the effect only to some parts of the document, you will have to remap the characters every time. You could do something like this:
\documentclass{article}
\usepackage{unicode-math}
\setmathfont{MinionMath-Regular.otf}
\NewDocumentCommand\applysemi{}{%
\setmathfont[
range = { "002B,"2212,"003C,"003E,"003D,"007B,"007D,"007C,"0028,"0029 }
]{MinionMath-Semibold.otf}%
}
\NewDocumentCommand\removesemi{}{%
\setmathfont[
range = { "002B,"2212,"003C,"003E,"003D,"007B,"007D,"007C,"0028,"0029 }
]{MinionMath-Regular.otf}%
}
\begin{document}
$ a + ( b - c ) = x $
\applysemi
$ a + ( b - c ) = x $
\removesemi
$ a + ( b - c ) = x $
\end{document}
If you are using XeLaTeX, you could also use the FakeBold
key to distort the appearance of a font that lacks a given designed weight, as described in the fontspec
documentation, section 9.3. E.g. for Cambria Math you could do
\setmathfont[
range = { "002B,"2212,"003C,"003E,"003D,"007B,"007D,"007C,"0028,"0029 } ,
FakeBold = 2
]{Cambria Math}
However, this is not really recommendable: the result cannot match a properly designed font aesthetically.
The ultimate answer to your question is: When you are not satisfied with the look of the available fonts, design your own! But font design is hard and tedious work, you probably don't have the time needed left given your other duties in life.
There is a shortcut: When you want to mix characters from different fonts, you can create a virtual font and use that. For hints on how to do this, see this question: How to create a virtual font?
-
Very interesting. Did not know you can do that. Than you for the advice. – arynhard Feb 19 '15 at 15:38
fontspec
. Much of the information in the manual you pointed to will be irrelevant if you are usingunicode-math
. [Not all of it, but much of it.] – cfr Feb 18 '15 at 1:51mathspec
orfontspec
with it no? – arynhard Feb 18 '15 at 2:00unicode-math
loadsfontspec
. You should not usemathspec
, indeed. But you cannot help but usefontspec
. – cfr Feb 18 '15 at 2:08