Text mode commands/symbols in math mode

You can define your own symbol:

\documentclass{article}
\usepackage{amsmath}

\DeclareMathSymbol{\subfactorial}{\mathord}{operators}{"3C}

\begin{document}
\begin{equation}
\begin{aligned}
n!=\sum_k h(n,k) &= \sum_k \binom{n}{k}(n-k)\subfactorial\\
  &=\sum_k\binom{n}{k}k\subfactorial
\end{aligned}
\tag{5.49}
\end{equation}
\end{document}

This will work so long as the "operators" font is OT1 encoded. Should it be T1 encoded, change "3C" into "BD (this might depend on your font settings).

The equation (same number) is taken from "Discrete Mathematics", by Graham, Knuth and Patashnik (the original uses Euler fonts, but the result is quite similar).

enter image description here


Your question can be broken down into a few manageable parts.

  1. Any text command can be used in mathmode if you use it as an argument to the \text macro, as in \text{\textexclamdown}.

  2. To have it play the proper role in the spacing of the mathematics, you should embed this in a \mathord macro, as in \mathord{\text{\textexclamdown}}.

  3. Because \mathord{\text{\textexclamdown}} is a bit cumbersome to write, and isn't very suggestive of what you want it to signify, I'd suggest writing a macro for the subfactorial function, similar to

    \newcommand\subfac{\mathord{\text{\textexclamdown}}}
    

    and then use \subfac to represent the subfactorial function. (This way if you decide that you would like to modify how the subfactorial is displayed, you can do it once and all instances of it will get changed.)