3

I want to use small pictures of finite categories in my math-formulas. For example I want to produce something that looks like $C^{\bullet \rightrightarrows \bullet}$ or $C^{\bullet \quad \bullet}$ but works also for other small shapes such as the one below.

What is the best way to make this happen?

Edit. Somehow the LaTeX in my question does not render, so here is a picture of how I want it to look like. Ideally it should be not to big so that it can work inside text.

JamesT
  • 3,169
Nico
  • 145
  • 5
    The LaTeX in your question isn't supposed to render. We need to see what your source code is and not how some JavaScript render interprets it (very different to what and how TeX might do it). Pictures are usually important if it comes to visuals. – Qrrbrbirlbel May 22 '23 at 14:43
  • @Qrrbrbirlbel Okay! I care most about that it looks roughly like the picture below, but with the other diagram above. I tried to make tikz-cd pictures very small and put them into the exponent as in $C^{some tikz-code}$ but it only gave me error-messages. – Nico May 22 '23 at 14:50
  • Since you tagged it [tag:tikz-cd] … tikz-cd would be a way to draw it. It also has a cramped style but it might be wort to look into an alternative definition of it. – Qrrbrbirlbel May 22 '23 at 14:55

2 Answers2

7

Adjusting the cramped* style from another answer of mine to be even tighter and adding a supercramped style with even smaller distances.

(You don't need to use the width function measuring the size of element in math-mode, you can just use any dimension directly, even those dependent on the font size (em and ex).)

The \mtikzcd macro makes it so that you can keep using & inside the macro. amsmath's \text macro is used to provide somewhat of a scaling according to the surrounding math-style.

Code

\documentclass{article}
\usepackage{amsmath, tikz-cd}
\tikzcdset{
  /tikz/bullet/.style={shape=circle, fill, inner sep=+.13em, yshift=axis_height},
  cramped*/.style={
    arrows=overlay, /tikz/arrows={[scale=.6]}, line cap=round,
    every matrix/.append style={
      every outer matrix/.append style={inner sep=+0pt}},
    every cell/.append style={inner sep=+0pt, outer sep=.5*width("$\;$")},
    column sep/.evaluated=.75*width("${}\to{}$"),
    row sep/.evaluated=.75*width("${}\to{}$")},
  supercramped/.style={
    cramped*,  cells={outer sep=.25*width("$\;$")},
    column sep/.evaluated=.5*width("${}\to{}$"),
    row sep/.evaluated   =.5*width("${}\to{}$")}}
\newcommand*\mtikzcd[1][]{%
  \begingroup
    \let\texbullet\bullet % store old definition
    \def\bullet{|[bullet]|}% overwriting
    \catcode`\&=\active\mmtikzcd{#1}}
\newcommand*\mmtikzcd[2]{%
  \text{\begin{tikzcd}[cramped*,#1]#2\end{tikzcd}}\endgroup}
\begin{document}
\[
  A^{\mtikzcd{\texbullet \rar[shift left] \rar[shift right] & \texbullet}}
\]

[ B^{\mtikzcd{\bullet \rar[shift left] \rar[shift right] & \bullet \rar & A}} ]

[ C^{\mtikzcd[supercramped]{ & \bullet \dar \ \bullet \rar & \bullet}} ] \end{document}

Output

enter image description here

Qrrbrbirlbel
  • 119,821
3

Like this:

enter image description here

\documentclass{article}
\usepackage{lipsum}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, positioning}
\tikzset{dot/.style = {circle, fill, inner sep=1pt},
         arr/.style = {-{Straight Barb[scale=0.8]}, shorten > = 1pt, shorten <=1pt}
         }

\begin{document} \lipsum[1][1-1] Image \tikz[node distance = 3mm and 3mm, baseline=0.9ex]{ \node[dot] (a) {}; \node[dot,right=of a] (b) {}; \node[dot,above=of b] (c){}; \draw[arr] (a) -- (b); \draw[arr] (c) -- (b);} shows \dots \lipsum[1][2-3] \end{document}

Zarko
  • 296,517