Is there a slashed zero symbol in the standard LaTeX font that's accessible with pdflatex et al? I greped through the comprehensive symbols list a bit but didn't spot anything.
In XeLaTeX I can use the OpenType feature +zero
on supported fonts. For instance, with Calluna by Exljbris I can do something like this:
\documentclass{minimal}
\usepackage{fontspec}
\newcommand*{\defaultfontfamily}{Calluna}
\setmainfont[Mapping=tex-text]{\defaultfontfamily}
\newcommand*{\lnum}[1]{{\fontspec[RawFeature={+lnum}]{\defaultfontfamily}#1}}
\newcommand*{\zero}[1]{{\fontspec[RawFeature={+zero}]{\defaultfontfamily}#1}}
\newcommand*{\zerolnum}[1]{{\fontspec[RawFeature={+lnum,+zero}]{\defaultfontfamily}#1}}
\begin{document}
0\zero{0}\lnum{0}\zerolnum{0}
\end{document}
and get a few different types of zero:
However, I'd love to find a way to do this in non-OpenType supporting LaTeX engines.
P.S. \(\emptyset\)
, \(\slashed{0}\)
, and the like don't count. I'm mostly interested in text mode, but if you have a solution for text mode and math mode that would be nice too. Also, before someone says it, \o
and \O
are letters, not numbers. They don't count either!
Best Answer
The following example defines poor man's versions of a zero with dot (
\pmzerodot
) and slash (\pmzeroslash
).Remarks for
\pmzerodot
:\cdot
is used as the dot. Normally it is placed on the math axis that does not have to be the vertical middle of the digit zero. Therefore the height of the digit is measured and the dot is placed in the middle.\cdot
is used in math mode. This makes a visible difference for bold text fonts. If the font series (\f@series
) starts withb
, then\mathversion{bold}
is used for the dot.Remarks for
\pmzeroslash
:Example file:
Remarks:
The symbols are wrapped in
\nfss@text
. It is defined by the LaTeX kernel as\mbox
inside a group. Packageamstext
(loaded byamsmath
) redefines it as\text
that allows that the symbols can be automatically resized in math mode.\ooalign
only keeps the height of the first line and the depth of the final line.\vphantom
is inserted to get the correct overall height and depth of the symbol.\m@th
avoids additional horizontal spacing, if\mathsurround
is used.The height of the math axis is available by the height of an empty
\vcenter{}
.