1

I am trying to create a diagram using tikz-cd. I want something similar to the following:

\begin{tikzcd}[column sep=scriptsize]
                       \& 3 \arrow[rr, dash] \& \arrow[d] \& 2\\
    1 \arrow[rr, dash] \& \arrow[d]          \&  4        \&  \\
                       \&  5                 \&           \&
\end{tikzcd}

This has a gap between the horizontal line and the downward pointing arrow. I also tried this:

\begin{tikzcd}[column sep=scriptsize]
    \& 3 \arrow[rr, dash, ""{name=U, below, draw=black}] \& \arrow[d] \& 2\\
    1 \arrow[rr, dash, ""{name=V, below, draw=black}] \& \&  4 \arrow[rightarrow, from=U] \&  \\
    \&  5 \arrow[rightarrow, from=V]\& \&
\end{tikzcd}

This however creates a square above the downward pointing arrows. I would like the downward pointing arrow to connect to the horizontal bars.

  • Welcome to TeX.SX!. You should not escape the ampersand in tikzcd. Use & instead of \& here. – Phelype Oleinik Mar 2 '18 at 21:25
  • 1
    Welcome to TeX.SE. Could you to add a picture (figure) please? Thus I undestand your problem. Thanks. – Sebastiano Mar 2 '18 at 21:25
1

I didn't find a prettier solution. This one requires a little manual labor...

You can use the option shorten <= <dimen> and shorten >= <dimen> to change the length of the arrow. Use negative values to enlarge them.

enter image description here

\documentclass[convert]{standalone}
\usepackage{tikz}
\usetikzlibrary{cd}

\begin{document}

\begin{tikzcd}[column sep=scriptsize]
                       & 3 \arrow[rr, dash]          & \arrow[d,shorten <= -0.65em] & 2\\
    1 \arrow[rr, dash] & \arrow[d,shorten <= -0.65em]&  4        &  \\
                       &  5                          &           &
\end{tikzcd}

\end{document}

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.