4

Instead of an arrow from one place to another, I'd like to have the \subseteq symbol. More specifically, the \subseteq symbol rotated, which I believe can be rendered \rotatebox{90}{$\subseteq$} .

 \documentclass[10pt]{amsart}
 \usepackage{tikz}          
\usetikzlibrary{matrix, arrows, decorations.pathmorphing}

\begin{document}
\begin{tikzpicture}
  \matrix (m) [matrix of math nodes,row sep=3em,column sep=4em,minimum width=2em]
 {
   G & H \\
    G/\ker \varphi & \mbox{Im} \varphi \\};     
 \path[-stealth]
(m-1-1) edge node [left] {$q$} (m-2-1)
        edge node [above] {$\varphi$} (m-1-2)   
 edge node [above] {$\hat{\varphi}$} (m-2-2)
(m-2-1) edge node [below] {$\overline{\varphi}$} (m-2-2) ;
\end{tikzpicture}
\end{document}

So, what I'd like to do is instead of having an arrow representing a map from the lower right node to the upper right node, I want the set inclusion symbol to show the relationship between the sets in question.

Thanks!

3
  • 1
    How are \im and \ol defined? Without that your example is not compilable. – Thorsten Donig Sep 7 '13 at 8:21
  • (m-2-2) edge[draw=none] node [sloped] {$\subseteq$} (m-1-2)? By the way, do you know tikz-cd/tikz-cd? – Qrrbrbirlbel Sep 7 '13 at 15:59
  • @Qrrbrbirlbel, that worked perfectly, thanks! I know of tikz-cd, but one of the resources I have been using to make my diagrams mentioned that matrix was more flexible. – Simon Stolarczyk Sep 7 '13 at 16:13
4

Use an edge that is not drawn (or a \path with --) and place a node on that edge/path that is sloped with the content \subseteq.

For comparison, I made the same diagram with tikz-cd.

To your original diagram I added the auto option to make the placement of nodes along the path easier which needs to be disabled again for our special node.

If you want to avoid writing that lengthy

(m-2-2) edge[draw=none]
             node [sloped, auto=false,
              allow upside down] {$\subseteq$} (m-1-2);

you can use a special style that can do this. For tikz-cd a slightly different style can be defined too. See the second code example for this.

Code 1

\documentclass[class=amsart,10pt,tikz]{standalone}
\usepackage{tikz,tikz-cd}
\usetikzlibrary{matrix, arrows}
\DeclareMathOperator{\im}{Im}
\begin{document}
\begin{tikzpicture}
  \matrix (m) [matrix of math nodes,row sep=3em,column sep=4em,minimum width=2em] {
    G & H \\
    G/\ker \varphi & \im \varphi \\
  };
 \path[-stealth, auto] (m-1-1) edge node[swap] {$q$}                  (m-2-1)
                               edge node       {$\varphi$}            (m-1-2)
                               edge node       {$\hat{\varphi}$}      (m-2-2)
                       (m-2-1) edge node[swap] {$\overline{\varphi}$} (m-2-2)
                       (m-2-2) edge[draw=none]
                                    node [sloped, auto=false,
                                     allow upside down] {$\subseteq$} (m-1-2);
\end{tikzpicture}

\begin{tikzcd}
 G               \rar{\varphi} \dar[swap]{q}\drar{\hat\varphi}
   & H \\
 G/\ker\varphi   \rar[swap]{\overline\varphi}
   & \im \varphi \arrow[draw=none]{u}[sloped,auto=false]{\subseteq}
\end{tikzcd}
\end{document}

Code 2

\documentclass[class=amsart,10pt,tikz]{standalone}
\usepackage{tikz,tikz-cd}
\usetikzlibrary{matrix, arrows}
\DeclareMathOperator{\im}{Im}
\makeatletter
\tikzset{
  edge node/.code={%
      \expandafter\def\expandafter\tikz@tonodes\expandafter{\tikz@tonodes #1}}}
\makeatother
\tikzset{
  subseteq/.style={
    draw=none,
    edge node={node [sloped, allow upside down, auto=false]{$\subseteq$}}},
  Subseteq/.style={
    draw=none,
    every to/.append style={
      edge node={node [sloped, allow upside down, auto=false]{$\subseteq$}}}
  }
}
\begin{document}
\begin{tikzpicture}
  \matrix (m) [matrix of math nodes,row sep=3em,column sep=4em,minimum width=2em]{
    G & H \\
    G/\ker \varphi & \im \varphi \\
  };
 \path[-stealth, auto] (m-1-1) edge node[swap] {$q$}                  (m-2-1)
                               edge node       {$\varphi$}            (m-1-2)
                               edge node       {$\hat{\varphi}$}      (m-2-2)
                       (m-2-1) edge node[swap] {$\overline{\varphi}$} (m-2-2)
                       (m-2-2) edge[subseteq]                         (m-1-2);
\end{tikzpicture}

\begin{tikzcd}
 G               \rar{\varphi} \dar[swap]{q}\drar{\hat\varphi}
   & H \\
 G/\ker\varphi   \rar[swap]{\overline\varphi}
   & \im \varphi \arrow[Subseteq]{u}{}
\end{tikzcd}
\end{document}

Output

enter image description here enter image description here

3
  • Great, your answer has taught me far more than I asked. For code 1, why did you add "allow upside down" to the special node? I see how it works for other examples, but here it doesn't seem to change anything. For code 2, what's happening in the first \tikzset? In the second \tikzset, what is the different between Subseteq and subseteq? I can tell "S" is used in tikzcd and "s" is used in tikzpicture. – Simon Stolarczyk Sep 7 '13 at 18:41
  • @SimonStolarczyk When nodes are rotated by sloped they are usually rotated so that they are not upside down. This may confuse readers as the symbol will be oriented in a way that suggests the opposite. See this example: \tikz[nodes=sloped]{\draw[->] (0,0) -- node {$\subseteq$} (-1,1);\draw[->] (1,0) -- node[allow upside down] {$\subseteq$} (0,1);} (So you might still use the arrow and simply place \subseteq above/below it.) The option for an tikz-cd arrow is used as a path option, not as an option to edge/to. This is solved with the every to style. – Qrrbrbirlbel Sep 7 '13 at 18:59
  • What if my arrow is a diagonal arrow (like \arrow{dr}[Subset])? The code works for vertical arrows, but it keeps giving me an error for the diagonal case... – user2154420 Jul 4 '18 at 18:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.