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.

It is possible to get two parallel maps (one pointing to the left, the other to the right) between two nodes using pb-diagram? I know it can be done with TikZ, and maybe with some other package, but I use pb-diagram. Note that the option = is not enough. I would like to have also the heads of the arrows (the = option just draws two parallel lines)...

share|improve this question
add comment

1 Answer 1

The style file pb-diagram.sty contains a couple of examples of custom arrows. Basically you have to build an appropriate representation using LaTeX's built-in picture environment. Here is an attempt at this. The separation of the two arrows is controlled by \twoarrowsep. If you do not need the diagonal arrows, a smaller value may look better.

Sample output

\documentclass{article}

\usepackage{pb-diagram}
\newcount\twoarrowsep
\twoarrowsep=50

\makeatletter
\@namedef{dgo@dd}{\let\dg@VECTOR=\dg@twoarrowedvector}%

\newcount\dg@XSHIFT
\newcount\dg@YSHIFT
\def\dg@twoarrowedvector(#1,#2)#3{%
   \begingroup
   \dg@XTEMP=#1\relax\multiply\dg@XTEMP\m@ne\relax
   \dg@YTEMP=#2\relax\multiply\dg@YTEMP\m@ne\relax
   \dg@ZTEMP=#1\relax
   \ifnum\dg@ZTEMP<\z@
     \multiply\dg@ZTEMP\m@ne\relax \fi
   \ifnum\dg@YTEMP<\z@
     \advance\dg@ZTEMP by -\dg@YTEMP
   \else \advance\dg@ZTEMP by \dg@YTEMP \fi
   \dg@XSHIFT=#2\relax\multiply\dg@XSHIFT\m@ne\relax\multiply\dg@XSHIFT\twoarrowsep\relax
     \divide\dg@XSHIFT by \dg@ZTEMP\relax
   \dg@YSHIFT=#1\relax\multiply\dg@YSHIFT\twoarrowsep\relax\divide\dg@YSHIFT by \dg@ZTEMP\relax
   \begin{picture}(0,0)%
      \thinlines
      \put(-\dg@XSHIFT,-\dg@YSHIFT){\vector(#1,#2){#3}}%
      \put(\dg@XSHIFT,\dg@YSHIFT){\line(#1,#2){#3}}%
      \put(\dg@XSHIFT,\dg@YSHIFT){\vector(\dg@XTEMP,\dg@YTEMP){0}}
   \end{picture}%
   \endgroup}%
\makeatother

\begin{document}

\begin{displaymath}
  \begin{diagram}
    \node{A}
    \arrow{e,dd}
    \arrow{se,dd}
    \arrow{s,dd}
    \node{B}\\
    \node{C} \node{D} \arrow{w,dd} \arrow{n,dd}
  \end{diagram}
\end{displaymath}

\end{document}

The code draws two arrows shifted away from the standard axis by equal amounts in a perpendicular direction. The opposite arrow is actually drawn in two parts, the stem and the head, to avoid some extra calculations. So the picture environment consits of three \put commands.

As in the package itself I have kept to the standard arithmetic operators provided by LaTeX; some other package may give you access to a square root operator, and so could give better adjust ment of the spacing for sloping arrows.

share|improve this answer
add comment

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.