# It is possible to use a diagram in an expression?

I'm watching a video series about category theory, and it shows the following kind of notation on several occasions:

I like taking notes in LaTeX, so I am wondering if there is an easy way to typeset something like this example, in such a way that one might use it inline, like $Set^{Some diagram spec}$. I know TikZ well enough to be able to create diagrams, and I suppose I could produce something like that picture, given enough time, but I'm specifically after a way to create "small diagram notation".

Edit

Amazing! There really isn't much that is impossible! Now, I've got a real problem - I can't decide which answer to accept, since they arell all very good. I think I'll wait a few days and see which one gets most votes. Thank you, everyone!

For such simple cases, you could also build a symbol from simple commands to reproduce the diagram. There are packages with many arrow symbols, like MnSymbol.

Here's a construction of the symbol in your example. The code to import a single symbol from MnSymbol is based on Ulrike Fischer's answer here.

\documentclass{article}
\usepackage{mathtools}
\DeclareFontFamily{U}{MnSymbolA}{}
\DeclareFontShape{U}{MnSymbolA}{m}{n}{
<-6>  MnSymbolA5
<6-7>  MnSymbolA6
<7-8>  MnSymbolA7
<8-9>  MnSymbolA8
<9-10> MnSymbolA9
<10-12> MnSymbolA10
<12->   MnSymbolA12}{}
\DeclareSymbolFont{MnSyA}         {U}  {MnSymbolA}{m}{n}
\DeclareMathSymbol{\lcurvearrowdown}{\mathrel}{MnSyA}{187}
\DeclareMathSymbol{\rcurvearrowdown}{\mathrel}{MnSyA}{195}
\newcommand*{\arrowsdots}{%
\rcurvearrowdown\mkern1mu%
\mathclap{\raisebox{-.65\height}{$$\cdot$$}}%
\mathclap{\raisebox{ .4\height}{$$\cdot$$}}%
\mkern1mu\lcurvearrowdown%
}
\begin{document}
$$\mathrm{Set}^{\arrowsdots}$$
\end{document}


pst-fun is only for fun purposes.

\documentclass[border=3pt]{standalone}
\usepackage{pst-fun}
\def\pst{\raisebox{2pt}{\psscalebox{0.02}{\pspicture(-1,-2)(2,2)\psBill\endpspicture}}}
\begin{document}
$Set^{\pst}$
\end{document}


Something like this?

\documentclass{standalone}
\usepackage{tikz}
%Resize to relative size (em)
%Put the TikZ picture inside a box, just in case
\newcommand{\love}{\resizebox{0.5em}{!}{\hbox{\tikz\draw[fill=red] (0,0) rectangle (1,1);}}}

\begin{document}
$4^{\love}$

\begin{Large}
$4^{\love}$
\end{Large}

\begin{Huge}
$4^{\love}$
\end{Huge}
\end{document}


To actually answer the question, sort of an attempt. If you know TikZ enough, you can play with arrows and dot size.

\documentclass{standalone}
\usepackage{tikz}
\usepackage{amsmath}
\usetikzlibrary{arrows,positioning}
\newcommand{\nicepicture}{%
\begin{tikzpicture}
\node[circle, fill=black,inner sep=0pt,minimum size=.075em] (A) at (0,0){};
\node[circle, fill=black,inner sep=0pt,minimum size=.075em] (B) at (0,.3){};
\draw[->] (B.west) to [bend right=45] (A.west);
\draw[->] (B.east) to [bend left=45] (A.east);
\end{tikzpicture}
}
\newcommand{\myarrows}{\resizebox{!}{.5em}{\hbox{\nicepicture}}}

\begin{document}
$\text{Set}^{\myarrows}$

\begin{Large}
$\text{Set}^{\myarrows}$
\end{Large}

\begin{Huge}
$\text{Set}^{\myarrows}$
\end{Huge}
\end{document}