6

I would like to use the "\mathcal symbols" from txfonts, but otherwise use the standard symbols. Including the package txfonts changes all fonts, which I would like to avoid. The command

\DeclareSymbolFont{symbols}{OMS}{txsy}{m}{n}

uses all math symbols from txfonts, but I think that they are too thick (and the quantors look ugly), especially compared to the usual text font computer modern. Probably

\DeclareMathAlphabet{\mathcal}{T1}{TX}{m}{n}

should work, where TX has to be replaced by the correct family name of txfonts. Which is the correct one? I've already tried some names, but so far none has worked.

Ruben
  • 13,448

2 Answers2

6

It's as easy as this:

\documentclass{article}

\DeclareMathAlphabet{\mathcal}{OMS}{ntxsy}{m}{n}   % or txsy
\SetMathAlphabet{\mathcal}{bold}{OMS}{ntxsy}{b}{n} % or txsy

\begin{document}
$x\mathcal{ABCDEF}y$

\boldmath$x\mathcal{ABCDEF}y$
\end{document}

enter image description here

Explanation. The TX/NewTX packages do no change to the basic math font setup, where \mathcal is defined by

\DeclareSymbolFontAlphabet{\mathcal}{symbols}

in order not to waste a math group. For your purpose a new math group is obviously necessary, so we just need to look in newtxmath.sty what's the definition of the symbols math symbol font and we find

178 \DeclareSymbolFont{symbols}{OMS}{ntxsy}{m}{n}
179 \SetSymbolFont{symbols}{bold}{OMS}{ntxsy}{b}{n}

(line numbers added for reference). So it's sufficient to change \DeclareSymbolFont{symbols} with \DeclareMathAlphabet{\mathcal} and \SetSymbolFont{symbols} with \SetMathAlphabet{\mathcal}.

It's better to use the fonts provided by NewTX that have refined metrics with respect to the older TX package and also is actively maintained, contrary to the old package.

moewe
  • 175,683
egreg
  • 1,121,712
3

The standard definition of \mathcal is in fontmath.ltx:

\DeclareSymbolFontAlphabet{\mathcal}   {symbols}

So, to use a different font, we need to do two things:

  • define a new symbol font, with a distinct name (because we don't want everything else to come from the txfonts symbol font);
  • redefine \mathcal so that it uses the new font.

So, let's use symbolstx for the new font. Looking for the definition of symbols in txfonts.sty, we find:

\DeclareSymbolFont{symbols}{OMS}{txsy}{m}{n}
\SetSymbolFont{symbols}{bold}{OMS}{txsy}{bx}{n}

So, we just need to adapt these lines to specify symbolstx rather than symbols:

\DeclareSymbolFont{symbolstx}{OMS}{txsy}{m}{n}
\SetSymbolFont{symbolstx}{bold}{OMS}{txsy}{bx}{n}

Then we can define \mathcal accordingly:

\DeclareSymbolFontAlphabet{\mathcal}{symbolstx}

Putting it altogether:

\documentclass{article}

\DeclareSymbolFont{symbolstx}{OMS}{txsy}{m}{n}
\SetSymbolFont{symbolstx}{bold}{OMS}{txsy}{bx}{n}

\DeclareSymbolFontAlphabet{\mathcal}{symbolstx}

\begin{document}

  \[
    \mathcal{ABCDEFGHIJKLMNOPQRSTUVWXYZ}
  \]

\end{document}

modified calligraphic maths

cfr
  • 198,882