0

I have using LuaLaTeX V: 1.12.0 and how to do automatically missing characters in Math?

My LaTeX:

\documentclass{article}
\tracinglostchars=2 % Warn if the current font does not have a character!
\usepackage[tuenc]{fontspec}
\usepackage{unicode-math} 
\defaultfontfeatures{Ligatures=TeX}
\setmainfont[Scale=1.0,SmallCapsFeatures={Renderer=Basic}]{Dejavu Sans}
%%% Math Fonts
\setmathfont{dejavusans.ttf}
\setmathfont{Dejavu Sans}
\setmathrm{FreeSerif.otf}
\setmathfont[range={it}]{FreeSerif.otf}

\title{Math Substitute Fonts}

\begin{document}

\maketitle

\begin{equation} ż 0 \times 0 \hbox{ and } \mathrm{ż} \end{equation}

\end{document}

Automatically substitute missing glyph with another in LuaLaTeX

When using \usepackage{newunicodechar} package i have need to declare all the glyps. Can I do the automatic substitution without declaring ё to be an active character?

I have need if missing characters in math automatically need take FreeSerif font.

Bernard
  • 271,350
Balaji
  • 2,282

1 Answers1

2

If you want to introduce arbitrary text-mode characters in math mode, wrap them in \textnormal, \textit, \mathrm, \mathit or whatever is appropriate.

If you want a fallback font for math symbols, load it with \setmainfont and then load any symbols you want to replace with \setmainfont[range=...].

Here’s a MWE:

\documentclass{article}
\tracinglostchars=2 % Warn if the current font does not have a character!
\usepackage[math-style=upright]{unicode-math} 
\defaultfontfeatures{ Ligatures=TeX, Scale=MatchLowercase }
\setmainfont[Scale=1.0,SmallCapsFeatures={Renderer=Basic}]{Dejavu Sans}
%%% Math Fonts
\setmathfont{TeX Gyre DejaVu Math}
\setmathfont{FreeSerif}[range=up, Script=Default]
\setmathrm{FreeSerif}

\title{Math Substitute Fonts}

\begin{document}

\maketitle

[ \textnormal{ż} 0 \times 0 \textnormal{ and } \mathrm{ż} ]

\end{document}

This fixes a few problems with the example in the question, mainly setting the math font to the DejaVu math font rather than a text font, but also scaling the fonts correctly. Since you were selecting an upright font as your italic math font, I assumed you wanted upright math, and set math-style=upright instead. This uses \symup by default, but makes \symit available if you want it.

If you want a fallback font in text mode, you can try combofont or these solutions.

Davislor
  • 44,045