4

The code

\documentclass{article}
\usepackage{amsmath}

\DeclareMathOperator\rad{rad}

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

results in

enter image description here

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?

8
  • Probably use A/{\rad A}
    – daleif
    Commented Sep 30, 2022 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? Commented Sep 30, 2022 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.
    – daleif
    Commented Sep 30, 2022 at 7:45
  • 1
    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 Commented Sep 30, 2022 at 7:54
  • 2
    @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.
    – egreg
    Commented Sep 30, 2022 at 9:01

3 Answers 3

5

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

enter image description here

\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator\rad{rad}
\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}
13
  • Your idea is much more better and simpler.:)
    – wipet
    Commented Sep 30, 2022 at 9:12
  • 2
    @wipet you forgot to add "as always with latex" :-) Commented Sep 30, 2022 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/). Commented Sep 30, 2022 at 9:15
  • Do you see something LaTeX specific in your answer?
    – wipet
    Commented Sep 30, 2022 at 9:18
  • @HenriMenke easier but mathopen would change the space before / admitedly only for \mathop, did consider that... Commented Sep 30, 2022 at 9:18
2

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}
\def\specslashA{\ifx\next\rad \mskip-\thinmuskip \fi}
{\catcode`/=13 \global\let/=\specslash}
\mathcode`\/="8000
3
  • 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?
    – Gaussler
    Commented Sep 30, 2022 at 8:45
  • 3
    \hbox{/} will pick the glyph from the wrong font. Maybe better to use \mathchar`/? Commented Sep 30, 2022 at 8:51
  • OK, using \mathchar is better. Thanks.
    – wipet
    Commented Sep 30, 2022 at 8:56
0

You might try the split fraction from xfrac:

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

\DeclareMathOperator\rad{rad}

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

Computer Modern font sample

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .