3

I drew the following commutative diagram with tikz (I can't use tikz-cd since it's not on my version of LaTeX ; I tried to install it but doesn't seem to work)

\documentclass[11pt]{beamer}
\usetheme{default}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{tikz}
%\usepackage{tikz-cd}
\usetikzlibrary{matrix,arrows,decorations.pathmorphing}
     \begin{center}
        \begin{tikzpicture}[scale=2]
        \node (X) at (1,1){$X$};
        \node (A) at (0,0){$A$};
        \node (B) at (2,0){$B$};
        \node (axb) at (1,0){$A \times B$};
        \path[->,font=\scriptsize,>=angle 90]
        (axb) edge node[below]{$x_1$} (A)
        (axb) edge node[below]{$p_B$} (B)
        (X) edge node[above]{$p_A$} (A)
        (X) edge node[above]{$p_B$} (B)
        (X) edge node[left]{$w$} (axb);
    \end{tikzpicture}
    \end{center}

I need the w arrow to be dotted, how can I do that ?

  • Since it seems you don't have the standard LaTeX versions, please specify which one you have. Also, please make your example minimal but include all the meaningful stuff from documentclass to end{document} – Moriambar May 18 '17 at 20:42
  • 1
    Have you tried the option edge[dotted]? – AboAmmar May 18 '17 at 20:44
  • Yes, I just figured it out... – Asinus May 18 '17 at 20:46
  • However if you had an idea why tikz-cd doesn't work, I would be grateful – Asinus May 18 '17 at 20:46
  • What is your distribution? – Bernard May 18 '17 at 20:49
4

Edit: doted line was solved by AboAmar comment slightly before my answer ... so I add some of topic issues. With use of the library \quotes you can make your code more concise and also gives better positioning of edge labels:

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows}

\begin{document}
    \begin{tikzpicture}[scale=2]
\node (X) at (1,1){$X$};
\node (A) at (0,0){$A$};
\node (B) at (2,0){$B$};
\node (axb) at (1,0){$A \times B$};
\path[-angle 90,font=\scriptsize]
(axb) edge ["$x_1$"]   (A)
(axb) edge ["$p_B$" '] (B)
(X) edge   edge ["$p_A$" '] (A)
(X)   edge ["$p_B$"]   (B)
(X)   edge[dotted,% <-- added
                  "$w$" '] (axb);
    \end{tikzpicture}
\end{document}

![enter image description here

| improve this answer | |
  • Thanks. Do you have an idea why I can't use the package tikz-cd ? – Asinus May 18 '17 at 20:48
  • @Asinus, sorry, I haven't insight in your installation of LaTeX. I use MikTeX with enabled installation missing packages on-the-fly. It works fine. – Zarko May 18 '17 at 21:04

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.