3

Thanks to Peter Grill's answer I'm able to obtain correct paths drawn using -| or |- with a Bond Graph arrow (f_out or e_out) in a Tikzpicture (it was not trivial at first sight, in Peter Grill's answer, the path is broken "into two components" using \coordinate).

So, I obtain this:

enter image description here

However, I would like to "move" the end of the top arrow regarding relative coordinate - with something like ($(node2.north west)!0.15!(node2.north)$) - in order to obtain this (warning: red things are not wanted in the final result, it is just for explanation purpose):

enter image description here

I wonder how can I achieve that?

Here a MWE (adapted from Peter Grill's answer):

\documentclass{article}
\usepackage{tikz}
\usepackage{bondgraphs}
\usetikzlibrary{calc}

\tikzset{no bond/.style={thick}}% <-- to get similar appearange of bond arrows

\begin{document}%
\begin{tikzpicture}%
    \node (node1) [draw, text width=5em, minimum height=8em] {node1};%
    \path (node1.east)+(3,0) node (node2) [draw, text width=3em, minimum height=3em] {node2};%
    \draw [no bond, e_out] ( $ (node1.north east)!0.15!(node1.east) $ ) -| node [above, pos=0.2] {label1} (node2.north);% <-- changed style

    % Top arrow label 1
    \coordinate (X1) at ( $ (node1.north east)!0.15!(node1.east) $ );
    \coordinate (Y1) at ($(node2.north)!(X1)!(node2.north)$);
    \draw [no bond] (X1) -- (Y1);
    \draw [bond, e_out] (Y1) -- (node2.north);
    
    % Bottom arrow label 2
    \coordinate (Y2) at ($(node1.south east)!0.15!(node1.east)$);
    \coordinate (X2) at ($(node2.south)!(Y2)!(node2.south)$);
    \draw [no bond, f_out] (node2.south) -- (X2);
    \draw [bond] (X2) -- node [below, pos=0.6] {label2} (Y2);
\end{tikzpicture}%
\end{document}

1 Answer 1

3

There are several ways you can move the posution of a node, including:

  1. You could apply a xshift= to move the point (node2.north). For example, you could use ([xshift=-0.25cm]node2.north).

  2. You could specify the "angle" position, something like (node2.120).

Using the xshift= yields:

enter image description here

Code:

\documentclass{article}
\usepackage{tikz}
\usepackage{bondgraphs}
\usetikzlibrary{calc}

\tikzset{no bond/.style={thick}}% <-- to get similar appearance of bond arrows

\begin{document}%
\begin{tikzpicture}%
    \node (node1) [draw, text width=5em, minimum height=8em] {node1};
    \coordinate (X1) at ($ (node1.north east)!0.15!(node1.east) $);

    \path (node1.east)+(3,0) node (node2) [draw, text width=3em, minimum height=3em] {node2};
    \coordinate (X2) at ([xshift=-0.25cm]node2.north);
    \draw [no bond, e_out] (X1) -| node [above, pos=0.2] {label1} (X2);

    % Top arrow label 1
    \coordinate (Y1) at ($(X2)!(X1)!(X2)$);
    \draw [no bond] (X1) -- (Y1);
    \draw [bond, e_out] (Y1) -- (X2);
    
    % Bottom arrow label 2
    \coordinate (Y2) at ($(node1.south east)!0.15!(node1.east)$);
    \coordinate (X2) at ($(node2.south)!(Y2)!(node2.south)$);
    \draw [no bond, f_out] (node2.south) -- (X2);
    \draw [bond] (X2) -- node [below, pos=0.6] {label2} (Y2);
\end{tikzpicture}%
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .