In TeX, how is a “computing zero” sign written, with a slanted vertical line through it?
3 Answers
It depends exactly what you mean by "computer zero." I'd guess you mean a slashed zero in a monospaced font; you can obtain this by choosing a font that has a slashed zero in its \texttt series and writing $\texttt 0$; for example, Anonymous Pro will work by adding this to your preamble:
\usepackage[T1]{fontenc}
\usepackage[ttdefault=true]{AnonymousPro}
Alternatively, if you want a symbol for the empty set, try \emptyset or \varnothing using the amssymb package.
Here's a comparison of all three:
Here's the code I used, showing the packages you need.
\documentclass{standalone}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[T1]{fontenc}
\usepackage[ttdefault=true]{AnonymousPro}
\begin{document}
\verb+\emptyset+: $\emptyset$
\verb+\varnothing+: $\varnothing$
\verb+\mathtt O+: $\texttt 0$
\end{document}
- 198,882
- 7,126
- 2
- 30
- 54
-
I just realised that your picture already included the slashed zero, but I missed it because it was in with the empty sets. If you want to delete my additional image, feel absolutely free to do so. – cfr Aug 04 '17 at 01:30
-
Might be worth adding a link to the LaTeX Font Catalogue Typewriter Fonts page to make it easier to search for other fonts that have a slashed zero. – Nicola Talbot Aug 04 '17 at 11:03
The cfr-lm package extends Latin Modern with a few symbols such as the slashed zero:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{cfr-lm}
\pagestyle{empty}
\begin{document}
o 0 (0) {\zeroslash} O Ø (\Theta)
\end{document}
A few other legacy NFSS packages also contain this symbol.
The fontspec package supports the OpenType slashed-zero font feature, so you can use this with any font that has the feature. You can check whether a given font does with otfinfo -f /path/to/some-file.otf
\documentclass{article}
\usepackage{fontspec}
\usepackage{unicode-math}
\setmainfont{Latin Modern Roman}
\newcommand\zeroslash{{\addfontfeature{Numbers=SlashedZero}0}}
\pagestyle{empty}
\begin{document}
o \oldstylenums{0} \liningnums{0} {\zeroslash} O Ø (\symup\Theta)
\end{document}
I’m afraid Barbara Beeton will not like the shape of the old-style 0 and the lowercase o in Latin Modern.
- 44,045
-
People interested in this problem may be interested in (or amused by) the article "Oh, oh, zero", by Charles Bigelow, in TUGboat 34:2. – barbara beeton Jun 14 '20 at 02:59
-
Is that really an oldstyle zero? The shape that I'm used to is usually a monoline circle, to distinguish it from a lowercase "o" and this looks very like the lowercase "o". (Granted, I'm referring to the traditional metal type form of the digit.) – barbara beeton Jun 14 '20 at 03:03
-
@barbarabeeton Great article! And that is the glyph for oldstyle zero in Latin Modern Roman. – Davislor Jun 14 '20 at 03:10
-
Yes, that article was such fun to edit! But the shape of the oldstyle zero does distress me. Can you update your answer to show also the lowercase "o"? If those two characters can't be told apart easily, that could cause a lot of trouble in some questionable contexts. (Not as much, one hopes, as not distinguishing between feet and meters, but ...) – barbara beeton Jun 14 '20 at 03:15
-
-
@barbarabeeton Hmmm, the small oh and the oldstyle zero are so hard to tell apart. Maybe if we added a slash ...? – Davislor Jun 14 '20 at 03:21
-
The following command overlaps any two symbols, can be used with a regular O and / to product 0:
\rlap{0}/
- 101




\emptyset. – Bernard Apr 05 '16 at 15:38\emptysetis defined in basic tex with the shape "slashed zero". the methods for identifying symbols mentioned in How to look up a symbol or identify a math alphabet? are all good. detexify identified the likely possibilities immediately, even with my wretched handwriting. – barbara beeton Apr 05 '16 at 16:06