I want to extract the plus symbol + from the newtx(which included newtxmath) package. But I want to just extract this symbol into my document, not to include the entire package (which leads to a conflict). How can I do this? For example, it seems it should be written as something like \DeclareMathSymbol{+}{...}{...}{...} to redefine the + symbol, but how can I get the font-family name of newtxmath? I checked the package document, but can't find it. At the same time, I also checked the newtxmath.sty, but hardly to understand. Need help.
2 Answers
The important lines from newtxmath.sty for the redefinition of the plus sign in math are the lines with \DeclareMathSymbol{+} and the definitions for the symbol font lettersA.
In addition, the font definition file untxmia.fd uses \if switches that reflects the options libertine, minion, and cochineal.
\documentclass{article}
\mathchardef\OldPlus=\mathcode`\+
\makeatletter
\newif\iftx@libertine
\newif\iftx@minion
\newif\iftx@coch
\makeatother
\DeclareSymbolFont{lettersA}{U}{ntxmia}{m}{it}
\SetSymbolFont{lettersA}{bold}{U}{ntxmia}{b}{it}
\DeclareMathSymbol{+}{\mathbin}{lettersA}{253}
\begin{document}
\begin{tabular}{ll}
Old: & $\OldPlus$\\
New: & $+$
\end{tabular}
\end{document}
The case of the minus sign or \times is different. Here, package newtxmath redefines the standard symbol font symbols. Therefore, this font is renamed to NTXsymbols in the following example in order to avoid changes of other letters:
\documentclass{article}
\usepackage{booktabs}
\mathchardef\OldPlus=\mathcode`\+
\mathchardef\OldMinus=\mathcode`\-
\let\OldTimes\times
\makeatletter
\newif\iftx@libertine
\newif\iftx@minion
\newif\iftx@coch
\makeatother
\DeclareSymbolFont{lettersA}{U}{ntxmia}{m}{it}
\SetSymbolFont{lettersA}{bold}{U}{ntxmia}{b}{it}
\DeclareMathSymbol{+}{\mathbin}{lettersA}{253}
\DeclareSymbolFont{NTXsymbols}{OMS}{ntxsy}{m}{n}
\SetSymbolFont{NTXsymbols}{bold}{OMS}{ntxsy}{b}{n}
\DeclareMathSymbol{-}{\mathbin}{NTXsymbols}{0}
\DeclareMathSymbol{\times}{\mathbin}{NTXsymbols}{2}
\begin{document}
\begin{tabular}{ll}
Old & New \\
\midrule
$\OldPlus$ & $+$ \\
$\OldMinus$ & $-$ \\
$\OldTimes$ & $\times$ \\
\end{tabular}
\end{document}
- 271,626
In case you do not wish to use a maths alphabet up for a single symbol (it is not hard to plough through the 16 available), you can define a macro to access the symbol by tweaking egreg's answer and the relevant commands from pifont. Combining this with the information from Heiko Oberdiek's answer:
\documentclass{article}
% ateb egreg: https://tex.stackexchange.com/a/14406/
\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}\Piitsymbol{#1}{#2}}}
% ateb Heiko Oberdiek: https://tex.stackexchange.com/a/354435/
\newif\iftx@libertine
\newif\iftx@minion
\newif\iftx@coch
% pifont.sty
\newcommand{\Piitfont}[1]{\fontfamily{#1}\fontencoding{U}%
\fontseries{m}\fontshape{it}\selectfont}
\newcommand{\Piitsymbol}[2]{{\Piitfont{#1}\char#2}}
\makeatother
\newcommand{\newplus}{\Pimathsymbol[\mathbin]{ntxmia}{253}}
\begin{document}
\[
+ \newplus
\]
\end{document}



-and\times? I openednewtxmath.stybut can't find the definition of-or\times. Is there an encode table to see which character is corresponding to which encode? – Eric Feb 18 '17 at 04:48-looks rounded-corner and apparently longer then the+). My environment: I use XeLaTeX andmtpro2now. I have installed thenewtxpackage(the latest version) but don'tusepackagethem. The+behaves successfully. – Eric Feb 18 '17 at 10:17mtpro2before or after the redefinitions? – Heiko Oberdiek Feb 18 '17 at 11:18\DeclareSymbolFont{NTXsymbols}{OMS}{ntxsy}{m}{n}to\DeclareSymbolFont{NTXsymbols}{OMS}{ntxsyddvskposdvk}{m}{n}(a non-existent family name) and pass the compiler. So maybe the reason I can't get thentxsyfont is that the compiler fail to load thentxsyfont? – Eric Feb 18 '17 at 11:57symbols, the first argument of\DeclareSymbolFontis changed toNTXsymbols. The font mapping must be the same. Otherwise, you get a different font or a default font, if the font does not exist. – Heiko Oberdiek Feb 18 '17 at 12:39