8

I wish to import a symbol from newtxmath for use with kpfonts without using up a math alphabet to do it. As seen in this question it is easy to do so if one is willing to waste a math alphabet, but in their answer to this question, egreg seems to say that it is possible to avoid this by using the pifont package.

For reference, this works but uses up a math alphabet:

\documentclass{article}
\usepackage{kpfonts}
\makeatletter
\DeclareSymbolFont{ntxletters}{OML}{ntxmi}{m}{it}
\re@DeclareMathSymbol{\newpartial}{\mathord}{ntxletters}{64}
\makeatother
\begin{document}
\[ \partial \newpartial \]
\end{document}

Following (as far as I can tell correctly) egreg's instructions would lead me to the following:

\documentclass{article}
\usepackage{kpfonts}
\usepackage{pifont}
\makeatletter
\newcommand\Pimathsymbol[3][\mathord]{%
  #1{\@Pimathsymbol{#2}{#3}}}
\def\@Pimathsymbol#1#2{\mathchoice
  {\@Pim@thsymbol{#1}{#2}\tf@size}
  {\@Pim@thsymbol{#1}{#2}\tf@size}
  {\@Pim@thsymbol{#1}{#2}\sf@size}
  {\@Pim@thsymbol{#1}{#2}\ssf@size}}
\def\@Pim@thsymbol#1#2#3{%
  \mbox{\fontsize{#3}{#3}\Pisymbol{#1}{#2}}}
\makeatother
\newcommand{\newpartial}{\Pimathsymbol[\mathord]{ntxmmi}{64}}
\begin{document}
\[ \partial \newpartial \]
\end{document}

This compiles but gives the following error messages:

Some font shapes were not available, defaults substituted.
Font shape `U/ntxmmi/m/n' undefined
(Font)  using `U/jkpexa/m/n' instead.

The output is also wrong, substituting a (subscript?) \oiintctrclockwise from kpfonts instead. I suppose this symbol fills the 64 slot of the jkpexa font.

If I understand egreg correctly, this method is not sufficient in the linked question above since the asker wishes to import a symbol from mathabx, and this does not provide .fd files. But as far as I can tell, newtxmath does provide (at least some) .fd files here.

(Note that I am using pdfLaTeX. Not sure if that is significant enough for it to be a tag.)

1 Answer 1

9

That's just for symbols in the “Pi” font.

If you don't need the symbol to respect \boldmath, it's as easy as

\newcommand{\newpartial}{\mathord{\text{\usefont{OML}{ntxmi}{m}{it}\symbol{64}}}}

Complete example.

\documentclass{article}
\usepackage{amsmath}
\usepackage{kpfonts}

\newcommand{\newpartial}{}
\DeclareRobustCommand{\newpartial}{%
  \mathord{\text{\usefont{OML}{ntxmi}{m}{it}\symbol{64}}}%
}

\begin{document}

\[ \partial \newpartial \]

\end{document}

enter image description here

Better using \DeclareRobustCommand so if the symbol gets its way in some moving argument you don't get garbage in the .aux file.

For \boldmath

\documentclass{article}
\usepackage{amsmath}
\usepackage{kpfonts}
\usepackage{pdftexcmds}

\newcommand{\newpartial}{%
  \mathord{\text{\usefont{OML}{ntxmi}{\mediumorbold}{it}\symbol{64}}}%
}
\makeatletter
\newcommand{\mediumorbold}{%
  \ifnum\pdf@strcmp{\math@version}{bold}=0 b\else m\fi
}
\makeatother

\begin{document}

\[ \partial \newpartial \]

\boldmath
\[ \partial \newpartial \]

\end{document}

enter image description here

2
  • I see! Thank you. I think I misunderstood the relationship between pifont, newtx and mathptm: From the PSNFSS documentation it seemed like it used to support mathptm, but that this had been replaced by newtx. I guess I thought pifont could (still) be used as an interface to newtx, but I suppose not. I don't need a bold version for this particular symbol, but suppose I did, would that be significantly more difficult? (I don't want to ask you for a solution if it is, but in case I ever need to import bold symbols in the future it would be nice to know how difficult it would be.)
    – Danny
    Commented Oct 12, 2021 at 16:23
  • @Danny It's not so difficult (it would be to support \bm, though).
    – egreg
    Commented Oct 12, 2021 at 17:07

You must log in to answer this question.

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