pgf-tikz / pgf

A Portable Graphic Format for TeX
https://pgf-tikz.github.io/
1.09k stars 105 forks source link

xypic's sliding transformation for arrows #571

Closed pgf-tikz-bot closed 5 years ago

pgf-tikz-bot commented 15 years ago

Migrated from SourceForge Author: *anonymous Timestamp: 2009-07-15 16:52:28

Hi,

With XY-pic it is easy to connect two nodes using several parallel straight lines. For this there is a special transformation on arrows called sliding (see page 6 of xypic's user guide). This feature has been requested in the Help forum, see

http://sourceforge.net/forum/forum.php?thread\_id=3290707&forum\_id=477363 http://sourceforge.net/forum/forum.php?thread\_id=1959833&forum\_id=477363

In order to draw some category theory diagrams I have modified both \pgfpointanchor and \pgfpointshapeborder in pgfmoduleshapes.code.tex and removed the final inverse transformation, as follows

--- modules/pgfmoduleshapes.code.tex~orig 2008-02-23 00:49:54.000000000 +0000
+++ modules/pgfmoduleshapes.code.tex 2009-07-15 15:59:26.542522944 +0100
@@ -255,8 +255,8 @@
% Add inter picture transformation
\pgf@shape@interpictureshift{#1}%
% Undo current transformation
- \pgftransforminvert%
- \pgf@pos@transform{\pgf@x}{\pgf@y}%
+% \pgftransforminvert%
+% \pgf@pos@transform{\pgf@x}{\pgf@y}%
}%
}%
}
@@ -329,8 +329,8 @@
% Add inter picture transformation
\pgf@shape@interpictureshift{#1}%
% Undo current transformation
- \pgftransforminvert%
- \pgf@pos@transform{\pgf@x}{\pgf@y}%
+% \pgftransforminvert%
+% \pgf@pos@transform{\pgf@x}{\pgf@y}%
}%
}%
}

This alternative behaviour allows me to write

\begin{tikzpicture}
\node (0) {$A$} ++(1,0) node(1) {$B$};
\draw[->,yshift=.25ex] (0) edge (1);
\draw[->,yshift=-.25ex] (1) edge (0);
\end{tikzpicture}

and easily obtain a pair of parallel arrows between A and B. Of course, this behaviour is in conflict with the default, but it serves my purposes.

It would be nice if xypic's sliding transformation was introduced as a new feature in pgf/tikz, which would shift in a direction perpendicular to the arrow being drawn.

Thanks, Francisco

pgf-tikz-bot commented 10 years ago

Migrated from SourceForge Author: tantau Timestamp: 2013-09-30 10:19:29.504000

pgf-tikz-bot commented 10 years ago

Migrated from SourceForge Author: qrrbrbirlbelsf Timestamp: 2013-11-10 05:21:03.043000

For a general (more or less) TikZ solution on this, refer to Mark Wibrow’s answer on TeX.sx.

The tikz-cd package has something like this already incorporated (with a slightly different syntax and approach). Although the implementation is actually rather straight-forward, I have shown how to use tikz-cd’s implementation/keys with TikZ.

hmenke commented 5 years ago

Closing because there exists a library solution: https://ctan.org/pkg/tikz-cd