3

In TeX, how is computing zero sign written with slanted vertical line on it?

4

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}

slashed zero

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:

enter image description here

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}
| improve this answer | |
  • 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 4 '17 at 1: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 4 '17 at 11:03
1

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}

Latin Modern font sample

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}

Latin Modern font sample

I’m afraid Barbara Beeton will not like the shape of the old-style 0 and the lowercase o in Latin Modern.

| improve this answer | |
  • 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 at 2: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 at 3:03
  • @barbarabeeton Great article! And that is the glyph for oldstyle zero in Latin Modern Roman. – Davislor Jun 14 at 3: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 at 3:15
  • @barbarabeeton For you? Certainly. – Davislor Jun 14 at 3:20

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.