Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
Please provide a Minimal Working Example (MWE) that clearly shows your problem. This should start with \documentclass and end with \end{document}. –  Peter Jansson Feb 2 '13 at 9:59
    
Welcome to TeX.SX. –  Claudio Fiandrino Feb 2 '13 at 10:19
    
Dear @ClaudioFiandrino: Thank you very much!!! –  Pierre-Yves Gaillard Feb 2 '13 at 10:28
    
Dear @PeterJansson: Thanks for your suggestion. I made an edit. –  Pierre-Yves Gaillard Feb 2 '13 at 10:33

1 Answer 1

up vote 6 down vote accepted

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

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.