4

I am looking to make a diagram with lines similar to this one: Labeling Edges in a Weighted Digraph

But I am trying to have a mathematical formula, which is the label, instead of being above the dot nodes, replace the thick dot nodes. In other words the lines don't actually connect, but like those in commutative diagrams. This method allows location of nodes to be precisely specified, slightly different from tikz-cd.

How?

How to do this in tikz-cd is also helpful.

How does one make the node to label arrows and cutting of arrows by overlapping arrows in this framework?

[ ... question was tidied up after being answered and size of arrowheads and labels question placed in its own question ... My own MWE example moved to that question for those corrections, Changing Size of Arrows, Labels, Loops in Diagrams and Directed Graphs, since the answer has several MWEs that answer original question.]

closed as unclear what you're asking by Joseph Wright May 27 '16 at 11:28

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Have you looked at the amscd package? It is for commutative diagrams. – dustin Aug 10 '13 at 15:27
  • 1
    Might be just as easy to use plain TikZ. Are you familiar with that? – Torbjørn T. Aug 10 '13 at 15:39
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format – texenthusiast Aug 10 '13 at 15:42
  • I am familiar with making simple commuting diagrams using tikz-cd package, but the use of vertexes defined in the way the linked example was written, and curves defined in that way makes my life so much easier with all my nonlinear diagrams, if only I could figure out how to use this coding for commutative style diagrams. – user34902 Aug 10 '13 at 15:54
  • 3
    @user34902 Sorry; this is a place in which we like to keep things tidy; ideally one question per post. I can't be all day editing my answer and adding information every time you come up with new requirements. I think my answer below satisfies your initial requirements; for further issues, please open a fresh new question. – Gonzalo Medina Aug 10 '13 at 21:15
8

Using the powerful tikz-cd package you can easily create commutative diagrams with curved arrows; a little example (the package documentation contains other examples); notice the swap option to change the position of labels:

\documentclass{article}
\usepackage{tikz-cd}

\begin{document}

\begin{tikzcd}[row sep=3cm,column sep=2cm,shorten >= 4pt,shorten <=4pt]
F(x)
  \arrow[bend left=40]{r}{F(f)}[name=UF,below]{}
  \arrow[bend right=40]{r}[swap]{F(g)}[name=DF]{}
  \arrow[bend left=30]{d}{A(x)}[name=D1,below]{}
  \arrow[bend right=30]{d}[swap]{B(x)}[name=D2]{}
& F(y) 
  \arrow[bend left=30]{d}{A(y)}[name=D3,below]{}
  \arrow[bend right=30]{d}[swap]{B(y)}[name=D4]{} \\
G(x)
  \arrow[bend left=40]{r}{G(f)}[name=UG,below]{}
  \arrow[bend right=40]{r}[swap]{G(g)}[name=DG]{}
& G(y) \\
\arrow[Rightarrow,to path=(UF) -- (DF)]{}
\arrow[Rightarrow,to path=(UG) -- (DG)]{}
\arrow[Rightarrow,shorten <=10pt,to path=(D1|-D2) -- (D2)]{}
\arrow[Rightarrow,shorten <=10pt,to path=(D3|-D4) -- (D4)]{}
\end{tikzcd}

\end{document}

enter image description here

Addendum: After the edit to the question:

You can still use "pure" TikZ in combination to tikz-cd; this gives you the possibility to achieve manual positioning (as was required) as well as to have consistency with the arrow and label style from tikz-cd.

For the crossing over edges, tikz-cd offers the crossing over style for \arrow (see first example below) and TikZ offers also mechanisms to achieve the same effect (second example below):

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}

\begin{document}

\begin{tikzcd}[row sep=scriptsize, column sep=scriptsize]
& f^* E_V \arrow{dl}\arrow{rr}\arrow{dd} & & E_V \arrow{dl}\arrow{dd} \\
f^* E \arrow[crossing over]{rr}\arrow{dd} & & E \\
& U \arrow{dl}\arrow{rr} & & V \arrow{dl} \\
M \arrow{rr} & & N\arrow[crossing over, leftarrow]{uu}\\
\end{tikzcd}


\begin{tikzpicture}[commutative diagrams/every diagram]
\node (P0) at (90:2.8cm) 
  {$X\otimes (Y\otimes (Z\otimes T))$};
\node (P1) at (90+72:2.5cm) 
  {$X\otimes ((Y\otimes Z)\otimes T))$} ;
\node (P2) at (90+2*72:2.5cm) 
  {\makebox[5ex][r]{$(X\otimes (Y\otimes Z))\otimes T$}};
\node (P3) at (90+3*72:2.5cm) 
  {\makebox[5ex][l]{$((X\otimes Y)\otimes Z)\otimes T$}};
\node (P4) at (90+4*72:2.5cm) 
  {$(X\otimes Y)\otimes (Z\otimes T)$};
\begin{scope}[commutative diagrams/.cd, every arrow, every label]
\draw (P0) to[bend right] node[swap] {$1\otimes\phi$} (P1);
\draw (P1) to[bend right] node[swap] {$\phi$} ([xshift=-15pt]P2.north west);
\draw ([xshift=-10pt]P2.south west) to[bend right] node[swap] {$\phi\otimes 1$} ([xshift=15pt]P3.south east);
\draw ([xshift=25pt]P3.north east) to[bend right] node[swap] {$\phi$} (P4);
\draw (P4) to[bend right] node[swap] {$\phi$} (P0);
\draw (P0) to[bend left=60] ([xshift=-20pt]P2.north);
\end{scope}
\draw[white,-,line width=8pt] (P1) to[bend left] ([xshift=25pt]P3.north);
\begin{scope}[commutative diagrams/.cd, every arrow, every label]
\draw (P1) to[bend left] ([xshift=25pt]P3.north);
\end{scope}
\end{tikzpicture}

\end{document}

enter image description here

For the other requirement (an arrow from a node to a label placed on an arrow between to other nodes), a little example (again, swap was used to change the label position):

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}

\begin{document}

\begin{tikzpicture}[commutative diagrams/every diagram]
\node (a) at (0,0)  {A};
\node (b) at (3,0) {$B$} ;
\node (c) at (0,-3) {$C$};
\begin{scope}[commutative diagrams/.cd, every arrow, every label]
\draw (a) to[bend right] node[swap] (aux) {$f$} (b);
\draw (c) to[bend right] node[swap] (aux) {$g$} (aux);
\end{scope}
\end{tikzpicture}

\end{document}

enter image description here

  • This is very helpful! I've posted another minimal example combining several commands to get similar results, that I came to earlier but posted after you already edited your answer. For the example you posted, node to label arrow, I see this depends on order in which arrows are drawn, yes? Can you advise how to do this in the example I posted in the edited question? – user34902 Aug 10 '13 at 21:42
0

I would suggest to use the package gastex (part of the standard distribution). See http://www.lsv.ens-cachan.fr/~gastin/gastex/ for more details.

Look in particular at these two examples to test whether gastex would suit your needs.

http://www.lsv.ens-cachan.fr/~gastin/gastex/diagram.html

http://www.lsv.ens-cachan.fr/~gastin/gastex/more.html

  • I am getting good success with tikzpicture now. This way I can specify which node connects where. Working from tex.stackexchange.com/questions/56743/… Can this sort of thing be done in tikz-cd, and what about drawing arrows going from a node to a label or changing side of arrow on which label is shown? – user34902 Aug 10 '13 at 17:38
  • 1
    @user34902 all things you mention in your comments can be done with tikz-cd. Wouldn't it be better if you edit your question adding exactly what are you trying to achieve? – Gonzalo Medina Aug 10 '13 at 17:58

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