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.

5

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.

  • So for this solution one needs newtx? I've already tried to install this before, but failed. – Martin Brandenburg Mar 6 '15 at 0:20
  • @MartinBrandenburg You can use txsy, if you want, but my advice is to install a complete recent TeX distribution that has NewTX out of the box. Installing font packages over an old TeX distribution is always a PITA. – egreg Mar 6 '15 at 0:21
  • Ok. I had already tried to use "txsy", but just the encoding was wrong ... – Martin Brandenburg Mar 6 '15 at 0:23
  • Out of curiosity: Is it possible to use single symbols from txfont, for example, say, $\otimes$? – Martin Brandenburg Mar 6 '15 at 0:28
  • 1
    @MartinBrandenburg Yes, of course. Not really easy, but this question has the needed answers: Importing a Single Symbol From a Different Font. In case \otimes belongs to the symbols math group, the approach with \DeclareSymbolFont and \DeclareSymbolFontAlphabet will become necessary in order not to waste math groups. – egreg Mar 6 '15 at 0:30
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

  • Three lines instead of just two. ;-). But it's better to use ntxsy, which has better metrics. – egreg Mar 6 '15 at 0:19
  • @egreg But is not what the OP asked for ;). Not that it isn't true.... – cfr Mar 6 '15 at 0:22

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.