# The space before \DeclareMathOperator'ed operator

The code

\documentclass{article}
\usepackage{amsmath}

\begin{document}
The quotient $A/\rad A$ is hopefully semisimple
\end{document}


results in

and the spacing between the solidus and the rad is killing me. Is there a way to make operators get a more sensible spacing in that context?

• Probably use A/{\rad A} Sep 30 at 7:15
• Well, yup, that does certainly work. I had something more automagical in mind :-) If one replaces the / by a \mathbin/ it does get set symmetrically. Can one simply change the class of / in a document and nothing breaks? Sep 30 at 7:17
• I think that would break more than it will help. Perhaps better to make a \quotient{A}{\rad A} macro and have it appy {...} to the second argument. Sep 30 at 7:45
• the problem is not \rad it is / it is \mathord like x because 1/2 gets spaced like 1/2 not 1 / 2 so A/\rad A is spaced like Ax\rad A and gets a space before the \mathop \rad Sep 30 at 7:54
• @Gaussler While doing A/\!\rad A (or with the braces) is sensible, it's disputable whether it should be applied to x/\log y, depending on the font used and the slant of the slash. In the particular case, defining \newcommand{\qrad}[1]{#1/\!\rad#1} would be the best solution. Sep 30 at 9:01

You can define a slash that uses \mathopen so it does not have space before a \mathop. I would use a specfic command, but you can use \mathcode"8000 to define / this way if you want

\documentclass{article}
\usepackage{amsmath}
\mathchardef\origslash\mathcode\/
\newcommand\mslash{\origslash\mathopen{}}

\begin{document}

$1 \mslash 2$

$1 \mslash \rad x$

$1 \mslash \log y$

$1 \mslash (a+b)$

{\catcode\/=\active\global\let/\mslash}
\mathcode\/="8000

$2 / 2$

$2 / \rad x$

$2 / \log y$

$2 / (a+b)$
\end{document}

• Your idea is much more better and simpler.:) Sep 30 at 9:12
• @wipet you forgot to add "as always with latex" :-) Sep 30 at 9:15
• Wouldn't it be easier to \DeclareMathSymbol{/}{\mathopen}{letters}{"3D}? That doesn't require active characters and only changes spacing in combinations that are not really relevant for normal typesetting (like /+, /=, /\left, \sin/). Sep 30 at 9:15
• Do you see something LaTeX specific in your answer? Sep 30 at 9:18
• @HenriMenke easier but mathopen would change the space before / admitedly only for \mathop, did consider that... Sep 30 at 9:18

If you don't want to do "replace all" in your editor, you can try following macros which redefines behavior of the / character in math mode:

\def\specslash{\mathchar/\futurelet\next\specslashA}
{\catcode/=13 \global\let/=\specslash}
\mathcode\/="8000

• This could get very technical once you start to use other operators than \rad, too. I think the only really usable solution would be one that checks if the next token has class “operator”. Is there a way to do that? Sep 30 at 8:45
• \hbox{/} will pick the glyph from the wrong font. Maybe better to use \mathchar/? Sep 30 at 8:51
• OK, using \mathchar is better. Thanks. Sep 30 at 8:56

You might try the split fraction from xfrac:

\documentclass{article}
\usepackage{amsmath}
\usepackage{xfrac}

The quotient $\sfrac{A}{\rad A}$ is hopefully semisimple