5

How do I make the diagram

X - Y -> Z

with tikz-cd?

With xy-pic, I would enter

\xymatrix{ X \ar@{-}[r] & Y \ar[r] & Z }

I tried

\begin{tikzcd} X \ar[no head]{r} & Y \ar{r} & Z \end{tikzcd}

but it didn't work.

Note that

\begin{tikzcd} X \ar[two heads]{r} & Y \ar{r} & Z \end{tikzcd}

produces

X ->> Y -> Z

"as it should".

In other words:

What is the tikz-cd equivalent to the xy-pic command \ar@{-}?

Thank you very much in advance for your help.

EDIT. Peter Jansson kindly asked me to provide a Minimal Working Example (MWE). So here is what works:

\documentclass{article}
\usepackage[all]{xy}
\usepackage{tikz-cd}
\begin{document}
$$
\xymatrix{ X \ar@{-}[r] & Y\ar[r] & Z}
$$
$$
\begin{tikzcd} 
X \ar[two heads]{r} & Y \ar{r} & Z 
\end{tikzcd}
$$
\end{document}

Here is what doesn't work:

\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
$$
\begin{tikzcd} 
X \ar[no head]{r} & Y \ar{r} & Z 
\end{tikzcd}
$$
\end{document}

I get the error message

! Package pgfkeys Error: 
I do not know the key '/tikz/no head' 
and I am going to ignore it. 
Perhaps you misspelled it.

This doesn't surprise me because I just tried to guess at a possible command. But I hope that there is a simple way to do this.

6

Just use the optional argument to \ar that allows for specifying the arrow's shape, shift and whatnot:

\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\[
\begin{tikzcd} 
X \ar[-]{r} & Y \ar{r} & Z 
\end{tikzcd}
\]
\end{document}

Never use $$ in LaTeX.

enter image description here

  • Dear egreg: Thanks a lot! How did you figure that out? Is there a list of all the possible optional arguments you can use in this situation? – Pierre-Yves Gaillard Feb 2 '13 at 11:54
  • 1
    @Pierre-YvesGaillard The official documentation. – Manuel Feb 2 '13 at 13:12

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.