Two lstlistings side by side with refering arrow












7














SE



I am trying to draw the image below in LaTeX using lstlisting, tikzpicture, minipage, and tabular
Target picture that we try to draw



The code that I got so far can be seen below



documentclass{article}
usepackage[utf8]{inputenc}

usepackage{tikz}
usetikzlibrary{tikzmark}
usepackage{listings}

lstset{language=C,
basicstyle=ttfamily,
frame=single,
keywordstyle=color{blue}ttfamily,
stringstyle=color{red}ttfamily,
commentstyle=color{green}ttfamily,
morecomment=[l][color{magenta}]{#}
}

begin{document}

begin{minipage}{0.8textwidth}

begin{tikzpicture}

draw[- >,overlay] (1.5,-2.8) -- node [below] {(int, int)} (4,-0.8);

end{tikzpicture}

begin{tabular}{cc}
begin{lstlisting}[language=C]
void foo()
{
int q = 5;
int l = 6;

bar(q, l);

}
end{lstlisting}

&
begin{lstlisting}[language=C]
void bar(int a, int b)
{
...
...
...
...
}
end{lstlisting}

end{tabular}

end{minipage}

end{document}


The code above results in the following piece of 'art'
Result from the code above



Is there anyone that can polish this 'art', so it looks a bit more to the target image?



With kind regards,



Xhendos



EDIT:
Changed my code so it is compileable










share|improve this question
























  • Please post a compilable example with documentclass, the required packages etc. Not just a fragment.
    – Christian Hupfer
    16 hours ago










  • Sorry @ChristianHupfer. The code is now compileable
    – Xhendos
    16 hours ago
















7














SE



I am trying to draw the image below in LaTeX using lstlisting, tikzpicture, minipage, and tabular
Target picture that we try to draw



The code that I got so far can be seen below



documentclass{article}
usepackage[utf8]{inputenc}

usepackage{tikz}
usetikzlibrary{tikzmark}
usepackage{listings}

lstset{language=C,
basicstyle=ttfamily,
frame=single,
keywordstyle=color{blue}ttfamily,
stringstyle=color{red}ttfamily,
commentstyle=color{green}ttfamily,
morecomment=[l][color{magenta}]{#}
}

begin{document}

begin{minipage}{0.8textwidth}

begin{tikzpicture}

draw[- >,overlay] (1.5,-2.8) -- node [below] {(int, int)} (4,-0.8);

end{tikzpicture}

begin{tabular}{cc}
begin{lstlisting}[language=C]
void foo()
{
int q = 5;
int l = 6;

bar(q, l);

}
end{lstlisting}

&
begin{lstlisting}[language=C]
void bar(int a, int b)
{
...
...
...
...
}
end{lstlisting}

end{tabular}

end{minipage}

end{document}


The code above results in the following piece of 'art'
Result from the code above



Is there anyone that can polish this 'art', so it looks a bit more to the target image?



With kind regards,



Xhendos



EDIT:
Changed my code so it is compileable










share|improve this question
























  • Please post a compilable example with documentclass, the required packages etc. Not just a fragment.
    – Christian Hupfer
    16 hours ago










  • Sorry @ChristianHupfer. The code is now compileable
    – Xhendos
    16 hours ago














7












7








7


3





SE



I am trying to draw the image below in LaTeX using lstlisting, tikzpicture, minipage, and tabular
Target picture that we try to draw



The code that I got so far can be seen below



documentclass{article}
usepackage[utf8]{inputenc}

usepackage{tikz}
usetikzlibrary{tikzmark}
usepackage{listings}

lstset{language=C,
basicstyle=ttfamily,
frame=single,
keywordstyle=color{blue}ttfamily,
stringstyle=color{red}ttfamily,
commentstyle=color{green}ttfamily,
morecomment=[l][color{magenta}]{#}
}

begin{document}

begin{minipage}{0.8textwidth}

begin{tikzpicture}

draw[- >,overlay] (1.5,-2.8) -- node [below] {(int, int)} (4,-0.8);

end{tikzpicture}

begin{tabular}{cc}
begin{lstlisting}[language=C]
void foo()
{
int q = 5;
int l = 6;

bar(q, l);

}
end{lstlisting}

&
begin{lstlisting}[language=C]
void bar(int a, int b)
{
...
...
...
...
}
end{lstlisting}

end{tabular}

end{minipage}

end{document}


The code above results in the following piece of 'art'
Result from the code above



Is there anyone that can polish this 'art', so it looks a bit more to the target image?



With kind regards,



Xhendos



EDIT:
Changed my code so it is compileable










share|improve this question















SE



I am trying to draw the image below in LaTeX using lstlisting, tikzpicture, minipage, and tabular
Target picture that we try to draw



The code that I got so far can be seen below



documentclass{article}
usepackage[utf8]{inputenc}

usepackage{tikz}
usetikzlibrary{tikzmark}
usepackage{listings}

lstset{language=C,
basicstyle=ttfamily,
frame=single,
keywordstyle=color{blue}ttfamily,
stringstyle=color{red}ttfamily,
commentstyle=color{green}ttfamily,
morecomment=[l][color{magenta}]{#}
}

begin{document}

begin{minipage}{0.8textwidth}

begin{tikzpicture}

draw[- >,overlay] (1.5,-2.8) -- node [below] {(int, int)} (4,-0.8);

end{tikzpicture}

begin{tabular}{cc}
begin{lstlisting}[language=C]
void foo()
{
int q = 5;
int l = 6;

bar(q, l);

}
end{lstlisting}

&
begin{lstlisting}[language=C]
void bar(int a, int b)
{
...
...
...
...
}
end{lstlisting}

end{tabular}

end{minipage}

end{document}


The code above results in the following piece of 'art'
Result from the code above



Is there anyone that can polish this 'art', so it looks a bit more to the target image?



With kind regards,



Xhendos



EDIT:
Changed my code so it is compileable







tikz-pgf arrows code tikzmark lstlisting






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 16 hours ago

























asked 16 hours ago









Xhendos

404




404












  • Please post a compilable example with documentclass, the required packages etc. Not just a fragment.
    – Christian Hupfer
    16 hours ago










  • Sorry @ChristianHupfer. The code is now compileable
    – Xhendos
    16 hours ago


















  • Please post a compilable example with documentclass, the required packages etc. Not just a fragment.
    – Christian Hupfer
    16 hours ago










  • Sorry @ChristianHupfer. The code is now compileable
    – Xhendos
    16 hours ago
















Please post a compilable example with documentclass, the required packages etc. Not just a fragment.
– Christian Hupfer
16 hours ago




Please post a compilable example with documentclass, the required packages etc. Not just a fragment.
– Christian Hupfer
16 hours ago












Sorry @ChristianHupfer. The code is now compileable
– Xhendos
16 hours ago




Sorry @ChristianHupfer. The code is now compileable
– Xhendos
16 hours ago










2 Answers
2






active

oldest

votes


















4














tikzmark, which you are loading, has a library for that purpose, listings, which allows you to refer to lines of the code without actually modifying it. And I am using this nice answer.



documentclass{article}
usepackage{listings}
usepackage{tikz}
usetikzlibrary{tikzmark}
usetikzmarklibrary{listings}
lstset{language=C,
basicstyle=ttfamily,
%frame=single,
keywordstyle=color{blue}ttfamily,
stringstyle=color{red}ttfamily,
commentstyle=color{green}ttfamily,
morecomment=[l][color{magenta}]{#}
}

newcounter{tmkcount}
tikzset{
use tikzmark/.style={
remember picture,
overlay,
execute at end picture={
stepcounter{tmkcount}
},
},
tikzmark suffix={-thetmkcount}
}
begin{document}
%begin{minipage}{0.8textwidth}

begin{tabular}{|l|p{2cm}|l|}
multicolumn{1}{l}{texttt{file_x.c}} &
multicolumn{1}{l}{} &
multicolumn{1}{l}{texttt{file_y.c}}\
cline{1-1} cline{3-3}
begin{lstlisting}[language=C,name=codeL]
void foo()
{
int q = 5;
int l = 6;

bar(q, l);

}
end{lstlisting}
begin{tikzpicture}[use tikzmark]
coordinate (aux) at (pic cs:line-codeL-6-end);
end{tikzpicture}
& &
begin{lstlisting}[language=C,name=codeR]
void bar(int a, int b)
{
...
...
...
...
...
}
end{lstlisting}\
cline{1-1} cline{3-3}
end{tabular}
begin{tikzpicture}[use tikzmark]
draw[-latex] ([yshift=2ex,xshift=-3ex]aux) to[bend left=10]
node[midway,above,sloped]{(int,int)} (pic cs:line-codeR-1-start);
end{tikzpicture}
%end{minipage}
end{document}


enter image description here






share|improve this answer























  • I don't know how you do it, but you always surprise me.
    – Xhendos
    15 hours ago










  • @Xhendos Thanks! It's actually all LoopSpace's magic I am trying to use here.
    – marmot
    15 hours ago



















4














as tikz image:



documentclass{article}
usepackage{tikz}
usetikzlibrary{positioning, quotes}
usepackage{listings}
lstset{language=C,
basicstyle=ttfamily,
keywordstyle=color{blue}ttfamily,
stringstyle=color{red}ttfamily,
commentstyle=color{green}ttfamily,
morecomment=[l][color{magenta}]{#}
}

begin{document}
begin{tikzpicture}[
node distance = 22mm,
box/.style = {draw, align=left}
]
node (a) [box]
{hspace*{-2em}%
begin{lstlisting}[language=C]
void foo()
{
int q = 5;
int l = 6;

bar(q, l);
}
end{lstlisting}
};
node (b) [box, right=of a]
{hspace*{-2em}%
begin{lstlisting}[language=C]
void bar(int a, int b)
{
...
...
...
...
}
end{lstlisting}
};
draw[->, black!75] ([shift={(2.2,-4.4ex)}] a.west) to [pos=0.7,"{(int,int)}", sloped] ([shift={(2ex,8ex)}] b.west);
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%2f468375%2ftwo-lstlistings-side-by-side-with-refering-arrow%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    4














    tikzmark, which you are loading, has a library for that purpose, listings, which allows you to refer to lines of the code without actually modifying it. And I am using this nice answer.



    documentclass{article}
    usepackage{listings}
    usepackage{tikz}
    usetikzlibrary{tikzmark}
    usetikzmarklibrary{listings}
    lstset{language=C,
    basicstyle=ttfamily,
    %frame=single,
    keywordstyle=color{blue}ttfamily,
    stringstyle=color{red}ttfamily,
    commentstyle=color{green}ttfamily,
    morecomment=[l][color{magenta}]{#}
    }

    newcounter{tmkcount}
    tikzset{
    use tikzmark/.style={
    remember picture,
    overlay,
    execute at end picture={
    stepcounter{tmkcount}
    },
    },
    tikzmark suffix={-thetmkcount}
    }
    begin{document}
    %begin{minipage}{0.8textwidth}

    begin{tabular}{|l|p{2cm}|l|}
    multicolumn{1}{l}{texttt{file_x.c}} &
    multicolumn{1}{l}{} &
    multicolumn{1}{l}{texttt{file_y.c}}\
    cline{1-1} cline{3-3}
    begin{lstlisting}[language=C,name=codeL]
    void foo()
    {
    int q = 5;
    int l = 6;

    bar(q, l);

    }
    end{lstlisting}
    begin{tikzpicture}[use tikzmark]
    coordinate (aux) at (pic cs:line-codeL-6-end);
    end{tikzpicture}
    & &
    begin{lstlisting}[language=C,name=codeR]
    void bar(int a, int b)
    {
    ...
    ...
    ...
    ...
    ...
    }
    end{lstlisting}\
    cline{1-1} cline{3-3}
    end{tabular}
    begin{tikzpicture}[use tikzmark]
    draw[-latex] ([yshift=2ex,xshift=-3ex]aux) to[bend left=10]
    node[midway,above,sloped]{(int,int)} (pic cs:line-codeR-1-start);
    end{tikzpicture}
    %end{minipage}
    end{document}


    enter image description here






    share|improve this answer























    • I don't know how you do it, but you always surprise me.
      – Xhendos
      15 hours ago










    • @Xhendos Thanks! It's actually all LoopSpace's magic I am trying to use here.
      – marmot
      15 hours ago
















    4














    tikzmark, which you are loading, has a library for that purpose, listings, which allows you to refer to lines of the code without actually modifying it. And I am using this nice answer.



    documentclass{article}
    usepackage{listings}
    usepackage{tikz}
    usetikzlibrary{tikzmark}
    usetikzmarklibrary{listings}
    lstset{language=C,
    basicstyle=ttfamily,
    %frame=single,
    keywordstyle=color{blue}ttfamily,
    stringstyle=color{red}ttfamily,
    commentstyle=color{green}ttfamily,
    morecomment=[l][color{magenta}]{#}
    }

    newcounter{tmkcount}
    tikzset{
    use tikzmark/.style={
    remember picture,
    overlay,
    execute at end picture={
    stepcounter{tmkcount}
    },
    },
    tikzmark suffix={-thetmkcount}
    }
    begin{document}
    %begin{minipage}{0.8textwidth}

    begin{tabular}{|l|p{2cm}|l|}
    multicolumn{1}{l}{texttt{file_x.c}} &
    multicolumn{1}{l}{} &
    multicolumn{1}{l}{texttt{file_y.c}}\
    cline{1-1} cline{3-3}
    begin{lstlisting}[language=C,name=codeL]
    void foo()
    {
    int q = 5;
    int l = 6;

    bar(q, l);

    }
    end{lstlisting}
    begin{tikzpicture}[use tikzmark]
    coordinate (aux) at (pic cs:line-codeL-6-end);
    end{tikzpicture}
    & &
    begin{lstlisting}[language=C,name=codeR]
    void bar(int a, int b)
    {
    ...
    ...
    ...
    ...
    ...
    }
    end{lstlisting}\
    cline{1-1} cline{3-3}
    end{tabular}
    begin{tikzpicture}[use tikzmark]
    draw[-latex] ([yshift=2ex,xshift=-3ex]aux) to[bend left=10]
    node[midway,above,sloped]{(int,int)} (pic cs:line-codeR-1-start);
    end{tikzpicture}
    %end{minipage}
    end{document}


    enter image description here






    share|improve this answer























    • I don't know how you do it, but you always surprise me.
      – Xhendos
      15 hours ago










    • @Xhendos Thanks! It's actually all LoopSpace's magic I am trying to use here.
      – marmot
      15 hours ago














    4












    4








    4






    tikzmark, which you are loading, has a library for that purpose, listings, which allows you to refer to lines of the code without actually modifying it. And I am using this nice answer.



    documentclass{article}
    usepackage{listings}
    usepackage{tikz}
    usetikzlibrary{tikzmark}
    usetikzmarklibrary{listings}
    lstset{language=C,
    basicstyle=ttfamily,
    %frame=single,
    keywordstyle=color{blue}ttfamily,
    stringstyle=color{red}ttfamily,
    commentstyle=color{green}ttfamily,
    morecomment=[l][color{magenta}]{#}
    }

    newcounter{tmkcount}
    tikzset{
    use tikzmark/.style={
    remember picture,
    overlay,
    execute at end picture={
    stepcounter{tmkcount}
    },
    },
    tikzmark suffix={-thetmkcount}
    }
    begin{document}
    %begin{minipage}{0.8textwidth}

    begin{tabular}{|l|p{2cm}|l|}
    multicolumn{1}{l}{texttt{file_x.c}} &
    multicolumn{1}{l}{} &
    multicolumn{1}{l}{texttt{file_y.c}}\
    cline{1-1} cline{3-3}
    begin{lstlisting}[language=C,name=codeL]
    void foo()
    {
    int q = 5;
    int l = 6;

    bar(q, l);

    }
    end{lstlisting}
    begin{tikzpicture}[use tikzmark]
    coordinate (aux) at (pic cs:line-codeL-6-end);
    end{tikzpicture}
    & &
    begin{lstlisting}[language=C,name=codeR]
    void bar(int a, int b)
    {
    ...
    ...
    ...
    ...
    ...
    }
    end{lstlisting}\
    cline{1-1} cline{3-3}
    end{tabular}
    begin{tikzpicture}[use tikzmark]
    draw[-latex] ([yshift=2ex,xshift=-3ex]aux) to[bend left=10]
    node[midway,above,sloped]{(int,int)} (pic cs:line-codeR-1-start);
    end{tikzpicture}
    %end{minipage}
    end{document}


    enter image description here






    share|improve this answer














    tikzmark, which you are loading, has a library for that purpose, listings, which allows you to refer to lines of the code without actually modifying it. And I am using this nice answer.



    documentclass{article}
    usepackage{listings}
    usepackage{tikz}
    usetikzlibrary{tikzmark}
    usetikzmarklibrary{listings}
    lstset{language=C,
    basicstyle=ttfamily,
    %frame=single,
    keywordstyle=color{blue}ttfamily,
    stringstyle=color{red}ttfamily,
    commentstyle=color{green}ttfamily,
    morecomment=[l][color{magenta}]{#}
    }

    newcounter{tmkcount}
    tikzset{
    use tikzmark/.style={
    remember picture,
    overlay,
    execute at end picture={
    stepcounter{tmkcount}
    },
    },
    tikzmark suffix={-thetmkcount}
    }
    begin{document}
    %begin{minipage}{0.8textwidth}

    begin{tabular}{|l|p{2cm}|l|}
    multicolumn{1}{l}{texttt{file_x.c}} &
    multicolumn{1}{l}{} &
    multicolumn{1}{l}{texttt{file_y.c}}\
    cline{1-1} cline{3-3}
    begin{lstlisting}[language=C,name=codeL]
    void foo()
    {
    int q = 5;
    int l = 6;

    bar(q, l);

    }
    end{lstlisting}
    begin{tikzpicture}[use tikzmark]
    coordinate (aux) at (pic cs:line-codeL-6-end);
    end{tikzpicture}
    & &
    begin{lstlisting}[language=C,name=codeR]
    void bar(int a, int b)
    {
    ...
    ...
    ...
    ...
    ...
    }
    end{lstlisting}\
    cline{1-1} cline{3-3}
    end{tabular}
    begin{tikzpicture}[use tikzmark]
    draw[-latex] ([yshift=2ex,xshift=-3ex]aux) to[bend left=10]
    node[midway,above,sloped]{(int,int)} (pic cs:line-codeR-1-start);
    end{tikzpicture}
    %end{minipage}
    end{document}


    enter image description here







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited 16 hours ago

























    answered 16 hours ago









    marmot

    88.3k4102190




    88.3k4102190












    • I don't know how you do it, but you always surprise me.
      – Xhendos
      15 hours ago










    • @Xhendos Thanks! It's actually all LoopSpace's magic I am trying to use here.
      – marmot
      15 hours ago


















    • I don't know how you do it, but you always surprise me.
      – Xhendos
      15 hours ago










    • @Xhendos Thanks! It's actually all LoopSpace's magic I am trying to use here.
      – marmot
      15 hours ago
















    I don't know how you do it, but you always surprise me.
    – Xhendos
    15 hours ago




    I don't know how you do it, but you always surprise me.
    – Xhendos
    15 hours ago












    @Xhendos Thanks! It's actually all LoopSpace's magic I am trying to use here.
    – marmot
    15 hours ago




    @Xhendos Thanks! It's actually all LoopSpace's magic I am trying to use here.
    – marmot
    15 hours ago











    4














    as tikz image:



    documentclass{article}
    usepackage{tikz}
    usetikzlibrary{positioning, quotes}
    usepackage{listings}
    lstset{language=C,
    basicstyle=ttfamily,
    keywordstyle=color{blue}ttfamily,
    stringstyle=color{red}ttfamily,
    commentstyle=color{green}ttfamily,
    morecomment=[l][color{magenta}]{#}
    }

    begin{document}
    begin{tikzpicture}[
    node distance = 22mm,
    box/.style = {draw, align=left}
    ]
    node (a) [box]
    {hspace*{-2em}%
    begin{lstlisting}[language=C]
    void foo()
    {
    int q = 5;
    int l = 6;

    bar(q, l);
    }
    end{lstlisting}
    };
    node (b) [box, right=of a]
    {hspace*{-2em}%
    begin{lstlisting}[language=C]
    void bar(int a, int b)
    {
    ...
    ...
    ...
    ...
    }
    end{lstlisting}
    };
    draw[->, black!75] ([shift={(2.2,-4.4ex)}] a.west) to [pos=0.7,"{(int,int)}", sloped] ([shift={(2ex,8ex)}] b.west);
    end{tikzpicture}
    end{document}


    enter image description here






    share|improve this answer




























      4














      as tikz image:



      documentclass{article}
      usepackage{tikz}
      usetikzlibrary{positioning, quotes}
      usepackage{listings}
      lstset{language=C,
      basicstyle=ttfamily,
      keywordstyle=color{blue}ttfamily,
      stringstyle=color{red}ttfamily,
      commentstyle=color{green}ttfamily,
      morecomment=[l][color{magenta}]{#}
      }

      begin{document}
      begin{tikzpicture}[
      node distance = 22mm,
      box/.style = {draw, align=left}
      ]
      node (a) [box]
      {hspace*{-2em}%
      begin{lstlisting}[language=C]
      void foo()
      {
      int q = 5;
      int l = 6;

      bar(q, l);
      }
      end{lstlisting}
      };
      node (b) [box, right=of a]
      {hspace*{-2em}%
      begin{lstlisting}[language=C]
      void bar(int a, int b)
      {
      ...
      ...
      ...
      ...
      }
      end{lstlisting}
      };
      draw[->, black!75] ([shift={(2.2,-4.4ex)}] a.west) to [pos=0.7,"{(int,int)}", sloped] ([shift={(2ex,8ex)}] b.west);
      end{tikzpicture}
      end{document}


      enter image description here






      share|improve this answer


























        4












        4








        4






        as tikz image:



        documentclass{article}
        usepackage{tikz}
        usetikzlibrary{positioning, quotes}
        usepackage{listings}
        lstset{language=C,
        basicstyle=ttfamily,
        keywordstyle=color{blue}ttfamily,
        stringstyle=color{red}ttfamily,
        commentstyle=color{green}ttfamily,
        morecomment=[l][color{magenta}]{#}
        }

        begin{document}
        begin{tikzpicture}[
        node distance = 22mm,
        box/.style = {draw, align=left}
        ]
        node (a) [box]
        {hspace*{-2em}%
        begin{lstlisting}[language=C]
        void foo()
        {
        int q = 5;
        int l = 6;

        bar(q, l);
        }
        end{lstlisting}
        };
        node (b) [box, right=of a]
        {hspace*{-2em}%
        begin{lstlisting}[language=C]
        void bar(int a, int b)
        {
        ...
        ...
        ...
        ...
        }
        end{lstlisting}
        };
        draw[->, black!75] ([shift={(2.2,-4.4ex)}] a.west) to [pos=0.7,"{(int,int)}", sloped] ([shift={(2ex,8ex)}] b.west);
        end{tikzpicture}
        end{document}


        enter image description here






        share|improve this answer














        as tikz image:



        documentclass{article}
        usepackage{tikz}
        usetikzlibrary{positioning, quotes}
        usepackage{listings}
        lstset{language=C,
        basicstyle=ttfamily,
        keywordstyle=color{blue}ttfamily,
        stringstyle=color{red}ttfamily,
        commentstyle=color{green}ttfamily,
        morecomment=[l][color{magenta}]{#}
        }

        begin{document}
        begin{tikzpicture}[
        node distance = 22mm,
        box/.style = {draw, align=left}
        ]
        node (a) [box]
        {hspace*{-2em}%
        begin{lstlisting}[language=C]
        void foo()
        {
        int q = 5;
        int l = 6;

        bar(q, l);
        }
        end{lstlisting}
        };
        node (b) [box, right=of a]
        {hspace*{-2em}%
        begin{lstlisting}[language=C]
        void bar(int a, int b)
        {
        ...
        ...
        ...
        ...
        }
        end{lstlisting}
        };
        draw[->, black!75] ([shift={(2.2,-4.4ex)}] a.west) to [pos=0.7,"{(int,int)}", sloped] ([shift={(2ex,8ex)}] b.west);
        end{tikzpicture}
        end{document}


        enter image description here







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 15 hours ago

























        answered 16 hours ago









        Zarko

        121k865157




        121k865157






























            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%2f468375%2ftwo-lstlistings-side-by-side-with-refering-arrow%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

            1300-talet

            1300-talet

            Display a custom attribute below product name in the front-end Magento 1.9.3.8