5

I use \mathabx package because I like much more their mathematical symbols. Except for the empty set symbol ($\emptyset$ in LaTeX). I would like to changed it by the standard Computer Modern symbol. But I don't know how to do it. There are some examples to import particular symbols, but I don't undertsand them.

For example, the code

\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}
\DeclareFontSubstitution{U}{matha}{m}{n}
\DeclareMathSymbol{\abxcup}{\mathbin}{matha}{'131}

has been taken from the question The standard \cup vs. the mathabx \cup. Question Importing a Single Symbol From a Different Font also has a similar code. How can I changed them to get the standard empty set symbol?

Thanks

10
  • 1
    Is\varnothing (amssymb package) what you're looking for? Commented Jan 12, 2018 at 19:04
  • @FranckPastor No, it is \emptyset from amssymb. Maybe I should add it in the question.
    – Dog_69
    Commented Jan 12, 2018 at 19:05
  • \emptyset doesn't come from the amssymb fonts, but from the standard Computer Modern math fonts. Its variant from the amssymb fonts is precisely \varnothing. Commented Jan 12, 2018 at 19:08
  • I thought that but yout comment confused me.
    – Dog_69
    Commented Jan 12, 2018 at 19:09
  • Personally it's your question I find confusing in its current form ;-). So if I understand correctly, you are looking for a way to use the \varnothing symbol without having to load the whole amssymb package? Commented Jan 12, 2018 at 19:13

3 Answers 3

6

For completeness, I provide the original solution, on the assumption that the font needed is not already loaded by TeX. Afterward, I show a streamlined solution, since cmsy (Computer Modern symbol font family) has already been loaded by default.

The Long Way:

Here, after mathabx is loaded, I declare and define the cmsy font family, found on p.431 of the TeXbook. cmsy is the name that the Computer Modern symbol font family is known as, to TeX. It is called a font "family" because the font is provided in different sizes, and \DeclareFontShape tells which glyph set (member of the family) to use depending on the fontsize that is requested.

I create a new symbol font Xcmsy that points to the cmsy font family. I then declare the symbol \cmemptyset to be of categorymathord, and found in slot 59 of the Xcmsy font.

If you uncomment the two fonttable lines of code, you will see the cmsy font printed out in tabular form, and can verify that the empty set glyph is found at slot 59.

\documentclass{article}
\usepackage{mathabx}
% =============================================
%Import symbols from font cmsy without importing the whole package
% =============================================
\DeclareFontFamily{U} {cmsy}{}

\DeclareFontShape{U}{cmsy}{m}{n}{
  <-8> cmsy7
  <8-9> cmsy8
  <9-10> cmsy9
  <10-> cmsy10}{}

\DeclareSymbolFont{Xcmsy} {U} {cmsy}{m}{n}

\DeclareMathSymbol{\cmemptyset}{\mathord}{Xcmsy}{59}
% =============================================
%\usepackage{fonttable}
\begin{document}
\centering

$\emptyset \cmemptyset$ 

%\tiny\fonttable{cmsy8}
\end{document}

enter image description here

The Short Way (for Computer Modern only):

Because Computer Modern is already loaded by TeX as the default font, much of the prior method is redundant and the answer can be streamlined (as noted by GuM):

\documentclass{article}
\usepackage{mathabx}
% =============================================
\DeclareMathSymbol{\cmemptyset}{\mathord}{symbols}{59}
% =============================================
\begin{document}
\centering

$\emptyset \cmemptyset$ 

\end{document}
8
  • 1
    could you explain the code, please?
    – Dog_69
    Commented Jan 12, 2018 at 19:55
  • @Dog_69 I have done so. Commented Jan 12, 2018 at 20:10
  • I'm sorry. I expected an explanation after the code. Please excuse me. I haven't seen your body text. My apologies.
    – Dog_69
    Commented Jan 12, 2018 at 20:14
  • @Dog_69 I edited my answer after you asked the initial question. No need to apologize. It was a reasonable request. Commented Jan 12, 2018 at 20:23
  • 2
    OK, I’ve seen your edit. But now I feel obliged to add that, of course, this simplified solution works only for a package, like mathabx, that does not redefine the symbols symbol font; for packages that do redefine it (e.g., newtxmath), you need the more elaborate solution \DeclareSymbolFont{cmsymbols}{OMS}{cmsy}{m}{n} \SetSymbolFont{cmsymbols}{bold}{OMS}{cmsy}{b}{n} \DeclareMathSymbol{\cmemptyset}{\mathord}{cmsymbols}{59} (say). But again, there’s no need to redeclare the cmsy font family under a different encoding (U, in your case).
    – GuM
    Commented Jan 13, 2018 at 1:46
4

The answer below is inspired by the way the author of the mathabx package, Anthony Phan, uses to retain the old \emptyset symbol (which he calls \voidset) while loading his mathabx package (see the TeX source of its documentation).

\documentclass{article}
\let\voidset=\emptyset
\usepackage{mathabx}
\let\emptyset=\voidset
\begin{document} 
$\emptyset$   
\end{document}

enter image description here

4
  • Well, why not also \let\emptyset=\voidset, then?
    – GuM
    Commented Jan 13, 2018 at 0:52
  • @GuM No particular reason, excepted I was told once to use as few Plain TeX commands as possible in a LaTeX document. It has become an habit since. :-) But indeed, a second \let does no harm in this case as far as I see, so I've just inserted it. Commented Jan 13, 2018 at 8:28
  • There’s a slight difference in that, with \let\emptyset=\voidset, to token \emptyset remains unexpandable; but this hardly matters in practice.
    – GuM
    Commented Jan 13, 2018 at 9:03
  • @FranckPastor I thought I replied to yor answer. Anyway. It's a clever idea, very funny, and it is a useful. It is not what I was looking for actually, but I'm sure it will help many people in the future. Thanks
    – Dog_69
    Commented Jan 14, 2018 at 19:20
1

\emptyset using package cancel. enter image description here

\documentclass{article}
\usepackage{cancel, amsmath}
\usepackage{amssymb, mathabx} 
\begin{document}
\( \cancel{\bigcirc} \)
\end{document}

You must log in to answer this question.

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