0

First, a minimal working example is as following:

\documentclass{article}
\usepackage{amsmath,amsfonts,amssymb,mathrsfs}
\usepackage{mathspec}
\setallmainfonts(Digits,Latin){Times}%a replacement of the font that I am using now
\title{Test}
\begin{document}
\maketitle

$a'+b=c^\prime$ and $(f),[f],{f}$.

\end{document}

And its output by xelatex is

enter image description here

So my questions are:

  1. The primes in the picture produced by the codes ' and \prime are both from the default Computer Modern font. Then how to change ' and \prime into the symbols in the setting Times font? Hope a global setting but not a local one.
  2. The space at the both side of the italic f in math mode is so small that the parenthesis and f are too close. Then how to add spacing to the both side of the italic f in math mode only (but not in text mode)? Hope a global setting but not a local one too.

Question 2 has been solved as following, then for question 1 who can help me?

M. Logic
  • 4,214
  • 2
    using mathspec and times you are using a text font for math so will always get suboptimal spacing, could you consider unicode-math package and Stix Two Math font which is a times-like font designed for math – David Carlisle Aug 27 '20 at 07:22
  • @David Carlisle Actually NO since the font that I am using in fact can only be used in such a way. Also I tried other ways but failed, for example, reediting the font file. – M. Logic Aug 27 '20 at 07:24

2 Answers2

1

For question 2, I get an answer which coms from the link with the help of @egreg. I post the answer here:

\makeatletter
\AtBeginDocument{%
    \Umathcharnumdef\math@f\Umathcodenum`f 
    \mathcode`f=\string"8000}
\begingroup\lccode`~=`f
\lowercase{\endgroup
    \def~{%
        \mkern3mu\math@f
        \ifnum\mathgroup=\m@ne
        \expandafter\@firstofone
        \else
        \expandafter\@gobble
        \fi
        {\@ifnextchar_{\relax}{\mkern3mu}}%
    }
}
\makeatother

And the following is the output for the revision:

enter image description here

M. Logic
  • 4,214
0

You should use "f (and similarly for other letters) as mentioned in the manual of mathspec.

Note that ' is the same as ^{\prime}.

\documentclass{article}
\usepackage{amsmath,amsfonts,amssymb,mathrsfs}
\usepackage{mathspec}
\setallmainfonts(Digits,Latin){Times}%a replacement of the font that I am using now
\title{Test}
\begin{document}
\maketitle

$a'+b="f^\prime$ and $("f),["f],{"f}$.

\end{document}

enter image description here

egreg
  • 1,121,712
  • For question 2, I prefer a global answer to the local one. For question 1,' and ^\prime are indeed the same. But what I need is to make them become the symbol in the Times font instead of the default Computer Modern font. So question 1 is still note solved. – M. Logic Aug 28 '20 at 02:52
  • To thanks for your sincere help for question 2, I pick your answer although there is no well answer to question 1 now. – M. Logic Aug 29 '20 at 15:04