7

I have a macro to draw rather complicated diagrams in tikz which makes use of pgfkeys in order to be as flexible as possible on arrows, labels and their styles. I allow all the commands of the library cd. What I would need is a parameter/option, such as Rrightarrow of the ams package, that I can pass as pgfkey which could draw triple (or even quadruple) arrows, precisely like I can pass the parameters leftarrow, Rightarrow, equal, squiggly, ...

The following topics Triple lines in tikz and Costum arrow shaft in tikz contain some beautiful code going in that direction, but I am not able to squeeze them into a tikz-cd arrow-style option. I think I understand the code of the (second answer of the) second link, where in order to provide a 3-arrow or a 4-arrow, two different arrows are overlapped. Since the arrows of my macro are fixed, I cannot use this solution. I think the code of the first link could be used to provide a satisfying solution but: I don't know a lot of tikz yet (I have always used tikzcd), in the comments there they seem to imply that adding a arrow tip to a triple line is hard. I tried to play a bit with the code, modifying what I think should be chanced, but I haven't managed to produce anything concrete.

4
  • 3
    I'm voting to close this question as off-topic because this is a just-do-it-for-me question (-1). Aug 17, 2019 at 10:38
  • 1
    I didn't realise that using the command preaction, as shown in the first link and in the answer below, the construction would be so straightforward. I was convinced by the comments of the first link that the arrow-head would pose a problem. I am ok with closing this topic, but I propose in this case to add Dunno's answer in the second topic linked in the OP. Aug 17, 2019 at 11:26
  • 7
    @Raaja: This seems like a good question to me: the OP has clearly put significant effort into trying to do this themself, and is asking here because it turns out to require more TikZ expertise than one might expect. Aug 19, 2019 at 14:04
  • @Peter LeFanu good question part I would agree (because, except a few, almost all the questions in this site are good ones). Nevertgeless, if you see the previous questions by the OP, you can notice that the OP has been introduced to TikZ sufficiently. Therefore, the OP have a minimal knowledge to kick-start things. Now, to the point, as you would already know, we dont expect a fully functioning MWE, but atleast a starting point to show others what the OP has tried. Aug 20, 2019 at 1:25

2 Answers 2

14

You can do as suggested in the links you show. A slightly subtle point is that the arrow does not get respected automatically, so you need to shorten the double line path in the quadruple arrow a bit. (You can of course fine-tune double distance etc.) Squiggly arrows can be obtained with decorations such as coil, please let me know if you want me to add an example.

\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\tikzset{Rightarrow/.style={double equal sign distance,>={Implies},->},
triple/.style={-,preaction={draw,Rightarrow}},
quadruple/.style={preaction={draw,Rightarrow,shorten >=0pt},shorten >=1pt,-,double,double
distance=0.2pt}}
\begin{tikzcd}
    a \arrow[r,triple] &    b  \arrow[r,quadruple] 
    & c\\
\end{tikzcd}
\end{document}

enter image description here

7
  • Thanks, I really didn't realise it was that simple. I had tried something similar but I must have messed up the syntax and couldn't make it work. I propose to migrate your answer as an answer of the second link of the OP and then close this topic. Aug 17, 2019 at 11:29
  • 2
    @AndreaGagna OK. I upvoted so your question is no longer in the negative range. (Also the arrow head is somewhat subtle, so I do not think this is an exact duplicate of the preaction post, but of course preaction is the most important ingredient.)
    – user194703
    Aug 19, 2019 at 12:57
  • 1
    @Someone The length of the arrows is determined by the column sep of the cd matrix. If you use \begin{tikzcd}[/tikz/column sep=1.1em] a \arrow[r,triple] & b \arrow[r,quadruple] & c\\ \end{tikzcd} the arrows will become shorter. But you do not need to use tikz-cd to use these styles.
    – user194703
    Apr 8, 2020 at 18:01
  • 1
    Maybe worth adding that to do this without tikz-cd you say something like ...\draw[->,triple] (firstnode) -- (secondnode);... inside any tikz environment like tikzpicture, etc. May 17, 2020 at 6:37
  • 1
    @მამუკაჯიბლაძე Thanks for your comment! Yes. One may want to add that one should not curve these arrows too much since shorten shortens along the tangent at the start or target.
    – user194703
    May 17, 2020 at 6:39
2

There is now a beautiful package, tikz-nfold by Jonathan Schulz, providing a simple solution to this problem. You can specify the TikZ arrow style scaling nfold=3 (or simply nfold=3 if you want a fixed arrow width) to draw a triple arrow, and similarly for higher arrows.

In my experience, this produces more aesthetically pleasing arrows than other solutions, and is compatible with the various other TikZ styles that are common in commutative diagrams.

Example:

\documentclass{article}

\usepackage{tikz-cd}
\usetikzlibrary{nfold}

\begin{document}

\begin{tikzcd}
    A \arrow[r, Rightarrow, scaling nfold=3] & B \\
        C \arrow[r, Rightarrow, nfold=3] & D
\end{tikzcd}

\end{document}

Produces:

two triple arrows

You must log in to answer this question.

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