I want to produce a "turnstile" ie \vdash style arrow in tikz-cd.

I can do it with option [maps to, no head] but then the vertical bar appears too short:

enter image description here

\tikzcdset{arrow style=tikz}

    A \arrow[r, maps to, no head, "F"] & B

What is the simplest way to add a longer vertical bar to the tail?

  • 2
    Please give a fully compilable code of your attemp. – AndréC Oct 20 '20 at 6:27

You were quite close, I changed maps to to tail, not a huge difference in the result, but in my case you're just saying "I want the tail" rather than "I want this arrow". We will be keeping the no head.

The major change, or rather addition, I did was to add a style to tikzcdset.


enter image description here


\usepackage{tikz-cd} % no need to load tikz, since tikz-cd already loads it

% \usetikzlibrary{arrows.meta} % you can uncomment this if you want more arrow types

    arrow style=tikz,

    A \arrow[r, tail, no head,"F"] & B
  • 1
    Thanks! Can you explain the diagrams line? It seems to have changed the tail shape, otherwise it would not be a vertical line. – Yan King Yin Oct 20 '20 at 13:54
  • 1
    @YanKingYin Sure! The diagrams command is used to change the style of the diagrams, I used it for the arrow appearance for example. So it's diagrams={ <options> }. Inside of it, I said >= which means "arrow tip is". Then with {|[scale=2]} I specify the arrow tip | with a scale to make it bigger. If you remove "no head", you'll see the arrow will look like |----|. I couldn't find an option to define only the tail and there might not be one. You can see more in the tikz-cd manual – Alenanno Oct 20 '20 at 15:14
  • Let me know if something is still unclear. – Alenanno Oct 20 '20 at 15:14

I found a simpler solution, combining ideas from this answer:

\begin{tikzcd}[| /.tip = {Bar[scale=2]}]
A  \arrow[r, |-]  B

Also, the first answer has the problem that it changes all diagrams in the document, but this one affects only the current diagram.

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.