172

I feel like the standard $\emptyset$ is ugly. By hand, my empty set symbol is a lot rounder, then this "slashed-zero"-type symbol.

Two questions:

  • Do people really use it (I mean people who have any sort of sense of aesthetics)?
  • What alternatives do you suggest?

I seem to recall something closer to what I'm looking for - a slash round-o - but the diameter of the circle seemed too small, I think. (And am I asking this in the right place?)

  • 9
    I use \emptyset and don't like \varnothing, which is more a symbol for plumbers than mathematicians. :) Michael's advice is pretious: \renewcommand{\emptyset}{...} or \let\emptyset\???, so that you can easily change your mind. – egreg Jul 11 '11 at 20:04
  • 3
    Regarding first question. Go to LaTeX Search and search for \emptyset. You'll get ~1000 docs using it (it is possibly a search limit), so I dare to say it is used. – przemoc Jul 11 '11 at 20:08
  • 1
    egreg: tomayto, tomawto ;-) – Jérémie Jul 11 '11 at 22:38
  • 1
    przemoc: you don't account for poor taste (said jokingly - mostly!). – Jérémie Jul 11 '11 at 22:39
  • 3
    @Jérémie: If you want to reach particular commentator, i.e. be sure it will be notified about it, you have to precede username (at least using 3 first unambiguous characters) with @. Read details regarding it. BTW here I didn't have to address you directly, as you're the OP, so you would be notified anyway. – przemoc Jul 12 '11 at 8:14
191

Try \varnothing from the amssymb package. It is perfectly round, and the comprehensive LaTeX symbol list states that it is preferred by many to \emptyset.

\documentclass{article}

\usepackage{amssymb}

\let\oldemptyset\emptyset
\let\emptyset\varnothing

\begin{document}
$\oldemptyset$ $\emptyset$
\end{document}

enter image description here

  • 1
    Thank you very much, it's exactly the answer that I was looking for. – Jérémie Jul 11 '11 at 22:39
  • 56
    Can we all agree that \phi and \Phi should never be used for this? Argh! ;-) – Colin Fraizer Jul 30 '11 at 8:54
  • 4
    @ColinFraizer I can't believe it. Do people seriously use Phi for empty set? Shocking! – Alfredo Hernández May 16 '13 at 15:22
  • 11
    Just wait until someone sees \phi and doesn't understand it's meant to be "empty set", and uses \varphi in his own documents. My engineering textbook was a nightmare. – Lazar Ljubenović Dec 1 '13 at 11:22
  • 9
    @AlfredoHernández Unfortunately, yes. In the wild… (video should start at 4:03; offending statement at 4:17). – wchargin Nov 11 '14 at 18:44
11

I always just use "\O" in math mode:

$\O$

enter image description here

  • 4
    @ArunDebray, this must be what you're referring to: LaTeX Warning: Command \O invalid in math mode on input line 1006. I have so many warnings in my thesis document I don't even notice unless the output halts. Output does look fine though. – freb Mar 20 '16 at 21:41
  • 8
    @freb Ignoring LaTeX warnings is a way to disaster... – yo' Jan 25 '17 at 18:28
  • 2
    Note that Ø (aka \O) is the true origin of the symbol (see this answer ). To avoid the warnings, you can use the amsmath package and \text{\O} (or \text{Ø} if you use latin1 or utf8 encoding, plus a keyboard giving access to this letter). If you tired to type \text everywhere, \newcommand is your friend – Frédéric Grosshans Jul 17 '17 at 14:59
  • 1
    IMHO, still the sexiest empty set on this page. – freb Jan 27 '18 at 7:07
  • 1
    @yo' meh, I'm sure it depends on your use case. I wrote a 50+ page thesis with a million compiler errors but the resulting pdf was exactly what I wanted. So do I spend a few hours just to get clean compiler output? Do we serve the compiler or does it serve us? – eficker Apr 21 at 15:43
4

I find that { } (\{\} in LateX) is perfectly clear to mathematicians, maybe not to computer scientists. I would use the following:

enter image description here

This is obtained with

\usepackage{algorithm}
\usepackage{algpseudocode}
\begin{document}
\begin{algorithm}[H]
    \begin{algorithmic}[1]
    \State $myset \gets \{\}$
        \For{$i = 0\, \textbf{to}\, 4$}
            \State {$myset\gets myset\, ||\, (4 - i)$}\Comment{append $i$-th reversed index}
        \EndFor
    \end{algorithmic}
\end{document}

Using \emptyset would give

enter image description here This is obtained with

\begin{algorithm}[H]
\begin{algorithmic}[2]    
    \State $myset \gets \emptyset$
        \For{$i = 0\, \textbf{to}\, 4$}
            \State {$myset\gets myset\, ||\, (4 - i)$}\Comment{append $i$-th reversed index}
        \EndFor
    \end{algorithmic}
\end{algorithm}
  • 8
    Why would computer scientists shun from {}. Most are fluent in some programming language(s), and that's the most common syntax for an empty collection. I always figured it would be the other way around. – Neowizard Jan 6 '17 at 8:50
3

The \diameter is an alternative for emptyset in lines, it is a bit tiny.

\usepackage{wasysym}
\emptyset\diameter

emptyset vs diameter

  • 1
    diameter is another symbol, which is intended for ... diameters in mechanical engineering, plumbing, etc. – Frédéric Grosshans Jul 17 '17 at 10:54

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.