How to partially make a segment of a path dashed?












7














I have two stocks, A and B. These two "meet" each other at rates q(x), and f(x), by going through a joint-state process called X. Then, A becomes a, and B becomes b.



I thought about visualizing the flowchart as in the attached box. However, I'm clueless as to how solve this within tikz. It'd be best if the arrows are dashed arrows while "inside of X".



flowchart



With protest, here's as far as I came.



documentclass[border=1in]{standalone}
usepackage{tikz}
usetikzlibrary{positioning}

tikzstyle{block} = [rectangle, draw, fill=blue!20,
text width=5em, text centered, rounded corners, minimum height=4em]

begin{document}
begin{tikzpicture}
node [block] (X) {X};
node [block] [below left=of X] (A) {A};
node [block] [above left=of X] (a) {a};
node [block] [below right=of X] (B) {B};
node [block] [above right=of X] (b) {b};

path[->] (A) edge[bend right=90] node [left] {} (a);
path[->] (B) edge[bend left=90] node [left] {} (b);

end{tikzpicture}
end{document}









share|improve this question




















  • 1




    The point is "adding what you've tried so far".
    – vaettchen
    Dec 22 at 7:17
















7














I have two stocks, A and B. These two "meet" each other at rates q(x), and f(x), by going through a joint-state process called X. Then, A becomes a, and B becomes b.



I thought about visualizing the flowchart as in the attached box. However, I'm clueless as to how solve this within tikz. It'd be best if the arrows are dashed arrows while "inside of X".



flowchart



With protest, here's as far as I came.



documentclass[border=1in]{standalone}
usepackage{tikz}
usetikzlibrary{positioning}

tikzstyle{block} = [rectangle, draw, fill=blue!20,
text width=5em, text centered, rounded corners, minimum height=4em]

begin{document}
begin{tikzpicture}
node [block] (X) {X};
node [block] [below left=of X] (A) {A};
node [block] [above left=of X] (a) {a};
node [block] [below right=of X] (B) {B};
node [block] [above right=of X] (b) {b};

path[->] (A) edge[bend right=90] node [left] {} (a);
path[->] (B) edge[bend left=90] node [left] {} (b);

end{tikzpicture}
end{document}









share|improve this question




















  • 1




    The point is "adding what you've tried so far".
    – vaettchen
    Dec 22 at 7:17














7












7








7


1





I have two stocks, A and B. These two "meet" each other at rates q(x), and f(x), by going through a joint-state process called X. Then, A becomes a, and B becomes b.



I thought about visualizing the flowchart as in the attached box. However, I'm clueless as to how solve this within tikz. It'd be best if the arrows are dashed arrows while "inside of X".



flowchart



With protest, here's as far as I came.



documentclass[border=1in]{standalone}
usepackage{tikz}
usetikzlibrary{positioning}

tikzstyle{block} = [rectangle, draw, fill=blue!20,
text width=5em, text centered, rounded corners, minimum height=4em]

begin{document}
begin{tikzpicture}
node [block] (X) {X};
node [block] [below left=of X] (A) {A};
node [block] [above left=of X] (a) {a};
node [block] [below right=of X] (B) {B};
node [block] [above right=of X] (b) {b};

path[->] (A) edge[bend right=90] node [left] {} (a);
path[->] (B) edge[bend left=90] node [left] {} (b);

end{tikzpicture}
end{document}









share|improve this question















I have two stocks, A and B. These two "meet" each other at rates q(x), and f(x), by going through a joint-state process called X. Then, A becomes a, and B becomes b.



I thought about visualizing the flowchart as in the attached box. However, I'm clueless as to how solve this within tikz. It'd be best if the arrows are dashed arrows while "inside of X".



flowchart



With protest, here's as far as I came.



documentclass[border=1in]{standalone}
usepackage{tikz}
usetikzlibrary{positioning}

tikzstyle{block} = [rectangle, draw, fill=blue!20,
text width=5em, text centered, rounded corners, minimum height=4em]

begin{document}
begin{tikzpicture}
node [block] (X) {X};
node [block] [below left=of X] (A) {A};
node [block] [above left=of X] (a) {a};
node [block] [below right=of X] (B) {B};
node [block] [above right=of X] (b) {b};

path[->] (A) edge[bend right=90] node [left] {} (a);
path[->] (B) edge[bend left=90] node [left] {} (b);

end{tikzpicture}
end{document}






tikz-pgf






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 22 at 8:02

























asked Dec 22 at 6:42









FooBar

390112




390112








  • 1




    The point is "adding what you've tried so far".
    – vaettchen
    Dec 22 at 7:17














  • 1




    The point is "adding what you've tried so far".
    – vaettchen
    Dec 22 at 7:17








1




1




The point is "adding what you've tried so far".
– vaettchen
Dec 22 at 7:17




The point is "adding what you've tried so far".
– vaettchen
Dec 22 at 7:17










3 Answers
3






active

oldest

votes


















11














Just divide the path in three if you want the second part dashed.



If you write NodeName.degreee (for example X.130) you can position the end or the beginning of the path exactly where you need. Imagine the node is a circle angle with the east anchor = 0 degrees, so the south anchor is -90, the north = 90, the east = 180, etc.



documentclass[border=1in]{standalone}
usepackage{tikz}
usetikzlibrary{positioning}
tikzset{
block/.style={
rectangle, draw, fill=blue!20,
text width=5em, text centered, rounded corners, minimum height=4em
}
}

begin{document}
begin{tikzpicture}
node [block] (X) {X};
node [block] [below left=of X] (A) {A};
node [block] [above left=of X] (a) {a};
node [block] [below right=of X] (B) {B};
node [block] [above right=of X] (b) {b};

draw (A) to[bend right] (X.-130) node[below left=4pt and 5pt] {$q(x)$};
draw[dashed] (X.-130) to[bend right, looseness=.2] (X.130);
draw[->] (X.130) to[bend right] (a);

draw (B) to[bend left] (X.-50) node[below right=4pt and 5pt] {$f(x)$};
draw[dashed] (X.-50) to[bend left, looseness=.2] (X.50);
draw[->] (X.50) to[bend left] (b);

end{tikzpicture}
end{document}


enter image description here



Edit: gorgeous marmot's answer could be simplified without using reverse clipping and putting the straight line behind the X node, like in marya's answer but using on background layer from backgrounds library to not draw it twice.



documentclass[border=1in]{standalone}
usepackage{tikz}
usetikzlibrary{positioning,backgrounds}
tikzset{
block/.style={
rectangle,
text width=5em, text centered, rounded corners, minimum height=4em, draw, fill=blue!20
},
}

begin{document}
begin{tikzpicture}
node[block] (X) {X};
node [block] [below left=of X] (A) {A};
node [block] [above left=of X] (a) {a};
node [block] [below right=of X] (B) {B};
node [block] [above right=of X] (b) {b};

begin{scope}[on background layer]
path[->] (A) edge[bend right=90] node[near start, above left] {$q(x)$} (a);
path[->] (B) edge[bend left=90] node[near start, above right] {$f(x)$} (b);
end{scope}

begin{scope}[dashed]
clip[rounded corners] (X.north west) rectangle (X.south east);
path[->] (A) edge[bend right=90] (a);
path[->] (B) edge[bend left=90] (b);
end{scope}
end{tikzpicture}
end{document}


enter image description here






share|improve this answer























  • Oh, now after seeing the image, I understand I wasn't being clear enough. Ive updated the picture to emphasize what I mean by "dashed while inside of X"... sorry about that
    – FooBar
    Dec 22 at 8:03












  • @FooBar See my renewed answer
    – CarLaTeX
    Dec 22 at 8:11



















10














Here is a proposal using reverseclip and use path to draw the dashed path inside and the solid one outside. Please note that tikzstyle is slightly deprecated.



documentclass[border=1in]{standalone}
usepackage{tikz}
usetikzlibrary{positioning}
makeatletter % https://tex.stackexchange.com/a/38995/121799
tikzset{
use path/.code={pgfsyssoftpath@setcurrentpath{#1}}
}
makeatother
tikzset{remember path/.style={save path=tmprotect}}
% https://tex.stackexchange.com/a/12033/121799
tikzset{reverseclip/.style={insert path={(current bounding box.north
east) rectangle (current bounding box.south west)}}}

tikzset{block/.style={rectangle, draw, fill=blue!20,
text width=5em, text centered, rounded corners, minimum height=4em}}

begin{document}
begin{tikzpicture}
node [block,save path=pathX] (X) {X};
node [block] [below left=of X] (A) {A};
node [block] [above left=of X] (a) {a};
node [block] [below right=of X] (B) {B};
node [block] [above right=of X] (b) {b};

begin{scope}
clip[use path=pathX,reverseclip];
path[->] (A) edge[bend right=90] (a);
path[->] (B) edge[bend left=90] (b);
end{scope}
begin{scope}[dashed]
clip[use path=pathX];
path[->] (A) edge[bend right=90] (a);
path[->] (B) edge[bend left=90] (b);
end{scope}

end{tikzpicture}
end{document}


enter image description here






share|improve this answer





















  • @CarLaTeX I would not say it is strictly "better" but each of them has its own advantage. (I upvoted your post, too, of course.)
    – marmot
    Dec 22 at 9:31












  • @CarLaTeX Thanks for saying that but I guess it is a matter of taste.So we cannot argue about it, ;-)
    – marmot
    Dec 22 at 9:35










  • @CarLaTeX To be honest, I like mine better because if the path in yours would hit a rounded corner, it would get clipped incorrectly. This is why I am doing the use path trick. (And personally I do not find reverseclip inelegant, but that's a matter of taste.)
    – marmot
    Dec 22 at 14:47










  • @CarLaTeX I would nevertheless like to argue that you could add [rounded corners] to clip such that it becomes clip[rounded corners] (X.north west) rectangle (X.south east); (which has another simplification: rectangle and 2 corners instead of 4 corners and cycle). To see where that may matter, add a path draw (A.50) -- (b.-130);. Notice also that use path is not something exotic. save path is already part of plain vanilla TikZ, and use path is part of some common libraries like spath3 (and really useful IMHO).
    – marmot
    Dec 22 at 15:34










  • @CarLaTeX I guess it is really a matter of taste. After all we we are all TikZ beginners. ;-) (Instead of using a phantom node, you could just draw the solid paths on the background, which would avoid to draw the node twice.)
    – marmot
    Dec 22 at 17:01



















8














Well, the easiest solution I came up is this one



documentclass[border=1in]{standalone}
usepackage{tikz}
usetikzlibrary{positioning}

tikzstyle{block} = [rectangle, draw, fill=blue!20,
text width=5em, text centered, rounded corners, minimum height=4em]

begin{document}
begin{tikzpicture}
node [block] (X) {X};
node [block] [below left=of X] (A) {A};
node [block] [above left=of X] (a) {a};
node [block] [below right=of X] (B) {B};
node [block] [above right=of X] (b) {b};

path[->] (A) edge[bend right=90] node [left,pos=0.3] {$q(r)$} (a);
path[->] (B) edge[bend left=90] node [right,pos=0.3] {$f(r)$} (b);
node [block] (X) {X};
path[->,dashed] (A) edge[bend right=90] node [left,pos=0.3] { } (a);
path[->,dashed] (B) edge[bend left=90] node [right,pos=0.3] { } (b);
end{tikzpicture}
end{document}


enter image description here






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "85"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f466945%2fhow-to-partially-make-a-segment-of-a-path-dashed%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    11














    Just divide the path in three if you want the second part dashed.



    If you write NodeName.degreee (for example X.130) you can position the end or the beginning of the path exactly where you need. Imagine the node is a circle angle with the east anchor = 0 degrees, so the south anchor is -90, the north = 90, the east = 180, etc.



    documentclass[border=1in]{standalone}
    usepackage{tikz}
    usetikzlibrary{positioning}
    tikzset{
    block/.style={
    rectangle, draw, fill=blue!20,
    text width=5em, text centered, rounded corners, minimum height=4em
    }
    }

    begin{document}
    begin{tikzpicture}
    node [block] (X) {X};
    node [block] [below left=of X] (A) {A};
    node [block] [above left=of X] (a) {a};
    node [block] [below right=of X] (B) {B};
    node [block] [above right=of X] (b) {b};

    draw (A) to[bend right] (X.-130) node[below left=4pt and 5pt] {$q(x)$};
    draw[dashed] (X.-130) to[bend right, looseness=.2] (X.130);
    draw[->] (X.130) to[bend right] (a);

    draw (B) to[bend left] (X.-50) node[below right=4pt and 5pt] {$f(x)$};
    draw[dashed] (X.-50) to[bend left, looseness=.2] (X.50);
    draw[->] (X.50) to[bend left] (b);

    end{tikzpicture}
    end{document}


    enter image description here



    Edit: gorgeous marmot's answer could be simplified without using reverse clipping and putting the straight line behind the X node, like in marya's answer but using on background layer from backgrounds library to not draw it twice.



    documentclass[border=1in]{standalone}
    usepackage{tikz}
    usetikzlibrary{positioning,backgrounds}
    tikzset{
    block/.style={
    rectangle,
    text width=5em, text centered, rounded corners, minimum height=4em, draw, fill=blue!20
    },
    }

    begin{document}
    begin{tikzpicture}
    node[block] (X) {X};
    node [block] [below left=of X] (A) {A};
    node [block] [above left=of X] (a) {a};
    node [block] [below right=of X] (B) {B};
    node [block] [above right=of X] (b) {b};

    begin{scope}[on background layer]
    path[->] (A) edge[bend right=90] node[near start, above left] {$q(x)$} (a);
    path[->] (B) edge[bend left=90] node[near start, above right] {$f(x)$} (b);
    end{scope}

    begin{scope}[dashed]
    clip[rounded corners] (X.north west) rectangle (X.south east);
    path[->] (A) edge[bend right=90] (a);
    path[->] (B) edge[bend left=90] (b);
    end{scope}
    end{tikzpicture}
    end{document}


    enter image description here






    share|improve this answer























    • Oh, now after seeing the image, I understand I wasn't being clear enough. Ive updated the picture to emphasize what I mean by "dashed while inside of X"... sorry about that
      – FooBar
      Dec 22 at 8:03












    • @FooBar See my renewed answer
      – CarLaTeX
      Dec 22 at 8:11
















    11














    Just divide the path in three if you want the second part dashed.



    If you write NodeName.degreee (for example X.130) you can position the end or the beginning of the path exactly where you need. Imagine the node is a circle angle with the east anchor = 0 degrees, so the south anchor is -90, the north = 90, the east = 180, etc.



    documentclass[border=1in]{standalone}
    usepackage{tikz}
    usetikzlibrary{positioning}
    tikzset{
    block/.style={
    rectangle, draw, fill=blue!20,
    text width=5em, text centered, rounded corners, minimum height=4em
    }
    }

    begin{document}
    begin{tikzpicture}
    node [block] (X) {X};
    node [block] [below left=of X] (A) {A};
    node [block] [above left=of X] (a) {a};
    node [block] [below right=of X] (B) {B};
    node [block] [above right=of X] (b) {b};

    draw (A) to[bend right] (X.-130) node[below left=4pt and 5pt] {$q(x)$};
    draw[dashed] (X.-130) to[bend right, looseness=.2] (X.130);
    draw[->] (X.130) to[bend right] (a);

    draw (B) to[bend left] (X.-50) node[below right=4pt and 5pt] {$f(x)$};
    draw[dashed] (X.-50) to[bend left, looseness=.2] (X.50);
    draw[->] (X.50) to[bend left] (b);

    end{tikzpicture}
    end{document}


    enter image description here



    Edit: gorgeous marmot's answer could be simplified without using reverse clipping and putting the straight line behind the X node, like in marya's answer but using on background layer from backgrounds library to not draw it twice.



    documentclass[border=1in]{standalone}
    usepackage{tikz}
    usetikzlibrary{positioning,backgrounds}
    tikzset{
    block/.style={
    rectangle,
    text width=5em, text centered, rounded corners, minimum height=4em, draw, fill=blue!20
    },
    }

    begin{document}
    begin{tikzpicture}
    node[block] (X) {X};
    node [block] [below left=of X] (A) {A};
    node [block] [above left=of X] (a) {a};
    node [block] [below right=of X] (B) {B};
    node [block] [above right=of X] (b) {b};

    begin{scope}[on background layer]
    path[->] (A) edge[bend right=90] node[near start, above left] {$q(x)$} (a);
    path[->] (B) edge[bend left=90] node[near start, above right] {$f(x)$} (b);
    end{scope}

    begin{scope}[dashed]
    clip[rounded corners] (X.north west) rectangle (X.south east);
    path[->] (A) edge[bend right=90] (a);
    path[->] (B) edge[bend left=90] (b);
    end{scope}
    end{tikzpicture}
    end{document}


    enter image description here






    share|improve this answer























    • Oh, now after seeing the image, I understand I wasn't being clear enough. Ive updated the picture to emphasize what I mean by "dashed while inside of X"... sorry about that
      – FooBar
      Dec 22 at 8:03












    • @FooBar See my renewed answer
      – CarLaTeX
      Dec 22 at 8:11














    11












    11








    11






    Just divide the path in three if you want the second part dashed.



    If you write NodeName.degreee (for example X.130) you can position the end or the beginning of the path exactly where you need. Imagine the node is a circle angle with the east anchor = 0 degrees, so the south anchor is -90, the north = 90, the east = 180, etc.



    documentclass[border=1in]{standalone}
    usepackage{tikz}
    usetikzlibrary{positioning}
    tikzset{
    block/.style={
    rectangle, draw, fill=blue!20,
    text width=5em, text centered, rounded corners, minimum height=4em
    }
    }

    begin{document}
    begin{tikzpicture}
    node [block] (X) {X};
    node [block] [below left=of X] (A) {A};
    node [block] [above left=of X] (a) {a};
    node [block] [below right=of X] (B) {B};
    node [block] [above right=of X] (b) {b};

    draw (A) to[bend right] (X.-130) node[below left=4pt and 5pt] {$q(x)$};
    draw[dashed] (X.-130) to[bend right, looseness=.2] (X.130);
    draw[->] (X.130) to[bend right] (a);

    draw (B) to[bend left] (X.-50) node[below right=4pt and 5pt] {$f(x)$};
    draw[dashed] (X.-50) to[bend left, looseness=.2] (X.50);
    draw[->] (X.50) to[bend left] (b);

    end{tikzpicture}
    end{document}


    enter image description here



    Edit: gorgeous marmot's answer could be simplified without using reverse clipping and putting the straight line behind the X node, like in marya's answer but using on background layer from backgrounds library to not draw it twice.



    documentclass[border=1in]{standalone}
    usepackage{tikz}
    usetikzlibrary{positioning,backgrounds}
    tikzset{
    block/.style={
    rectangle,
    text width=5em, text centered, rounded corners, minimum height=4em, draw, fill=blue!20
    },
    }

    begin{document}
    begin{tikzpicture}
    node[block] (X) {X};
    node [block] [below left=of X] (A) {A};
    node [block] [above left=of X] (a) {a};
    node [block] [below right=of X] (B) {B};
    node [block] [above right=of X] (b) {b};

    begin{scope}[on background layer]
    path[->] (A) edge[bend right=90] node[near start, above left] {$q(x)$} (a);
    path[->] (B) edge[bend left=90] node[near start, above right] {$f(x)$} (b);
    end{scope}

    begin{scope}[dashed]
    clip[rounded corners] (X.north west) rectangle (X.south east);
    path[->] (A) edge[bend right=90] (a);
    path[->] (B) edge[bend left=90] (b);
    end{scope}
    end{tikzpicture}
    end{document}


    enter image description here






    share|improve this answer














    Just divide the path in three if you want the second part dashed.



    If you write NodeName.degreee (for example X.130) you can position the end or the beginning of the path exactly where you need. Imagine the node is a circle angle with the east anchor = 0 degrees, so the south anchor is -90, the north = 90, the east = 180, etc.



    documentclass[border=1in]{standalone}
    usepackage{tikz}
    usetikzlibrary{positioning}
    tikzset{
    block/.style={
    rectangle, draw, fill=blue!20,
    text width=5em, text centered, rounded corners, minimum height=4em
    }
    }

    begin{document}
    begin{tikzpicture}
    node [block] (X) {X};
    node [block] [below left=of X] (A) {A};
    node [block] [above left=of X] (a) {a};
    node [block] [below right=of X] (B) {B};
    node [block] [above right=of X] (b) {b};

    draw (A) to[bend right] (X.-130) node[below left=4pt and 5pt] {$q(x)$};
    draw[dashed] (X.-130) to[bend right, looseness=.2] (X.130);
    draw[->] (X.130) to[bend right] (a);

    draw (B) to[bend left] (X.-50) node[below right=4pt and 5pt] {$f(x)$};
    draw[dashed] (X.-50) to[bend left, looseness=.2] (X.50);
    draw[->] (X.50) to[bend left] (b);

    end{tikzpicture}
    end{document}


    enter image description here



    Edit: gorgeous marmot's answer could be simplified without using reverse clipping and putting the straight line behind the X node, like in marya's answer but using on background layer from backgrounds library to not draw it twice.



    documentclass[border=1in]{standalone}
    usepackage{tikz}
    usetikzlibrary{positioning,backgrounds}
    tikzset{
    block/.style={
    rectangle,
    text width=5em, text centered, rounded corners, minimum height=4em, draw, fill=blue!20
    },
    }

    begin{document}
    begin{tikzpicture}
    node[block] (X) {X};
    node [block] [below left=of X] (A) {A};
    node [block] [above left=of X] (a) {a};
    node [block] [below right=of X] (B) {B};
    node [block] [above right=of X] (b) {b};

    begin{scope}[on background layer]
    path[->] (A) edge[bend right=90] node[near start, above left] {$q(x)$} (a);
    path[->] (B) edge[bend left=90] node[near start, above right] {$f(x)$} (b);
    end{scope}

    begin{scope}[dashed]
    clip[rounded corners] (X.north west) rectangle (X.south east);
    path[->] (A) edge[bend right=90] (a);
    path[->] (B) edge[bend left=90] (b);
    end{scope}
    end{tikzpicture}
    end{document}


    enter image description here







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Dec 22 at 17:09

























    answered Dec 22 at 7:50









    CarLaTeX

    29.4k447125




    29.4k447125












    • Oh, now after seeing the image, I understand I wasn't being clear enough. Ive updated the picture to emphasize what I mean by "dashed while inside of X"... sorry about that
      – FooBar
      Dec 22 at 8:03












    • @FooBar See my renewed answer
      – CarLaTeX
      Dec 22 at 8:11


















    • Oh, now after seeing the image, I understand I wasn't being clear enough. Ive updated the picture to emphasize what I mean by "dashed while inside of X"... sorry about that
      – FooBar
      Dec 22 at 8:03












    • @FooBar See my renewed answer
      – CarLaTeX
      Dec 22 at 8:11
















    Oh, now after seeing the image, I understand I wasn't being clear enough. Ive updated the picture to emphasize what I mean by "dashed while inside of X"... sorry about that
    – FooBar
    Dec 22 at 8:03






    Oh, now after seeing the image, I understand I wasn't being clear enough. Ive updated the picture to emphasize what I mean by "dashed while inside of X"... sorry about that
    – FooBar
    Dec 22 at 8:03














    @FooBar See my renewed answer
    – CarLaTeX
    Dec 22 at 8:11




    @FooBar See my renewed answer
    – CarLaTeX
    Dec 22 at 8:11











    10














    Here is a proposal using reverseclip and use path to draw the dashed path inside and the solid one outside. Please note that tikzstyle is slightly deprecated.



    documentclass[border=1in]{standalone}
    usepackage{tikz}
    usetikzlibrary{positioning}
    makeatletter % https://tex.stackexchange.com/a/38995/121799
    tikzset{
    use path/.code={pgfsyssoftpath@setcurrentpath{#1}}
    }
    makeatother
    tikzset{remember path/.style={save path=tmprotect}}
    % https://tex.stackexchange.com/a/12033/121799
    tikzset{reverseclip/.style={insert path={(current bounding box.north
    east) rectangle (current bounding box.south west)}}}

    tikzset{block/.style={rectangle, draw, fill=blue!20,
    text width=5em, text centered, rounded corners, minimum height=4em}}

    begin{document}
    begin{tikzpicture}
    node [block,save path=pathX] (X) {X};
    node [block] [below left=of X] (A) {A};
    node [block] [above left=of X] (a) {a};
    node [block] [below right=of X] (B) {B};
    node [block] [above right=of X] (b) {b};

    begin{scope}
    clip[use path=pathX,reverseclip];
    path[->] (A) edge[bend right=90] (a);
    path[->] (B) edge[bend left=90] (b);
    end{scope}
    begin{scope}[dashed]
    clip[use path=pathX];
    path[->] (A) edge[bend right=90] (a);
    path[->] (B) edge[bend left=90] (b);
    end{scope}

    end{tikzpicture}
    end{document}


    enter image description here






    share|improve this answer





















    • @CarLaTeX I would not say it is strictly "better" but each of them has its own advantage. (I upvoted your post, too, of course.)
      – marmot
      Dec 22 at 9:31












    • @CarLaTeX Thanks for saying that but I guess it is a matter of taste.So we cannot argue about it, ;-)
      – marmot
      Dec 22 at 9:35










    • @CarLaTeX To be honest, I like mine better because if the path in yours would hit a rounded corner, it would get clipped incorrectly. This is why I am doing the use path trick. (And personally I do not find reverseclip inelegant, but that's a matter of taste.)
      – marmot
      Dec 22 at 14:47










    • @CarLaTeX I would nevertheless like to argue that you could add [rounded corners] to clip such that it becomes clip[rounded corners] (X.north west) rectangle (X.south east); (which has another simplification: rectangle and 2 corners instead of 4 corners and cycle). To see where that may matter, add a path draw (A.50) -- (b.-130);. Notice also that use path is not something exotic. save path is already part of plain vanilla TikZ, and use path is part of some common libraries like spath3 (and really useful IMHO).
      – marmot
      Dec 22 at 15:34










    • @CarLaTeX I guess it is really a matter of taste. After all we we are all TikZ beginners. ;-) (Instead of using a phantom node, you could just draw the solid paths on the background, which would avoid to draw the node twice.)
      – marmot
      Dec 22 at 17:01
















    10














    Here is a proposal using reverseclip and use path to draw the dashed path inside and the solid one outside. Please note that tikzstyle is slightly deprecated.



    documentclass[border=1in]{standalone}
    usepackage{tikz}
    usetikzlibrary{positioning}
    makeatletter % https://tex.stackexchange.com/a/38995/121799
    tikzset{
    use path/.code={pgfsyssoftpath@setcurrentpath{#1}}
    }
    makeatother
    tikzset{remember path/.style={save path=tmprotect}}
    % https://tex.stackexchange.com/a/12033/121799
    tikzset{reverseclip/.style={insert path={(current bounding box.north
    east) rectangle (current bounding box.south west)}}}

    tikzset{block/.style={rectangle, draw, fill=blue!20,
    text width=5em, text centered, rounded corners, minimum height=4em}}

    begin{document}
    begin{tikzpicture}
    node [block,save path=pathX] (X) {X};
    node [block] [below left=of X] (A) {A};
    node [block] [above left=of X] (a) {a};
    node [block] [below right=of X] (B) {B};
    node [block] [above right=of X] (b) {b};

    begin{scope}
    clip[use path=pathX,reverseclip];
    path[->] (A) edge[bend right=90] (a);
    path[->] (B) edge[bend left=90] (b);
    end{scope}
    begin{scope}[dashed]
    clip[use path=pathX];
    path[->] (A) edge[bend right=90] (a);
    path[->] (B) edge[bend left=90] (b);
    end{scope}

    end{tikzpicture}
    end{document}


    enter image description here






    share|improve this answer





















    • @CarLaTeX I would not say it is strictly "better" but each of them has its own advantage. (I upvoted your post, too, of course.)
      – marmot
      Dec 22 at 9:31












    • @CarLaTeX Thanks for saying that but I guess it is a matter of taste.So we cannot argue about it, ;-)
      – marmot
      Dec 22 at 9:35










    • @CarLaTeX To be honest, I like mine better because if the path in yours would hit a rounded corner, it would get clipped incorrectly. This is why I am doing the use path trick. (And personally I do not find reverseclip inelegant, but that's a matter of taste.)
      – marmot
      Dec 22 at 14:47










    • @CarLaTeX I would nevertheless like to argue that you could add [rounded corners] to clip such that it becomes clip[rounded corners] (X.north west) rectangle (X.south east); (which has another simplification: rectangle and 2 corners instead of 4 corners and cycle). To see where that may matter, add a path draw (A.50) -- (b.-130);. Notice also that use path is not something exotic. save path is already part of plain vanilla TikZ, and use path is part of some common libraries like spath3 (and really useful IMHO).
      – marmot
      Dec 22 at 15:34










    • @CarLaTeX I guess it is really a matter of taste. After all we we are all TikZ beginners. ;-) (Instead of using a phantom node, you could just draw the solid paths on the background, which would avoid to draw the node twice.)
      – marmot
      Dec 22 at 17:01














    10












    10








    10






    Here is a proposal using reverseclip and use path to draw the dashed path inside and the solid one outside. Please note that tikzstyle is slightly deprecated.



    documentclass[border=1in]{standalone}
    usepackage{tikz}
    usetikzlibrary{positioning}
    makeatletter % https://tex.stackexchange.com/a/38995/121799
    tikzset{
    use path/.code={pgfsyssoftpath@setcurrentpath{#1}}
    }
    makeatother
    tikzset{remember path/.style={save path=tmprotect}}
    % https://tex.stackexchange.com/a/12033/121799
    tikzset{reverseclip/.style={insert path={(current bounding box.north
    east) rectangle (current bounding box.south west)}}}

    tikzset{block/.style={rectangle, draw, fill=blue!20,
    text width=5em, text centered, rounded corners, minimum height=4em}}

    begin{document}
    begin{tikzpicture}
    node [block,save path=pathX] (X) {X};
    node [block] [below left=of X] (A) {A};
    node [block] [above left=of X] (a) {a};
    node [block] [below right=of X] (B) {B};
    node [block] [above right=of X] (b) {b};

    begin{scope}
    clip[use path=pathX,reverseclip];
    path[->] (A) edge[bend right=90] (a);
    path[->] (B) edge[bend left=90] (b);
    end{scope}
    begin{scope}[dashed]
    clip[use path=pathX];
    path[->] (A) edge[bend right=90] (a);
    path[->] (B) edge[bend left=90] (b);
    end{scope}

    end{tikzpicture}
    end{document}


    enter image description here






    share|improve this answer












    Here is a proposal using reverseclip and use path to draw the dashed path inside and the solid one outside. Please note that tikzstyle is slightly deprecated.



    documentclass[border=1in]{standalone}
    usepackage{tikz}
    usetikzlibrary{positioning}
    makeatletter % https://tex.stackexchange.com/a/38995/121799
    tikzset{
    use path/.code={pgfsyssoftpath@setcurrentpath{#1}}
    }
    makeatother
    tikzset{remember path/.style={save path=tmprotect}}
    % https://tex.stackexchange.com/a/12033/121799
    tikzset{reverseclip/.style={insert path={(current bounding box.north
    east) rectangle (current bounding box.south west)}}}

    tikzset{block/.style={rectangle, draw, fill=blue!20,
    text width=5em, text centered, rounded corners, minimum height=4em}}

    begin{document}
    begin{tikzpicture}
    node [block,save path=pathX] (X) {X};
    node [block] [below left=of X] (A) {A};
    node [block] [above left=of X] (a) {a};
    node [block] [below right=of X] (B) {B};
    node [block] [above right=of X] (b) {b};

    begin{scope}
    clip[use path=pathX,reverseclip];
    path[->] (A) edge[bend right=90] (a);
    path[->] (B) edge[bend left=90] (b);
    end{scope}
    begin{scope}[dashed]
    clip[use path=pathX];
    path[->] (A) edge[bend right=90] (a);
    path[->] (B) edge[bend left=90] (b);
    end{scope}

    end{tikzpicture}
    end{document}


    enter image description here







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Dec 22 at 9:22









    marmot

    86.4k499184




    86.4k499184












    • @CarLaTeX I would not say it is strictly "better" but each of them has its own advantage. (I upvoted your post, too, of course.)
      – marmot
      Dec 22 at 9:31












    • @CarLaTeX Thanks for saying that but I guess it is a matter of taste.So we cannot argue about it, ;-)
      – marmot
      Dec 22 at 9:35










    • @CarLaTeX To be honest, I like mine better because if the path in yours would hit a rounded corner, it would get clipped incorrectly. This is why I am doing the use path trick. (And personally I do not find reverseclip inelegant, but that's a matter of taste.)
      – marmot
      Dec 22 at 14:47










    • @CarLaTeX I would nevertheless like to argue that you could add [rounded corners] to clip such that it becomes clip[rounded corners] (X.north west) rectangle (X.south east); (which has another simplification: rectangle and 2 corners instead of 4 corners and cycle). To see where that may matter, add a path draw (A.50) -- (b.-130);. Notice also that use path is not something exotic. save path is already part of plain vanilla TikZ, and use path is part of some common libraries like spath3 (and really useful IMHO).
      – marmot
      Dec 22 at 15:34










    • @CarLaTeX I guess it is really a matter of taste. After all we we are all TikZ beginners. ;-) (Instead of using a phantom node, you could just draw the solid paths on the background, which would avoid to draw the node twice.)
      – marmot
      Dec 22 at 17:01


















    • @CarLaTeX I would not say it is strictly "better" but each of them has its own advantage. (I upvoted your post, too, of course.)
      – marmot
      Dec 22 at 9:31












    • @CarLaTeX Thanks for saying that but I guess it is a matter of taste.So we cannot argue about it, ;-)
      – marmot
      Dec 22 at 9:35










    • @CarLaTeX To be honest, I like mine better because if the path in yours would hit a rounded corner, it would get clipped incorrectly. This is why I am doing the use path trick. (And personally I do not find reverseclip inelegant, but that's a matter of taste.)
      – marmot
      Dec 22 at 14:47










    • @CarLaTeX I would nevertheless like to argue that you could add [rounded corners] to clip such that it becomes clip[rounded corners] (X.north west) rectangle (X.south east); (which has another simplification: rectangle and 2 corners instead of 4 corners and cycle). To see where that may matter, add a path draw (A.50) -- (b.-130);. Notice also that use path is not something exotic. save path is already part of plain vanilla TikZ, and use path is part of some common libraries like spath3 (and really useful IMHO).
      – marmot
      Dec 22 at 15:34










    • @CarLaTeX I guess it is really a matter of taste. After all we we are all TikZ beginners. ;-) (Instead of using a phantom node, you could just draw the solid paths on the background, which would avoid to draw the node twice.)
      – marmot
      Dec 22 at 17:01
















    @CarLaTeX I would not say it is strictly "better" but each of them has its own advantage. (I upvoted your post, too, of course.)
    – marmot
    Dec 22 at 9:31






    @CarLaTeX I would not say it is strictly "better" but each of them has its own advantage. (I upvoted your post, too, of course.)
    – marmot
    Dec 22 at 9:31














    @CarLaTeX Thanks for saying that but I guess it is a matter of taste.So we cannot argue about it, ;-)
    – marmot
    Dec 22 at 9:35




    @CarLaTeX Thanks for saying that but I guess it is a matter of taste.So we cannot argue about it, ;-)
    – marmot
    Dec 22 at 9:35












    @CarLaTeX To be honest, I like mine better because if the path in yours would hit a rounded corner, it would get clipped incorrectly. This is why I am doing the use path trick. (And personally I do not find reverseclip inelegant, but that's a matter of taste.)
    – marmot
    Dec 22 at 14:47




    @CarLaTeX To be honest, I like mine better because if the path in yours would hit a rounded corner, it would get clipped incorrectly. This is why I am doing the use path trick. (And personally I do not find reverseclip inelegant, but that's a matter of taste.)
    – marmot
    Dec 22 at 14:47












    @CarLaTeX I would nevertheless like to argue that you could add [rounded corners] to clip such that it becomes clip[rounded corners] (X.north west) rectangle (X.south east); (which has another simplification: rectangle and 2 corners instead of 4 corners and cycle). To see where that may matter, add a path draw (A.50) -- (b.-130);. Notice also that use path is not something exotic. save path is already part of plain vanilla TikZ, and use path is part of some common libraries like spath3 (and really useful IMHO).
    – marmot
    Dec 22 at 15:34




    @CarLaTeX I would nevertheless like to argue that you could add [rounded corners] to clip such that it becomes clip[rounded corners] (X.north west) rectangle (X.south east); (which has another simplification: rectangle and 2 corners instead of 4 corners and cycle). To see where that may matter, add a path draw (A.50) -- (b.-130);. Notice also that use path is not something exotic. save path is already part of plain vanilla TikZ, and use path is part of some common libraries like spath3 (and really useful IMHO).
    – marmot
    Dec 22 at 15:34












    @CarLaTeX I guess it is really a matter of taste. After all we we are all TikZ beginners. ;-) (Instead of using a phantom node, you could just draw the solid paths on the background, which would avoid to draw the node twice.)
    – marmot
    Dec 22 at 17:01




    @CarLaTeX I guess it is really a matter of taste. After all we we are all TikZ beginners. ;-) (Instead of using a phantom node, you could just draw the solid paths on the background, which would avoid to draw the node twice.)
    – marmot
    Dec 22 at 17:01











    8














    Well, the easiest solution I came up is this one



    documentclass[border=1in]{standalone}
    usepackage{tikz}
    usetikzlibrary{positioning}

    tikzstyle{block} = [rectangle, draw, fill=blue!20,
    text width=5em, text centered, rounded corners, minimum height=4em]

    begin{document}
    begin{tikzpicture}
    node [block] (X) {X};
    node [block] [below left=of X] (A) {A};
    node [block] [above left=of X] (a) {a};
    node [block] [below right=of X] (B) {B};
    node [block] [above right=of X] (b) {b};

    path[->] (A) edge[bend right=90] node [left,pos=0.3] {$q(r)$} (a);
    path[->] (B) edge[bend left=90] node [right,pos=0.3] {$f(r)$} (b);
    node [block] (X) {X};
    path[->,dashed] (A) edge[bend right=90] node [left,pos=0.3] { } (a);
    path[->,dashed] (B) edge[bend left=90] node [right,pos=0.3] { } (b);
    end{tikzpicture}
    end{document}


    enter image description here






    share|improve this answer




























      8














      Well, the easiest solution I came up is this one



      documentclass[border=1in]{standalone}
      usepackage{tikz}
      usetikzlibrary{positioning}

      tikzstyle{block} = [rectangle, draw, fill=blue!20,
      text width=5em, text centered, rounded corners, minimum height=4em]

      begin{document}
      begin{tikzpicture}
      node [block] (X) {X};
      node [block] [below left=of X] (A) {A};
      node [block] [above left=of X] (a) {a};
      node [block] [below right=of X] (B) {B};
      node [block] [above right=of X] (b) {b};

      path[->] (A) edge[bend right=90] node [left,pos=0.3] {$q(r)$} (a);
      path[->] (B) edge[bend left=90] node [right,pos=0.3] {$f(r)$} (b);
      node [block] (X) {X};
      path[->,dashed] (A) edge[bend right=90] node [left,pos=0.3] { } (a);
      path[->,dashed] (B) edge[bend left=90] node [right,pos=0.3] { } (b);
      end{tikzpicture}
      end{document}


      enter image description here






      share|improve this answer


























        8












        8








        8






        Well, the easiest solution I came up is this one



        documentclass[border=1in]{standalone}
        usepackage{tikz}
        usetikzlibrary{positioning}

        tikzstyle{block} = [rectangle, draw, fill=blue!20,
        text width=5em, text centered, rounded corners, minimum height=4em]

        begin{document}
        begin{tikzpicture}
        node [block] (X) {X};
        node [block] [below left=of X] (A) {A};
        node [block] [above left=of X] (a) {a};
        node [block] [below right=of X] (B) {B};
        node [block] [above right=of X] (b) {b};

        path[->] (A) edge[bend right=90] node [left,pos=0.3] {$q(r)$} (a);
        path[->] (B) edge[bend left=90] node [right,pos=0.3] {$f(r)$} (b);
        node [block] (X) {X};
        path[->,dashed] (A) edge[bend right=90] node [left,pos=0.3] { } (a);
        path[->,dashed] (B) edge[bend left=90] node [right,pos=0.3] { } (b);
        end{tikzpicture}
        end{document}


        enter image description here






        share|improve this answer














        Well, the easiest solution I came up is this one



        documentclass[border=1in]{standalone}
        usepackage{tikz}
        usetikzlibrary{positioning}

        tikzstyle{block} = [rectangle, draw, fill=blue!20,
        text width=5em, text centered, rounded corners, minimum height=4em]

        begin{document}
        begin{tikzpicture}
        node [block] (X) {X};
        node [block] [below left=of X] (A) {A};
        node [block] [above left=of X] (a) {a};
        node [block] [below right=of X] (B) {B};
        node [block] [above right=of X] (b) {b};

        path[->] (A) edge[bend right=90] node [left,pos=0.3] {$q(r)$} (a);
        path[->] (B) edge[bend left=90] node [right,pos=0.3] {$f(r)$} (b);
        node [block] (X) {X};
        path[->,dashed] (A) edge[bend right=90] node [left,pos=0.3] { } (a);
        path[->,dashed] (B) edge[bend left=90] node [right,pos=0.3] { } (b);
        end{tikzpicture}
        end{document}


        enter image description here







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Dec 22 at 8:08

























        answered Dec 22 at 7:35









        marya

        1,26911023




        1,26911023






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f466945%2fhow-to-partially-make-a-segment-of-a-path-dashed%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Сан-Квентин

            8-я гвардейская общевойсковая армия

            Алькесар