I am having trouble completing the proof if $a \mid b$ then $\gcd(a,b) = |a|$.
My attempt: If $a\mid b$ there is a $k \in \mathbb{Z}$ such that $b = ak$. Let $d = \gcd(a,b)$. Then $d \mid a$ and $d\mid b$ so by hypothesis we have $d\mid a$ and $d\mid ak$. Hence, $d \leq \gcd(a,ak)$. We can easily see that the largest common denominator of $a$ and $ak$ is $|a|$, thus $d \leq\gcd(a,ak) = |a|$ so $\gcd(a,b) \leq |a|$.
I am stuck and not sure how to show the reverse inequality $|a| \leq \gcd(a,b)$ to complete the proof.
Clearly $|a|$ is a divisor of $a$.
Also, since $b=ak$. We have $b=\operatorname{sign}(b)|a||k|$, that is $|a|$ is a divisor of $b$.
Hence as a common divisor of $a$ and $b$., it is at most the greatest common divisor of $\gcd(a,b)$.
$$|a| \le \gcd(a,b)$$