0

Need some group of text in Arial font, for this, tried with the code:

\documentclass{article} 
\usepackage[no-math]{fontspec} % For specifying fonts
\usepackage{unicode-math}

\setmainfont{Times}
\setsansfont{Arial}

\newfontfamily{\arialfont}{Arial}[
  Ligatures=TeX,
  NFSSFamily=ari,
]

\begin{document}

\def\splsansmath{
  \DeclareSymbolFont{sansalphabets}{TU}{ari}{m}{n}%
  \SetSymbolFont{sansalphabets}{bold}{TU}{ari}{b}{n}%
  \DeclareSymbolFont{sansnumbers}{TU}{ari}{m}{n}%
  \SetSymbolFont{sansnumbers}{bold}{TU}{ari}{b}{n}%
  \DeclareMathSymbol{0}{\mathalpha}{sansnumbers}{"30}%
  \DeclareMathSymbol{1}{\mathalpha}{sansnumbers}{"31}%
  \DeclareMathSymbol{2}{\mathalpha}{sansnumbers}{"32}%
  \DeclareMathSymbol{3}{\mathalpha}{sansnumbers}{"33}%
  \DeclareMathSymbol{4}{\mathalpha}{sansnumbers}{"34}%
  \DeclareMathSymbol{5}{\mathalpha}{sansnumbers}{"35}%
  \DeclareMathSymbol{6}{\mathalpha}{sansnumbers}{"36}%
  \DeclareMathSymbol{7}{\mathalpha}{sansnumbers}{"37}%
  \DeclareMathSymbol{8}{\mathalpha}{sansnumbers}{"38}%
  \DeclareMathSymbol{9}{\mathalpha}{sansnumbers}{"39}%
%%%
\DeclareMathSymbol{A}{\mathalpha}{sansalphabets}{"41}
\DeclareMathSymbol{B}{\mathalpha}{sansalphabets}{"42}
\DeclareMathSymbol{C}{\mathalpha}{sansalphabets}{"43}
\DeclareMathSymbol{D}{\mathalpha}{sansalphabets}{"44}
\DeclareMathSymbol{E}{\mathalpha}{sansalphabets}{"45}
\DeclareMathSymbol{F}{\mathalpha}{sansalphabets}{"46}
\DeclareMathSymbol{G}{\mathalpha}{sansalphabets}{"47}
\DeclareMathSymbol{H}{\mathalpha}{sansalphabets}{"48}
\DeclareMathSymbol{I}{\mathalpha}{sansalphabets}{"49}
\DeclareMathSymbol{J}{\mathalpha}{sansalphabets}{"4A}
\DeclareMathSymbol{K}{\mathalpha}{sansalphabets}{"4B}
\DeclareMathSymbol{L}{\mathalpha}{sansalphabets}{"4C}
\DeclareMathSymbol{M}{\mathalpha}{sansalphabets}{"4D}
\DeclareMathSymbol{N}{\mathalpha}{sansalphabets}{"4E}
\DeclareMathSymbol{O}{\mathalpha}{sansalphabets}{"4F}
\DeclareMathSymbol{P}{\mathalpha}{sansalphabets}{"50}
\DeclareMathSymbol{Q}{\mathalpha}{sansalphabets}{"51}
\DeclareMathSymbol{R}{\mathalpha}{sansalphabets}{"52}
\DeclareMathSymbol{S}{\mathalpha}{sansalphabets}{"53}
\DeclareMathSymbol{T}{\mathalpha}{sansalphabets}{"54}
\DeclareMathSymbol{U}{\mathalpha}{sansalphabets}{"55}
\DeclareMathSymbol{V}{\mathalpha}{sansalphabets}{"56}
\DeclareMathSymbol{W}{\mathalpha}{sansalphabets}{"57}
\DeclareMathSymbol{X}{\mathalpha}{sansalphabets}{"58}
\DeclareMathSymbol{Y}{\mathalpha}{sansalphabets}{"59}
\DeclareMathSymbol{Z}{\mathalpha}{sansalphabets}{"5A}
%%
\DeclareMathSymbol{a}{\mathalpha}{sansalphabets}{"61}
\DeclareMathSymbol{b}{\mathalpha}{sansalphabets}{"62}
\DeclareMathSymbol{c}{\mathalpha}{sansalphabets}{"63}
\DeclareMathSymbol{d}{\mathalpha}{sansalphabets}{"64}
\DeclareMathSymbol{e}{\mathalpha}{sansalphabets}{"65}
\DeclareMathSymbol{f}{\mathalpha}{sansalphabets}{"66}
\DeclareMathSymbol{g}{\mathalpha}{sansalphabets}{"67}
\DeclareMathSymbol{h}{\mathalpha}{sansalphabets}{"68}
\DeclareMathSymbol{i}{\mathalpha}{sansalphabets}{"69}
\DeclareMathSymbol{j}{\mathalpha}{sansalphabets}{"6A}
\DeclareMathSymbol{k}{\mathalpha}{sansalphabets}{"6B}
\DeclareMathSymbol{l}{\mathalpha}{sansalphabets}{"6C}
\DeclareMathSymbol{m}{\mathalpha}{sansalphabets}{"6D}
\DeclareMathSymbol{n}{\mathalpha}{sansalphabets}{"6E}
\DeclareMathSymbol{o}{\mathalpha}{sansalphabets}{"6F}
\DeclareMathSymbol{p}{\mathalpha}{sansalphabets}{"70}
\DeclareMathSymbol{q}{\mathalpha}{sansalphabets}{"71}
\DeclareMathSymbol{r}{\mathalpha}{sansalphabets}{"72}
\DeclareMathSymbol{s}{\mathalpha}{sansalphabets}{"73}
\DeclareMathSymbol{t}{\mathalpha}{sansalphabets}{"74}
\DeclareMathSymbol{u}{\mathalpha}{sansalphabets}{"75}
\DeclareMathSymbol{v}{\mathalpha}{sansalphabets}{"76}
\DeclareMathSymbol{w}{\mathalpha}{sansalphabets}{"77}
\DeclareMathSymbol{x}{\mathalpha}{sansalphabets}{"78}
\DeclareMathSymbol{y}{\mathalpha}{sansalphabets}{"79}
\DeclareMathSymbol{z}{\mathalpha}{sansalphabets}{"7A}
}

\newcommand{\checkforsansmath}[1]{\bgroup\sffamily\splsansmath#1\egroup}

This is for test

\(12312.123123 abcd\)

\vspace{2pc}


\checkforsansmath{
This is for test
\(12312.123123 abcd\)
}


\end{document}

It produced error, and not sure how to fix it. .log file details are:

! \textfont 5 is undefined (character 1).
\)  ->\relax \ifmmode \ifinner $
                                \else \@badmath \fi \else \@badmath \fi 
l.98 }

I'm using XELaTeX in MikTeX2.9 in Windows10 system

4
  • Maybe "Kitbashing Math Fonts" is what you are looking for: tex.stackexchange.com/a/425099/29873
    – DG'
    Commented May 14 at 13:49
  • Please copy-paste the error into your question. If you are using code from somebody else, please provide a link to the source.
    – cfr
    Commented May 14 at 14:51
  • If I had to guess - based on no information about the error at all - I'd say you received an error telling you that Arial doesn't support sansnumbers because Arial is a text font and not a maths font. unicode-math will only work with a font specifically constructed to support typesetting maths.
    – cfr
    Commented May 14 at 14:55
  • @cfr Thanks for your attention, error details added
    – GowriSaro
    Commented May 15 at 6:04

0

You must log in to answer this question.

Browse other questions tagged .