0

I have using LuaLaTeX Version 1.12.0. I have need to maintain same text fonts in math mode (only alphabetic, numbers). All the Alphabetic characters (like A to Z, a to z) need to maintain same \setmainfont in mathmode (it means in between $....$ and \begin{align*}...\end{align*}).

When \textit{c} in LaTeX, PDF c character font is Times New Roman. When $c$ in LaTeX, PDF c character font is XITS. How to change this Times New Roman.

How to achieve this?

My MWE:

\documentclass{article}
\usepackage{amsmath,fontspec,luacolor,blindtext}
\usepackage{hyperref}
\hypersetup{colorlinks,citecolor=blue}

\usepackage{fontspec,unicode-math}
\setmainfont{Times New Roman}
\setmathfont{XITS}
\begin{document}
\title{Article Title Here}
\author{Author Here}
\maketitle

\section{Introduction}

The investigations of cylindrically symmetric spacetimes can be traced $1=2$ back as far as to 1919 when Levi-Civita (LC) \textit{c} discovered a class $c$ of solutions \textit{E} of ${E}^{2}$ Einstein’s vacuum field equations, corresponding to static cylindrical spacetimes.

\begin{align*}
{\frac{G≲}{{c}}}=\mathcal{O}{\left({{\frac{{{E}^{{2}}}}{{{M}_{pl}^{{2}}}}}}\right)},\tag{1.1}
\end{align*}

\end{document}
1
  • You don't want that c in math mode is taken from the text font, because it should be mathematical character, precisely U+1D450 MATHEMATICAL ITALIC SMALL C
    – egreg
    Oct 21, 2020 at 19:58

1 Answer 1

1

One way to do this is to select the same font family in both text and math mode, such as

\setmainfont{XITS}
\setmathfont{XITS Math}

(Note that \setmathfont{XITS} is not correct.) Or:

\setmainfont{TeX Gyre Termes}
\setmathfont{TeX Gyre Termes Math}

All the TeX Gyre fonts are clones of a popular font with a different name, so Palatino matches TeX Gyre Pagella Math or Asana Math and TeX Gyre Termes Math matches Times, Times New Roman, and any other version of TImes.

If you want to replace the letters of your text font, you can do that with the range= option of \setmathfont. Note that you must choose a font that contains Greek letters to be able to use Greek, and the TeX Gyre fonts do not. You would need to set the upright, italic, bold and bold italic alphabets in order to be able to use them, and you can do the same for sans-serif, calligraphic, script, typewriter or Fraktur.

In this contrived example, I set the math alphabets to use New Computer Modern Book with Latin Modern Math, even though there is a math font that matches.

\usepackage{unicode-math}
\defaultfontfeatures{Scale=MatchLowercase}
\setmainfont{New Computer Modern Book}[Scale=1.0, Ligatures={Common,Discretionary,TeX}]
\setmathfont{Latin Modern Math}
\setmathfont{NewCM10-Book.otf}[range=up]
\setmathfont{NewCM10-BookItalic.otf}[range=it]
\setmathfont{NewCM10-Bold.otf}[range=bfup]
\setmathfont{NewCM10-BoldItalic.otf}[range=bfit]
3
  • Its working fine. How do define greek letters and numbers and keyboard characters like (=,+-,(,) etc...)?
    – Balaji
    Oct 22, 2020 at 6:01
  • @Balaji That does define Greek letters, and the upright and bold-upright alphabets have numbers. You can define range=up/{Greek,greek} (for example) to replace only uppercase and lowercase Greek, for example. See the unicode-math manual at CTAN.org for full details.
    – Davislor
    Oct 22, 2020 at 12:49
  • @Balaji You can replace any command with its Unicode hex code, e.g. range="220E, a backtick followed by the UTF-8 symbol, or its name, e.g. range=\QED.
    – Davislor
    Oct 22, 2020 at 12:51

You must log in to answer this question.

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