TransWikia.com

How to change "'" and "prime" into the symbols in the setting font and how to add spacing to the both side of italic "f" in math mode only?

TeX - LaTeX Asked by M. Logic on December 6, 2020

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?

2 Answers

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

Correct answer by egreg on December 6, 2020

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

makeatletter
AtBeginDocument{%
    Umathcharnumdefmath@fUmathcodenum`f 
    mathcode`f=string"8000}
begingrouplccode`~=`f
lowercase{endgroup
    def~{%
        mkern3mumath@f
        ifnummathgroup=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

Answered by M. Logic on December 6, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP