1

I had some code in which I couldn't manage to get \approx in the bold font I specified, using a math font gets me the bold \approx, but now I lose \star (and probably other symbols) entirely...

Isn't there a way where I can have all symbols show up and in the correct font I specify?

Here is a MWE:

\documentclass{article}

\usepackage[quiet]{fontspec}

\defaultfontfeatures{Mapping=tex-text}
\setmainfont[Mapping=tex-text]{Arial}

\newfontfamily\headingfont[]{Impact}
\renewcommand{\bfseries}{\headingfont}

\usepackage[math-style=TeX,vargreek-shape=unicode]{unicode-math}
\setmathfont{XITS Math}
%http://tex.stackexchange.com/questions/43642/xits-font-not-found
%\setmathfont{xits-math.otf} %if run with XeLaTeX


\begin{document}
    I managed to show the \textbf{symbol \approx\ in its bold font}, instead of \approx\\
    But now I cannot insert the symbol \star\ for some reason...
\end{document}

Which produces: mwe

0

1 Answer 1

1

The macro \approx works in both text and math mode -- at least if you're using Arial and Impact for plain and bold text and if unicode-math is loaded along with a suitable font (such as XITS Math) -- because all three fonts provide glyphs that correspond to \approx. In contrast, \star is a math-mode-only macro in your setup since neither Arial nor Impact feature a glyph that might correspond to \star.

enter image description here

\documentclass{article}

\usepackage{fontspec}

\defaultfontfeatures{Mapping=tex-text}
\setmainfont[Mapping=tex-text]{Arial}

\newfontfamily\headingfont[]{Impact}
\renewcommand{\bfseries}{\headingfont}

\usepackage[math-style=TeX,vargreek-shape=unicode]{unicode-math}
\setmathfont{XITS Math}

\begin{document}
The macro \verb+\approx+ works in text mode (plain and bold)--- ``\approx'' 
and ``\textbf{\approx}''---and in math mode: ``$\approx$''. The appearance 
of the symbol differs greatly across text and math modes because of the 
difference in fonts: Arial for plain text, Impact for bold text, and XITS 
(a Times Roman clone) for math.

The macro \verb+\star+ works in math mode, ``$\star$'', but not in text mode: ``\star''.

\end{document}
3
  • @DaniCee - You're welcome. Historically, most text fonts have supplied very few symbols one tends to think of as being used primarily (exclusively?!) in math mode. \approx is among the few math-y symbols that show up regularly in text fonts. I'm tempted to speculate that if font designers provide a glyph for = (which is a must), they may feel motivated to provide one for as well...
    – Mico
    Dec 1, 2016 at 7:42
  • 1
    I believe allowing math mode control sequences in text is an error to begin with.
    – egreg
    Dec 1, 2016 at 7:51
  • @egreg - No disagreement from me on that one... Having the text-font symbol accessible only via something like \textapprox would eliminate a lot of potential ambiguity and confusion.
    – Mico
    Dec 1, 2016 at 12:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .