7

I have been trying to get this figure:

enter image description here

Can you offer me some guidance as to how to correct my code and also get the arrow heads in the center of the lines? Thanks.

Here is my code:

\documentclass[border=3pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,backgrounds,decorations.pathreplacing}

\begin{document}

\begin{tikzpicture}[thick]
\draw[draw=blue!30,-latex] (0,0) node{$(x_{0},y_{0})$} -- (45:3) node {$K^{-}_{k+1}$};
\draw[draw=blue!30,dashed,-latex] (0,0) -- (0:2);
\draw[draw=blue!30,dashed,latex-] (2,0) node {$K_{k+1}$} -- (2,2) ;
\draw[draw=blue!30,dashed,-latex] (2,0) -- (4,0);
\draw[draw=blue!30,-latex] (2,0) node{$(x_{0},y_{0})$} -- (45:4) node {$K^{-}_{k+2}$};
\end{tikzpicture}

\end{document}
7

enter image description here

By ussing decorations.markings TikZ library:

\documentclass[border=3pt,tikz]{standalone}
    \usetikzlibrary{decorations.markings}

    \begin{document}
\begin{tikzpicture}[> = latex,
     decoration = {markings,mark=at position .75 
                            with {\arrow[very thick]{latex}}},
    arrow/.style = {draw=blue!30,thick},
dasharrow/.style = {arrow,densely dashed}
                    ]
\draw[arrow,postaction={decorate}]        
                    (0,0) node[below]{$(x_{0},y_{0})$}
                          -- (45:3) node[above] {$K^{-}_{k+1}$};
\draw[dasharrow,->] (0,0) -- (2,0)  node[below] {$K_{k+1}$};
\draw[dasharrow,postaction={decorate}] (45:3) -- (2,0);
\draw[dasharrow,->] (2,0) -- (4,0)     node[below] {$K_{k+2}$};
\draw[arrow,postaction={decorate}]        
                    (2,0) -- ++ (45:3) node[above] {$K^{-}_{k+2}$};
\draw[dasharrow,postaction={decorate}] 
                    (2,0) + (45:3) -- (4,0);
\end{tikzpicture}
        \end{document}

Note: the angle between horizontal and vertical lines are not 90 degrees. If you like to have it, you need to redefined coordinates for horizontal arrows.

Edit: ups, in rush I didn't upload last image neither MWE code ... now is corrected.

  • @Joe, you are welcome. Happy TeXing! – Zarko Nov 21 '15 at 21:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.