2

enter image description here

I want to get the above diagram in Latex, but I don't know how to edit it. Any help will be appreciated. I am trying to construct this diagram in the following way, but I don't know how to let them be one diagram.

\begin{align}
\xymatrix{
  f  \ar[dr]_{*}
                &  &    g \ar[dl]^{*}    \\
                & f^{'}        \\
     g  \ar[dr]_{*}
                &  &    h \ar[dl]^{*}    \\
                & h^{'}              }
\end{align}
  • 2
    Can you post your best effort so far? Some people on this site prefer to help people who demonstrate a willingness to do some of the work themselves before they help people who ask simply 'do this for me' (even if it is politely phrased). – jon Oct 24 '16 at 3:52
  • I know the tpye of triangle, but I don't know how to connect them – Daisy Oct 24 '16 at 3:57
  • I mean, can you post a minimal .tex file that attempts to draw exactly this diagram? If you are part of the way there, someone will surely get you the rest of the way. (It probably won't be me: I don't do much diagram-drawing. I'm only trying to help you get a speedy answer ... and the quickest ones usually come when the OP shows what efforts they've already undertaken.) – jon Oct 24 '16 at 4:07
  • try looking for tikz and directed graphs. Here are a couple of examples I got off google tex.stackexchange.com/questions/208947/… and texample.net/tikz/examples/tag/graphs and gezeiten.org/pre-2014/post/2011/07/… – Elad Den Oct 24 '16 at 4:24
  • @jon, I have edit my question. I am sorry I don't know how to edit my code in a clear way. Thank you for your suggestion. – Daisy Oct 24 '16 at 7:58
2

A good way to structure such diagrams is this:

\documentclass{standalone}\usepackage{mathtools,tikz}
\begin{document}\begin{tikzpicture}[scale=0.8,auto]
\tikzset{EdgeStyle/.style={postaction=decorate},MyLabel/.style={auto=right,fill=none,outer sep=0.1ex}}
\newcommand\widening{1}
\node (n11) at (2+\widening+\widening,0) {$f''$};
\node (n21) at (1+\widening,2) {$f'$};
\node (n22) at (3+\widening+\widening+\widening,2) {$h'$};
\node (n31) at (0,4) {$f$};
\node (n32) at (2+\widening+\widening,4) {$g$};
\node (n33) at (4+\widening+\widening+\widening+\widening,4) {$h$};
\draw[line width=1pt,->,bend left=10] (n31) edge node[swap] {$*$} (n21);%topleft
\draw[line width=1pt,->,bend left=10] (n32) edge node[swap] {$*$} (n21);
\draw[line width=1pt,->,bend left=10] (n32) edge node {$*$} (n22);
\draw[line width=1pt,->,bend left=10] (n33) edge node {$*$} (n22);
\draw[line width=1pt,->,bend right=10] (n21) edge node[swap] {$*$} (n11);
\draw[line width=1pt,->,bend left=10] (n22) edge node {$*$} (n11);%bottomright
\end{tikzpicture}\end{document}

(1) Scaling is abstracted out. This is so that you can set how relatively large the functions are relative the arrows with one parameter.

(2) Node positions and connections are separate. So you can decide how widely spaced the nodes are without recoding their relations by a single parameter definition. For example, here, \widening={1}.

To get straight arrows: set bend left and bend right to be =0 instead of =10 or cut that parameter entirely.

  • Thank you very much for your answer. I have edited my question. I want to get the diagram like what I have post in my question. – Daisy Oct 24 '16 at 8:10
  • Can you tell me how to change curve arrow into straight arrow? Thank you very much. – Daisy Oct 24 '16 at 8:23
  • Delete all instances of bend left and bend right; or set=0 instead of =10. – Guido Jorg Oct 24 '16 at 9:09
5

You can choose between xy and tikz-cd. I'd recommend the latter.

\documentclass{article}

\usepackage[all,cmtip]{xy}

\usepackage{tikz-cd}

\begin{document}

Your diagram with \texttt{xy}:
\[
\xymatrix@C1.5em{
  f \ar[dr]_{*} && g \ar[dl]_{*} \ar[dr]^{*} && h \ar[dl]^{*} \\
  & f' \ar[dr]_{*} && h' \ar[dl]^{*} \\
  && f''
}
\]

Your diagram with \texttt{tikz-cd}:
\[
\begin{tikzcd}[column sep=1em]
  f \arrow[dr,"*"'] && g \arrow[dl,"*"'] \arrow[dr,"*"] && h \arrow[dl,"*"] \\
  & f' \arrow[dr,"*"'] && h' \arrow[dl,"*"] \\
  && f''
\end{tikzcd}
\]

\end{document}

The placement of an arrow label is to the left of the arrow, unless the label (surrounded by double quotes) is followed by '. Left and right of the arrow are determined just the same way we name the banks of a river.

Note that f^{'} is wrong syntax and should be f'.

enter image description here

2

Another way with the graph-drawing stuff. Compile with lualatex:

\RequirePackage{luatex85}
\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{graphs,graphdrawing,quotes}
\usegdlibrary{layered}
\begin{document}
\begin{tikzpicture}[>=stealth]
\graph [layered layout, nodes={math nodes, anchor=base},
  grow=-90, level distance=1.5cm, sibling distance=2cm]
{
  {f, g} ->["*"'] f' ->["*"'] f'';
  {g, h} ->["*"]  h' ->["*"]  f'';
  { [same layer] f, g, h };
  { [same layer] f', h' };
};
\end{tikzpicture}
\end{document}

enter image description here

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.