2

How can I write this diagram in Tikz:

enter image description here

Here is my try:

\begin{tikzcd}
x \arrow{leftrightarrow}{r}{*} \arrow[dashed]{dr}{*} & &  
y \arrow[dashed]{dl}{*}  \\
& z &
\end{tikzcd}
0

3 Answers 3

4

Possible solution:

\documentclass[tikz]{standalone}
\usepackage{tikz-cd}

\begin{document}

\begin{tikzcd}
x \arrow[rr, leftrightarrow, "*"] \arrow[dr, dashrightarrow, "*"'] 
 &  & y \arrow[dl, dashrightarrow, "*"] \\
 & z &
\end{tikzcd}

\end{document}

enter image description here


Edit: Another solution with pure TikZ:

\documentclass[tikz]{standalone}

\begin{document}

\begin{tikzpicture}
 \node (x) at (0,0) {$x$};
 \node (y) at (2,0) {$y$};
 \node (z) at (1,-1) {$z$};

 \draw[<->] (x) -- node[above] {$\ast$} (y);
 \draw[->,dashed] (x) -- node[below left] {$\ast$} (z);
 \draw[->,dashed] (y) -- node[below right] {$\ast$} (z);
\end{tikzpicture}

\end{document}
4

enter image description here

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

\begin{document}

\begin{tikzcd}
x \arrow[dashed,"*"']{dr}\arrow[leftrightarrow]{rr}{*} & & y \arrow[dashed]{dl}{*}\\
& z &
\end{tikzcd}

\end{document}
2
  • OK, this is almost a bit silly. Two very similar solutions posted at almost the same time … If yours gets accepted, I will delete mine. Feb 14, 2018 at 13:45
  • 1
    @JasperHabicht No, leave it. It's a different syntax. Someone will find it useful. P.S.: I tried to see which answer was the first one but it's easier to see if Han shot first :P Feb 14, 2018 at 13:52
2

A simple tikz solution:

\documentclass[tikz]{standalone}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
  \draw[<->] (0,0) node[left] {$x$}--(4,0) node[midway, above]{$*$} node[right]{$y$};
  \draw[->,dashed] (0,0)--(2,-1.7) node[midway,below left]{$*$} node[below]{$z$};
  \draw[->,dashed] (4,0)--(2,-1.7) node[midway,below right]{*};
\end{tikzpicture}
\end{document}

Output:

enter image description here

2
  • 1
    The arrow heads collide. This could be prevented using shorten >. Feb 14, 2018 at 15:21
  • @JasperHabicht it is an option, but it would be solved easier by another arrowhead like "-latex" instead of "->"
    – koleygr
    Feb 14, 2018 at 21:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .