10

I've tried to set

\newcommand{\SS}{\mathcal{S}}

in the preamble but I've discovered that this command is already defined.

So, I tried native command on my code and I've found that it is a "simple" double S.

Now, I can fix my problem using

\renewcommand{\SS}{\mathcal{S}}

but I'm not sure it is safe (I don't know if \SS is used by LaTeX only to draw a (simple or special) double S, or for something else too).

Does someone know if it is safe (or when it isn't safe) to do a “renewcommand” of \SS?

Anderson
  • 2,333
  • 4
  • 17
  • 19
Corrado
  • 371

3 Answers3

7

If you want to see, what a command is used for, you can use the \show macro:

% arara: pdflatex

\documentclass{article}

\begin{document}
%\show\cS
\show\SS
\end{document}

This will show:

\SS=macro:
->\T1-cmd \SS \T1\SS .
l.7 \show\SS

Ok, this information is not so cool, but you can see that is has something to do with the T1 encoding and you see that it is used as a macro. Googling the same macro will easily result in the definition (the German upper-case sz-letter). The command \cS as recommended in the comments results in:

\cS=undefined.
l.6 \show\cS

and thus is safe to be used.

Egor Hans
  • 249
LaRiFaRi
  • 43,807
  • 3
    You can do \expandafter\show\csname T1\string\SS\endcsname or also texdef -t latex -p[T1]fontenc T1\\SS from the command line, which would reveal that \SS ultimately does \char"DF (slot "DF=223 in the T1 encoded fonts indeed contains an “SS” glyph). – egreg Jul 15 '14 at 11:40
  • Thanks, you may add that to my answer if you want. Still, this is kind of easier... ;-) – LaRiFaRi Jul 15 '14 at 11:49
4

Concerning the safety of re-defining command \SS (which is the capital of "ß") in order to shorten the command \mathcal{S}, @egreg said:

"Not really safe: your bibliographic data might contain a ß that in turn might be capitalized: the final result would be at least puzzling."

That is definitely true, so I've decided to follow the suggestion given by @PrzemysławScherwentke:

"And what about the name \cS, as calligraphic S? In standard LaTeX it is not defined."

In fact \cS command, as is shown by @LaRiFaRi (and by \show\cS), is safe:

\cS=undefined.
l.6 \show\cS

Thank you all: I change my code from \renewcommand{\SS}{\mathcal{S}} to \newcommand{\cS}{\mathcal{S}}.

Corrado.

cgnieder
  • 66,645
Corrado
  • 371
  • 1
    \mathcal{S} surely has some specific meaning in you document? Maybe a macro name reflecting that meaning would be the best choice altogether... – cgnieder Jul 15 '14 at 13:51
  • Mainly I've used \cB (ex \BB) for a "basis of a topology" and \cS for a "sub-basis", but in some other places of my thesis i've used \mathcal{S} (or \mathcal{B}) for other "general but locally-special" sets, so I've prefered a neutral name for these commands (instead of \mathcal{N}, wich I have named \baire, according with your suggestion). – Corrado Jul 15 '14 at 14:13
  • Personally I'd prefer \newcommand*\basis[1]{\mathcal{#1}} and \newcommand*\subbasis[1]{\mathcal{#1}} and then maybe \newcommand*\sbS{\subbasis{S}} or using \subbasis{S} directly, similar for other meanings... :) I like it if my source reflects what I mean not what it looks like when typeset. – cgnieder Jul 15 '14 at 14:22
  • I'm not "stable" in such opinion yet... in some moment I agree with you and set beautifull and meaningfull code...but a moment later I think: "I can only write \mathcal{S}...is it necessary to create a macro?!...and three macros?!" sometimes my answer is yes, someothers is no :-) – Corrado Jul 15 '14 at 15:16
  • Old thread. For what it's worth, I use \cA for \mathcal{A}, \bA for \mathbb{A}, \fA for \mathfrak{A}. It's short, extensible, and easy to remember from project to project. I don't think long macro names you'll use all the time are sustainable, even if they preserve semantic meaning. – Joshua P. Swanson Jun 28 '20 at 21:57
0

No, it isn't safe.

\SS may come from a transformation of \ss (lowercase ß) to uppercase in a running headline. When you redefine it, and by bad chance a German sharp s is in your chapter or section title, the running headline may have an unexpected look. Followup errors like "missing $ inserted" may occur too, depending on your re-definition of \SS.