# Replace Glyph with Another Glyph (Adobe Garamond Pro Dot Operator)

Adobe Garamond Pro does not include U+22C5, the dot operator, as shown here on the Y axis multiplier:

Is there any way to replace just instances of the dot operator with another glyph, such as bulletoperator (U+2219)? I know this is not strictly correct, but I am not writing for an audience who would care.

I have consulted other sources, such as here, but I am unsure how to apply it to this specific problem. If that is the solution, I am unsure how to reference the dot operator and bullet operator in the example solution provided in that question:

\catcode\Ё=\active
\defЁ{E}


MWE (with xelatex): (This requires you to have Adobe Garamond Pro installed)

\documentclass{standalone}
\usepackage{pgfplots}
\usepackage{fontspec}
\usepackage{unicode-math}

\begin{document}
\pgfmathdeclarefunction{gauss}{2}{%
\pgfmathparse{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))}
}
\begin{tikzpicture}
\begin{axis}[every axis plot post/.append style={
mark=none,domain=0:220,samples=50,smooth},
axis x line*=bottom,
axis y line*=left,
enlargelimits=upper,
xlabel={x},
ylabel={y},
]
\end{axis}
\end{tikzpicture}

\end{document}


Yes, you can do this with the [range=...] option of \setmathfont. You have several options:

## Use Garamond-Math

Setting a text font as your math font will not work well. Even if it does have all the glyphs you want, it will not have a math table, so all the spacings will be wrong. This is why math fonts for STIX, Libertinus, DejaVu and Latin Modern exist, even though the text fonts contain the same glyphs.

I’ve updated this MWE to use the free EB Garamond font rather than Garamond Pro, but substituting Garamond Pro should still work.

You aren't limited to loading one math font as a package deal. With range=, you can load alphabets or individual symbols from any math font of your choice. If you do this, set \defaultfontfeatures{ Scale = MatchUppercase } to scale all fonts in the document to the same height, but load your main font with Scale = 1.0 to avoid rescaling that.

Here, you give a great use case: you want the digits of your math font to be old-style and tabular. This example first loads Garamond-Math as the math font, then overwrites its numerals with EB Garamond, selecting those OpenType features. (It also sets the version designed for smaller sizes for superscripts and subscripts.)

\documentclass[varwidth, preview]{standalone}
\usepackage{pgfplots}
\usepackage{fontspec}
\usepackage{unicode-math}

\pgfplotsset{compat = 1.16}

\defaultfontfeatures{ Scale = MatchLowercase }
\setmainfont{EB Garamond}[
Scale = 1.0 ,
Ligatures = { Common, Discretionary, TeX } ,
Numbers={OldStyle, Proportional} ]
\setmathfont[StylisticSet=1]{Garamond-Math}
\setmathfont[range = up/num,
Numbers={OldStyle, Monospaced} ,
script-font = {EBGaramond08-Regular.otf}
]{EBGaramond12-Regular}

\begin{document}
\pgfmathdeclarefunction{gauss}{2}{%
\pgfmathparse{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))}
}
\begin{tikzpicture}
\begin{axis}[every axis plot post/.append style={
mark=none,domain=0:220,samples=50,smooth},
axis x line*=bottom,
axis y line*=left,
enlargelimits=upper,
xlabel={x},
ylabel={y},
]
\end{axis}
\end{tikzpicture}

\end{document}


On some systems, you might need to change the command redefining numerals in the math font to something like:

\setmathfont[range = up/num,
Numbers={OldStyle, Monospaced} ,
script-font = {[EBGaramond08-Regular]}
]{[EBGaramond12-Regular]}


But you will be changing this to Adobe Garamond Pro regardless.

Although Garamond-Math obviates the need to redefine the dot operator, there are at least thirteen middle dots defined in Unicode, of which \smblkcircle is supposed to be the “bullet operator.” You could add the line:

\setmathfont[range={\cdot,\smblkcircle}]{STIX Two Math}


The package also supports range="22C5.

## Change Only the Letters

Instead of changing that one symbol, you could load a compatible math font and then change the letters and digits to the same as your text font.

\defaultfontfeatures{ Scale = MatchLowercase }
\setmainfont{EB Garamond}[
Scale = 1.0 ,
Ligatures = { Common, Discretionary, TeX } ,
Numbers={OldStyle, Proportional} ]
\setmathfont{STIX Two Math}
\setmathfont[range = up,
Numbers={OldStyle, Monospaced} ,
script-font = {EBGaramond08-Regular.otf}
]{EBGaramond12-Regular}
\setmathfont[range = it,
script-font = {EBGaramond08-Italic.otf}
]{EBGaramond12-Italic}


If you need bold and bold italic letters (e.g. for vectors), they don’t come with TeX Live 2019, but you can download a version here. They would have range bfup and bfit. If you need sans-serif letters, Inconsolata is a good match.

## Alternatives

You can combine the letters and numerals of your OpenType text font with a legacy NFSS math font using either mathspec (on XeTeX) or mathastext. There is also a legacy ebgaramond-maths package.

• A really great and comprehensive answer. Thanks! – Craig Jan 27 at 7:09

You should better not use a text font as math font - it misses important tables and glyphs. Better use a real math font and use the range option to change the letters and the number. I don't have your font so here with arial instead:

\documentclass{standalone}
\usepackage{pgfplots}
\usepackage{fontspec}
\usepackage{unicode-math}

\setmainfont[Ligatures=TeX,Numbers={OldStyle,Proportional}]{Arial}
\setmathfont{Latin Modern Math}
\setmathfont[range=up/{num}]{Arial}
\setmathfont[range=\int]{Latin Modern Math}
\begin{document}
\pgfmathdeclarefunction{gauss}{2}{%
\pgfmathparse{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))}
}
\begin{tikzpicture}
\begin{axis}[every axis plot post/.append style={
mark=none,domain=0:220,samples=50,smooth},
axis x line*=bottom,
axis y line*=left,
enlargelimits=upper,
xlabel={x},
ylabel={y},
]
`