2

I have tried to create some diagrams using xymatrix. However, the problem I have encountered is that diagonal arrows do not look very well - they are not smooth and resemble raster graphics rather than vector graphics. I have the same problem using pdfLaTeX as well as LaTeX + dvips.

Here is my code:

\documentclass{article}
\usepackage[utf8]{inputenc}                                    
\usepackage[T1]{fontenc}
\usepackage[all,cmtip]{xy}
\begin{document}
\begin{displaymath}
\xymatrixcolsep{5pc}\xymatrix{& & A & \\ B \ar[r] \ar[urr] & C \ar[r] & D \ar[r] \ar[u] & E 
}
\end{displaymath}
\end{document}

The urr-arrow is the one that does not look well. I wonder if this problem can be solved, since, e.g., in this document demonstrating the use of xymatrix, there is no sign of a similar problem. Thank you in advance.

2
  • 1
    do you have the type 1 fonts for the xy arrows? if you have only the bitmap versions, they will indeed look very rough, but the type 1 versions produce good looking output. Mar 29 '13 at 12:33
  • 1
    I get good arrows compiling with pdflatex and also with latex+dvips+ps2pdf. What TeX distribution are you using?
    – egreg
    Mar 29 '13 at 14:56
3

With a recent TeX distribution there's no need to do anything for getting driver support for drawing oblique arrows. So I suspect you have an older version of xy.

You can also try tikz-cd. I show both outputs.

\documentclass{article}
\usepackage[utf8]{inputenc}                                    
\usepackage[T1]{fontenc}
\usepackage[all,cmtip]{xy}
\usepackage{tikz-cd}
\begin{document}
\begin{displaymath}
\xymatrixcolsep{5pc}
\xymatrix{
  & & A & \\ 
  B \ar[r] \ar[urr] & C \ar[r] & D \ar[r] \ar[u] & E 
}
\end{displaymath}

\[
\begin{tikzcd}[column sep=5pc]
  {} & {} & A \\
  B \arrow{rru}{} \arrow{r}{} &
  C \arrow{r}{} &
  D \arrow{r}{} \arrow{u}{} & E
\end{tikzcd}
\]
\end{document}

enter image description here

3

If you would consider using TikZ instead you might have better results without installing separate fonts.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
   \begin{tikzpicture}
      \matrix[matrix of math nodes,column sep=5pc,row sep=3em]
      {
                 &         & |(A)| A &            \\
         |(B)| B & |(C)| C & |(D)| D & |(E)| E    \\
      };
      \begin{scope}[->]
         \draw (B) -- (C);
         \draw (B) -- (A);
         \draw (C) -- (D);
         \draw (D) -- (E);
         \draw (D) -- (A);
      \end{scope}
   \end{tikzpicture}
\end{document}

sample output

For matrices the TikZ syntax can be as dense as that of xymatrix. However, in the long run I found TikZ to be much easier to learn.

2
  • 1
    What about using tikz-cd?
    – egreg
    Mar 29 '13 at 14:57
  • @egreg: probably a good idea; I don't use the package so my instinct was a pure tikz solution. Mar 29 '13 at 14:59

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.