# Redefine \S - problem with indices

Why are the subscripts placed under the letters and not in the right bottom corner like usual?

\documentclass[a4paper,12pt,twoside]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman,english]{babel}
\usepackage{csquotes}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsthm}
\let\origS\S\renewcommand{\S}{\ifmmode\mathop{\mathsf{S}}\else\origS\fi}
\begin{document}
$$\label{eqn:decS} \S=\S_0 \oplus\S_1 .$$
\end{document}


• Because the \mathop turns the "S" into an operator like \lim and \sum. – moewe Aug 18 at 19:29
• What are you trying to do in the first place? What mathematical object is \S suppose to be. – daleif Aug 18 at 19:34

You need \nolimits to force \mathop not to treat the operator like, for example, \sum.

\documentclass[a4paper,12pt,twoside]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman,english]{babel}
\usepackage{csquotes}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsthm}
\let\origS\S\renewcommand{\S}{%
\relax\ifmmode\mathop{\mathsf{S}}\nolimits\else\origS\fi}
\begin{document}
$$\label{eqn:decS} \S=\S_0 \oplus\S_1 .$$
$\begin{pmatrix}\S\end{pmatrix}$
\end{document}


• Of course the question arises whether we are talking about an operator (in TeX speak, not necessarily mathematically) here in the first place. Maybe \let\origS\S\renewcommand{\S}{\ifmmode\mathsf{S}\else\origS\fi} would be more sensible. – moewe Aug 18 at 19:38
• You should try \begin{pmatrix}\S\end{pmatrix}. – egreg Aug 18 at 20:19
• @egreg Interesting, though given my logo, you can understand that I am not as shocked as I should be. – Steven B. Segletes Aug 18 at 20:36

Assuming your command should be a \mathop, the correct redefinition would be

\renewcommand{\mathsection}{\operatorname{\mathsf{S}}


Redefining \S that way is bound to problems, as \S is a “robust” command.

If it is not an operator, \renewcommand{\mathsection}{\mathsf{S}} would suffice.

You can see the difference in the two examples below (twocolumn used just for making a smaller picture). In (1) the symbol behaves like an operator, in (2) it's an ordinary symbol.

\documentclass[a4paper,12pt,twocolumn]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman,english]{babel}
\usepackage{csquotes}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsthm}

\renewcommand{\mathsection}{\operatorname{\mathsf{S}}}

\begin{document}

$$\label{eqn:decS} \S=\S_0 \oplus\S_1 x.$$

\renewcommand{\mathsection}{\mathsf{S}}

$$\S=\S_0 \oplus\S_1 x.$$

\end{document}