2

Inspired by the question How to draw a line passing through a point and parallel to another? I'm trying to do some arithmetic with coordinates. The code below does not work, but I hope that with a small change it will. Basically

  • in %Q1, I'm trying to add a vector (1,1) to (x) to obtain (y)
  • in %Q2, I'm trying to add a vector defined by a distance 1.5 and an angle 270° to (x) to obtain (y)
  • %Q3 is the same as %Q2 in another context (probably the same syntax also)

.

\documentclass{article}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usetikzlibrary{calc,patterns,angles,quotes}

\begin{document}
\begin{center}
\begin{tikzpicture}[dot/.style={circle,inner sep=1pt,fill,label={$#1$},name=#1},
  extended line/.style={shorten >=-#1,shorten <=-#1},
  extended line/.default=1cm]

\node [dot=x] at (0,0) {};
% --------
%\node [dot=y] at (x) +($(1,1)$) {};        %Q1
%\node [dot=y] at (x) +($(1.5;270)$) {};    %Q2
\node [dot=y] at (x) ++(1.5;270) {};        %Q2
% --------
\draw [extended line=0.5cm] (x) -- (y);
\end{tikzpicture}
\end{center}
\begin{center}
\begin{tikzpicture}[]

\ccordinate (a) at (0,0);
\ccordinate (b) at (a)+(2;45);              %Q3
\draw [extended line=0.5cm] (a) -- (b);
\end{tikzpicture}
\end{center}

\end{document}
PeptideChain
  • 1,335
  • So what exactly is your question? you need help correcting your code? ccordinate should coordinate, (2;45) should be (2,45), by syntax for calc you must write \coordinate (b) at ($(a)+(2,45)$); I recommend you read the basic of TikZ first – Black Mild Aug 15 '19 at 07:17
  • for polar coordiantes you should use a : instead of ;. 2. You should do the coordinate operations inisde $..$. 3. There are some typo - it's \coordinate not \ccordinate
  • – nidhin Aug 15 '19 at 07:18