# Inverted exclamation mark in Mathmode

What is the command/package used to give the Inverted exclamation mark in Mathmode. I have tried the following:

\mbox{!}_A - The output is not at the same margin level as !.

\mbox{\textexclamdown}_A -  The output is again not at the same margin level as !.

\rotatebox[origin=c]{180}{!}_A -  The output is at the same margin, and this is what is required. However, I find this too complex for a simple inverted exclamation mark.

• The inverted exclamation mark is traditionally typeset below the baseline. – egreg Jan 23 at 12:52
• @egreg Yes, that is true. However, in my case, I am using it to denote the initial objects in a category, along with the terminal objects (!), and it is looking very weird, if the margin level is not same. – Anuj More Jan 23 at 12:57
• If you want the exclamation mark to be higher and not type so much, then you can define a small macro (before \begin{document}) such as \def\invexcl{\rotatebox[origin=c]{180}{!}} and then use it anywhere in your text like $\invexcl_A$. – Marijn Jan 23 at 12:57
• @Marijn Right now I am using this process. – Anuj More Jan 23 at 13:00

Taking code from https://tex.stackexchange.com/a/312530/4427, here is a version that raises the inverted exclamation mark to sit on the baseline.

\documentclass{article}
\usepackage{amsmath}

\DeclareMathSymbol{\mathinvertedexclamationmark}{\mathclose}{operators}{'074}
\DeclareMathSymbol{\mathexclamationmark}{\mathclose}{operators}{'041}

\makeatletter
\newcommand{\raisedmathinvertedexclamationmark}{%
\mathclose{\mathpalette\raised@mathinvertedexclamationmark\relax}%
}
\newcommand{\raised@mathinvertedexclamationmark}[2]{%
\raisebox{\depth}{$\m@th#1\mathinvertedexclamationmark$}%
}
\begingroup\lccode~=! \lowercase{\endgroup
\def~}{\@ifnextchar{\raisedmathinvertedexclamationmark\@gobble}{\mathexclamationmark}}
\mathcode!="8000
\makeatother

\begin{document}

$n! + n!$

$\scriptstyle n! + n!$

\end{document}


You might want to use \mathord instead of \mathclose throughout, if your symbols are to denote objects of a category. Or, better, define semantic commands.

\documentclass{article}
\usepackage{amsmath}

\DeclareMathSymbol{\mathinvertedexclamationmark}{\mathord}{operators}{'074}
\DeclareMathSymbol{\mathexclamationmark}{\mathord}{operators}{'041}
\makeatletter
\newcommand{\raisedmathinvertedexclamationmark}{%
\mathord{\mathpalette\raised@mathinvertedexclamationmark\relax}%
}
\newcommand{\raised@mathinvertedexclamationmark}[2]{%
\raisebox{\depth}{$\m@th#1\mathinvertedexclamationmark$}%
}
\makeatother

\newcommand{\terminal}{\mathexclamationmark}
\newcommand{\initial}{\raisedmathinvertedexclamationmark}

\begin{document}

$\terminal\to\initial$

\end{document}
`