3

I need to use a character in a TrueType font as a math symbol. Having seen morbusg's answer, I tried something like this:

\font\mymathtfont="Times New Roman"
\font\mymathsfont="Times New Roman/S=7" at 7pt
\font\mymathssfont="Times New Roman/S=5" at 5pt
\newfam\mymathfam
\textfont\mymathfam=\mymathtfont
\scriptfont\mymathfam=\mymathsfont
\scriptscriptfont\mymathfam=\mymathssfont
\Umathchardef\mysym 3 \mymathfam "1D76

The command \mysym does print the symbol, but when the font size in the article changes (for example by adding \fontsize{14.4pt}{1.3\baselineskip}\selectfont after \begin{document}), the size of the symbol printed by \mysym remains the same. I speculate that it is because the font sizes are fixed when the font is selected, so what is the correct way to select the font in this case? Thanks!

  • 1
    I assumed looking at your initial code block that you were using plain tex as they are all tex primitive declarations not usually used in latex, but then you show you are using latex. That is why you should declare fonts through latex interfaces, so for example they all get assigned for all font sizes. – David Carlisle Dec 17 '16 at 14:16
  • Actually, I do not know how to declare a TrueType font with LaTeX interfaces. I mean, for example, \DeclareSymbolFont has the argument "encoding", and I have no idea what to fill in. – Saad Dec 17 '16 at 14:33
2

Setting up math fonts is a delicate matter and you don't need it for just a few symbols.

\documentclass{article}
\usepackage{amsmath}
\usepackage{fontspec}

\newfontfamily{\timesnewroman}{Times New Roman}

\DeclareRobustCommand\mysym{%
  \mathrel{\text{\normalfont\timesnewroman\symbol{"1D76}}}%
}

\begin{document}

$a\mysym b+\sum_{a\mysym b}X$

\Huge

$a\mysym b$

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.