This is the process of Euclidean Algorithm to find $\gcd(a,b)$. Could anyone help me hơ to draw the process of division? Thank all
Asked
Active
Viewed 252 times
-1
Minh
- 173
-
1Hi Minh, welcome to TeX.SX! This is your fifth question, and all are of the form: "Here is a picture, who can do it for me?" So far, it worked well, but in case you don't get an answer, consider to try it first yourself and then ask specific questions when you get stuck, showing your code that you have at this point. Good luck! – gernot Feb 14 '21 at 10:48
1 Answers
2
Does it work for you?
\documentclass[tikz,border=3.14159]{standalone}
\usetikzlibrary{positioning}
\begin{document}
\tikzset{every node/.style={minimum width=25pt, minimum height=15pt}}
\begin{tikzpicture}[node distance=0pt]
\node (R1) at (0,0) {288};
\foreach \d/\q/\r [count = \i] in
{804/2/228,
288/1/60,
228/3/48,
60/1/12,
48/4/0}
%
{
\pgfmathtruncatemacro{\j}{\i+1}
\node[below= of R\i] (Q\i) {\q};
\node[left =of R\i] (D\i) {\d};
\node[below= of D\i] (R\j) {\r};
\draw [shorten >=4pt] (R\i.south west) -- (R\i.south east);
\draw(R\i.north west) -- (Q\i.south west);
}
\end{tikzpicture}
\end{document}
SebGlav
- 19,186
-
1
-
1I edited to change the shortening to 4pt, since it seemed better to my eyes. – SebGlav Feb 14 '21 at 10:58
-
1Could be interesting to mix this solution with the script in this post: https://tex.stackexchange.com/questions/583321/euclidean-algorithm-command – SebGlav Feb 14 '21 at 11:19
