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}
\begin{equation}\label{eqn:decS}
\S=\S_0 \oplus\S_1 .
\end{equation}
\end{document}

enter image description here

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

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}
\begin{equation}\label{eqn:decS}
\S=\S_0 \oplus\S_1 .
\end{equation}
\[
\begin{pmatrix}\S\end{pmatrix}
\]
\end{document}

enter image description here

  • 2
    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}

\begin{equation}\label{eqn:decS}
\S=\S_0 \oplus\S_1 x.
\end{equation}

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

\begin{equation}
\S=\S_0 \oplus\S_1 x.
\end{equation}

\end{document}

enter image description here

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.