3

My code:

\documentclass{scrartcl}
\usepackage{tikz}

\begin{document}

  \begin{tikzpicture}

    \draw
      [->] (0, 0) |- (1, 0);
    \draw
           (1, 0) |- (2, 1);

  \end{tikzpicture}

\end{document}

It is possible to use a single draw command to achieve the same result (arrow tip appears only at point (1, 0))?

Thank you for your effort in advance!

5

First, draw the lines without arrow and the line with arrow comes last:

\documentclass{scrartcl}
\usepackage{tikz}

\begin{document}

  \begin{tikzpicture}

    \draw[->]
      (1, 0) |- (2, 1)
      (0, 0) -- (1, 0);

  \end{tikzpicture}

\end{document}

Result

| improve this answer | |
  • Hello @Heiko Oberdiek! Thank you for your answer! I like it most. One thing: The |- operation between (0, 0) and (1, 0) isn't needed, right? -- is enough? – Su-47 Apr 17 '18 at 21:51
  • @Su-47 Yes, (0, 0) -- (1, 0) works. Answer updated. – Heiko Oberdiek Apr 18 '18 at 4:34
5

it is possible, but code is not (much) shorter than with two \draw commands:

\documentclass[tikz,margin=3mm]{standalone}

\begin{document}
%%% first case
    \begin{tikzpicture} 
\draw (0,0) edge[->] (1,0) (1,0) |- (2,1); 
    \end{tikzpicture}
%%% second case
    \begin{tikzpicture}
\draw   (1,0) edge[<-] (0,0) |- (2,1);
    \end{tikzpicture}
\end{document}

in the both cases the result is the same:

enter image description here

| improve this answer | |
  • Hello @Zarko! Thank you for your answer! That's an easy one! I don't have the experience with the edge command. I will read about it in the manual. – Su-47 Apr 17 '18 at 21:42

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.