0

I have got the following code for a commutative diagram. I want the arrow from A times X to F times X to be dotted. I would really appreciate any help.

\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
  \begin{tikzcd}[sep=huge]  
A \times X \arrow{r}{\bar{q}\times 1_x} \arrow[swap]{dr}{q} & F \times X \arrow{d}{\epsilon} \\
 & Y
  \end{tikzcd}
\end{document}

enter image description here

Elise
  • 25
  • \arrow[dotte]{r}{\bar{q}\times 1_x}? –  Dec 05 '20 at 22:11
  • It worked, thank you very much – Elise Dec 05 '20 at 22:12
  • By any chance do you know how to make the dotted arrow bolder or the dash to be longer so its more visible – Elise Dec 05 '20 at 22:17
  • Well, you can use all the tikz keys, e.g. \arrow[dash pattern=on 4pt off 2pt,thick]{r}{\bar{q}\times 1_x}, or just dashed. It would be much easier tottery out if you gave a complete example that starts with \documentclass and can be compiled. –  Dec 05 '20 at 22:28
  • I have now edited the code – Elise Dec 05 '20 at 22:36

2 Answers2

2

As I said in my comments (and as has been copied by another user in the mean time) you can add keys like dotted. For a thicker and truly dotted line you can use this post, the normal "dots" are just small rectangles. You can also keep the arrow heads small when making the line thicker.

\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}[sep=huge]  
A \times X \arrow[dotted]{r}{\bar{q}\times 1_x} \arrow[swap]{dr}{q} & F \times X \arrow{d}{\epsilon} \\
 & Y
\end{tikzcd}
\qquad
\begin{tikzcd}[sep=huge]  
A \times X \arrow[dash pattern=on 0pt off 3.2pt,line cap=round,line width=0.8pt]{r}{\bar{q}\times 1_x} \arrow[swap]{dr}{q} & F \times X \arrow{d}{\epsilon} \\
 & Y
\end{tikzcd}

\bigskip \tikzset{thick true dots/.style={dash pattern=on 0pt off pi*#1, line cap=round,line width=#1}, thick true dots/.default=0.8pt, oricm/.style={-{cm to[width=1.5ex,length=0.8ex,line width=0.4pt]}}} \begin{tikzcd}[sep=huge]
A \times X \arrow[thick true dots]{r}{\bar{q}\times 1_x} \arrow[swap]{dr}{q} & F \times X \arrow{d}{\epsilon} \ & Y \end{tikzcd} \qquad \begin{tikzcd}[sep=huge]
A \times X \arrow[thick true dots=2pt]{r}{\bar{q}\times 1_x} \arrow[swap]{dr}{q} & F \times X \arrow{d}{\epsilon} \ & Y \end{tikzcd}

\bigskip \begin{tikzcd}[sep=huge]
A \times X \arrow[oricm,thick true dots]{r}{\bar{q}\times 1_x} \arrow[swap]{dr}{q} & F \times X \arrow{d}{\epsilon} \ & Y \end{tikzcd} \qquad \begin{tikzcd}[sep=huge]
A \times X \arrow[oricm,thick true dots=2pt]{r}{\bar{q}\times 1_x} \arrow[swap]{dr}{q} & F \times X \arrow{d}{\epsilon} \ & Y \end{tikzcd} \end{document}

enter image description here

  • Thank you very much for all your help. – Elise Dec 05 '20 at 22:49
  • @Lazy squirrel: If the other user who copied your comments is me, I have the regret to inform you that while you were commenting, I was preparing my answer and screenshot. – Bernard Dec 05 '20 at 23:04
  • @Bernard I see. And if you had your answer first, and I would just have repeated it (regardless of whether I had prepared it while you posted yours), would that be copying? And if 100 users prepare an answer or comment, there will be 100 answers and comments? To be clear: copying in this context means repeating. If you think that this is a useful exercise then there is nothing that prevents you from doing it. –  Dec 05 '20 at 23:11
1

Here you are:

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

\begin{document}

\begin{tikzcd}[sep=huge] A \times X \arrow[dotted]{r}{\bar{q}\times 1_x} \arrow[swap]{dr}{q} & F \times X \arrow{d}{\epsilon} \ & Y \end{tikzcd}

\end{document}

enter image description here

Edit:

To be complete, here is a solution with pstricks which gives an easy control of the size of the dotted arrow. Load pst-node and use the psmatrix environnment:

$ \psset{arrowinset=0.15, arrows=->, linejoin=1, nodesep=3pt, labelsep=1pt}
\begin{psmatrix}[colsep=2cm]
  A\times X & F\times X \\
 & Y %
 \ncline[linewidth=1.2pt, linestyle=dotted, dotsep=2pt]{1,1}{1,2}\naput{\bar{q}\times 1_X}%
\ncline{1,1}{2,2}\nbput{q}
\ncline{1,2}{2,2}\naput{\epsilon}
  \end{psmatrix} $

enter image description here

Zarko
  • 296,517
Bernard
  • 271,350
  • Hiya, thank you for the help. By any chance do you know how to make the dotted arrow bolder or the dash to be longer so it's more visible. – Elise Dec 05 '20 at 22:37
  • @Elise: Unfortunately, I don't know pgf well enough to know how to do that. For me, the dashed version is acceptable. – Bernard Dec 05 '20 at 23:01