4

I use \mathcal S^\complement as the notation of complements. However, I need to flip the \complement symbol to make the anticomplement symbol. If I only use \rotatebox, the size of the anticomplement will be bigger than the complement symbol, but if I add \scalebox{0.75}{...}, the thickness of the anticomplement symbol will change. Are there any ways to fix this problem?

\newcommand{\anticomplement}{\scalebox{0.75}{\rotatebox[origin=c]{180}{$\complement$}}}

...

$\mathcal S^\complement$, $\mathcal S^{\anticomplement}$

enter image description here

E. Huang
  • 201
  • 1
    If you want to mimic the \complement with reflected \anticomplement, use \reflectbox{} with prepended \scriptstyle, e.g. \newcommand{\anticomplement}{\reflectbox{$\scriptstyle\complement$}} – Celdor Sep 30 '22 at 16:20

2 Answers2

4

The problem is that the content of \rotatebox doesn't realize it is supposed to be in \scriptstyle. So your unscaled version is making a \textstyle symbol. The solution is to place $\scriptstyle\complement$ inside the \rotatebox.

enter image description here

\documentclass{article}
\usepackage{amssymb, graphicx}

\newcommand{\anticomplement}{\rotatebox[origin=c]{180}{$\scriptstyle\complement$}}

\begin{document} $\mathcal S^\complement$, $\mathcal S^{\anticomplement}$ \end{document}

Note that you could also use

\newcommand{\anticomplement}{\reflectbox{$\scriptstyle\complement$}}
Sandy G
  • 42,558
  • 1
    Probably one should define it using mathchoice? While I don't see the command used in display (and probably not text) styles, it will potentially be used in scriptscript style. – Willie Wong Sep 30 '22 at 03:21
  • @WillieWong: Might be better just to define \newcommand{\smallanticomplement}{\reflectbox{$\scriptscriptstyle\complement$}} for that usage, e.g., F_{\mathcal S^{\smallanticomplement}}. – Sandy G Sep 30 '22 at 03:56
2

A simple application of \mathpalette.

\documentclass{article}
\usepackage{amsmath,amssymb,graphicx}

\makeatletter \newcommand{\anticomplement}{{\mathpalette\anticomplement@\relax}} \newcommand{\anticomplement@}[2]{% \reflectbox{$\m@th#1\complement$}% } \makeatother

\begin{document}

[ \mathcal{S}^{\complement}\mathcal{S}^{\anticomplement} x^{y^{\anticomplement}}\anticomplement ]

\end{document}

I added a pair of braces in case ^\anticomplement slips in.

Note that \mathcal{S} is the correct syntax. For the particular case \reflectbox is much simpler than \rotatebox.

enter image description here

egreg
  • 1,121,712