14

I love the TikZcd syntax to draw diagrams, and I want to use it to draw diagrams of field extensions ; this involves drawing arrows without tips. The only command I know to draw lines in tikzcd environments is \ar (or \arrow if I write it out), and I don't know how to adjust the \ar command so that it just draws straight lines from point A to point B (recall it is used in the following way : \ar[options]{rd}[options]{$\phi$} to render an arrow which goes right-down and put the symbol $\phi$ next to the arrow.

I tried simply putting TikZ commands, but they seem to have no effect (even though it compiles for most of the commands I've tried).

Any ideas?

Pier Paolo
  • 2,790

2 Answers2

11

Section 1.2 of tikz-cd documentation details this; in particular, it sounds like you might want dash

screenshot

% arara: pdflatex
\documentclass{standalone}
\usepackage{tikz-cd}

\begin{document}
\begin{tikzcd}
  A \arrow[dash]{r} & B
\end{tikzcd}
\end{document}

Following the comments, you can apply dash to every arrow for the current environment using

\begin{tikzcd}[every arrow/.append style={dash}]
  A \arrow{r} & B
\end{tikzcd}
cmhughes
  • 100,947
  • Wow, how did I go through the whole document without seeing this. Thanks! – Patrick Da Silva Feb 28 '14 at 21:52
  • Do you know if I can make the [dash] option applied to the whole environment? Otherwise I have to type \ar[dash] all the time. – Patrick Da Silva Feb 28 '14 at 21:54
  • For some reason, this code is not working :
    \begin{tikzcd}
    

    K \arrow[dash]{d} \ F \end{tikzcd}. I get the error "Package pgfkeys Error: I do not know the key '/tikz/dash' and I am going to i gnore it. Perhaps you misspelled it."

    – Patrick Da Silva Feb 28 '14 at 21:56
  • Added : lucky me, only the dash option seems to fail, the (most of) other arrow tips in section 1.2 run just fine. – Patrick Da Silva Feb 28 '14 at 22:02
  • This answer helped me. Problem solved! http://tex.stackexchange.com/questions/100998/parallel-arrows-without-heads – Patrick Da Silva Feb 28 '14 at 22:06
  • 1
    @PatrickDaSilva see my update about the whole environment – cmhughes Feb 28 '14 at 23:16
  • 2
    @cmhughes instead of dash one can also simply use -, as in \begin{tikzcd}[every arrow/.append style={-}] A \arrow{r} & B \end{tikzcd} (apparently the dash option is not available for the OP's version of the package, but I guess - will be.) – Gonzalo Medina Feb 28 '14 at 23:18
  • @GonzaloMedina Apparently the version of tikz-cd the arxiv uses doesn't accept dash, but does accept -, so thanks! This comment gave me an easy fix for making my file arxiv-compatible. – Kimball Feb 12 '15 at 11:55
  • @GonzaloMedina: Thanks for pointing out the solution on how to replace dash to make things arxiv compatible. I was fighting for several hours with several problems of the outdated and buggy arxiv version of tikz-cd. In case someone else gets faced with another problem which took me quite some time to resolve it: The arxiv version of tikz-cd produces bizarre error messages when the first line of a tikzcd environment starts with a &. The solution finally was to put a {} before &. – Peter Mueller Feb 25 '15 at 20:20
1

Adding to the above: If you want more flexibility than the "dash" type arrow there is also the "no head" command which removes the head from any type of arrow.

Adam Gal
  • 111