Don't reinvent the wheel. ;-)
\documentclass{article}
\usepackage{centernot}
\begin{document}
$\centernot{\infty}$
\end{document}
Some manual adjusting can help:
\documentclass{article}
\usepackage{centernot}
\begin{document}
$\centernot{\mkern-0.35mu\infty}\mkern-0.35mu$
\end{document}
Finding the exact geometric center is not really easy, because it depends on the side bearings of the symbol. Here's a picture showing them
Also the slash has side bearings, so it's a question of balancing them.
Of course, when you're satisfied with the positioning, you can define
\newcommand{\cinfty}{\mathrel{\centernot{\mkern-0.35mu\infty}\mkern-0.35mu}}
A different version that uses the slash rather than \not
(and my favorite tool \ooalign
).
\documentclass{article}
\makeatletter
\newcommand{\cinfty}{\mathrel{\mathpalette\do@cinfty\relax}}
\newcommand{\do@cinfty}[2]{%
\vphantom{/}%
\ooalign{\hidewidth$\m@th#1/$\hidewidth\cr$\m@th#1\infty$}%
}
\begin{document}
$A\cinfty B_{\cinfty}$
\end{document}
Best Answer
Below, I have defined a macro
\labelrel
that I believe should do what you want. It takes two arguments of which the first is the (relation) symbol you would like to label and the second is a label name. The labels are incremented automatically and you can refer to them using\eqref
as if they were equations.A few remarks:
I'm using letters instead of numbers to avoid any clashes with equation numbers. To use numbers, replace (both instances of)
\alph
by\arabic
above.The labels start with (a) in every equation. If you don't want this you should remove the
\everydisplay
line. If you want the numbering to start over at the beginning of every section you should use\newcounter{relctr}[section]
.It is also possible to refer to the relations in equation (1) as (1a), (1b), etc without changing their tags. This is accomplished by replacing the
\therelctr
line by\renewcommand*\therelctr{\theequation\alph{relctr}}
. It does mean that every equation that has labelled relations must be numbered.I'm storing the definition of
\label
in\originallabel
becauseamsmath
redefines the\label
macro inside equations. I do this\AtBeginDocument
in case any packages (likehyperref
) loaded after this code change the definition.I'm using
\mathstrut
(which is equivalent to\phantom(
) to ensure that every label is placed at the same height, independent of the height of the relation it is decorating. You can remove it if you don't like this.\begingroup
and\endgroup
limit the scope of the effect of\refstepcounter
. Without them it would no longer be possible to reference the equation itself.