Importing a Single Symbol From a Different Font

There's sort of a general way, but it involves knowing your way around the various bits of the other font packages. You can then take just the bits you need. So for your particular example, you could do the following:

\documentclass{article}
% Setup the matha font (from mathabx.sty)
\DeclareFontFamily{U}{matha}{\hyphenchar\font45}
\DeclareFontShape{U}{matha}{m}{n}{
      <5> <6> <7> <8> <9> <10> gen * matha
      <10.95> matha10 <12> <14.4> <17.28> <20.74> <24.88> matha12
      }{}
\DeclareSymbolFont{matha}{U}{matha}{m}{n}

% Define a subset character from that font (from mathabx.dcl)
% to completely replace the \subset character, you can replace
% \varsubset with \subset

\DeclareMathSymbol{\varsubset}{3}{matha}{"80}
\begin{document}

Computer Modern subset
\[
A \subset B
\]

\texttt{mathabx} subset

\[
A \varsubset B
\]

\end{document}

This code is copied from the mathabx package.

sample


There's another way to cope with a single symbol without wasting a precious math alphabet resource (there are only 16 of them).

\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

After these one can choose a particular symbol and give it a sensible name, for example

\newcommand{\varsubset}{\Pimathsymbol[\mathrel]{matha}{"80}}

The optional argument gives the type of the symbol, in this case a binary operation symbol; the first mandatory argument is the name of the font family and the second one the number of the symbol's slot in the font.

Unfortunately, mathabx doesn't provide .fd files, so one has also to declare the family as explained in Alan's answer, but, since now the mathabx are also in Type1 format, one may scale them:

\DeclareFontFamily{U}{matha}{\hyphenchar\font45}
\DeclareFontShape{U}{matha}{m}{n}{
  <-6> matha5 <6-7> matha6 <7-8> matha7
  <8-9> matha8 <9-10> matha9
  <10-12> matha10 <12-> matha12
  }{}

Any symbol in any font may be used in math and it will scale properly in subscripts and superscripts.


With unicode-math

Unicode math fonts support a wide range of symbols. Among these are a lot of symbols which were only available using supplemental package when not using Unicode fonts.

The unicode-math package enables you to load these Unicode math fonts. Some are available in TeXlive, such as Latin Modern Math, a Unicode port of the popular lmodern package.

A list of symbols, defined by some of these fonts can be found in the document Every symbol (most symbols) defined by unicode-math by the developer of unicode-math and TeX.SX user Will Robertson.

Let's take for example, the \llangle and \rrangle symbols. These are not available in Latin Modern Math but they are in XITS Math. To import these when using Latin Modern Math as the main math font, one has to use the range option. The range option accepts Unicode slots or alternatively, for easier understanding, the mnemonic names of the symbols. Be sure to load the custom range after setting the main math font. Otherwise your hand-crafted set of symbols will be overwritten.

\documentclass{article}
\usepackage{unicode-math}
\setmathfont{Latin Modern Math}
\setmathfont[range={\llangle,\rrangle}]{XITS Math}
\begin{document}
$\llangle a \rrangle$
\end{document}

enter image description here

Tags:

Fonts

Symbols