Addition/Multiplication table generator
Bash + BSD Utils, 62 bytes

l=$[$1*$1-1]
eval echo \$[{1..$1}$2{1..$1}]|rs -g${#l} $[$1+1]

This calculates the number of spaces as per &quot;number of digits in (dimension^2)-1&quot;, and not as shown in the example output, as currently written.
This answer is very similar to this one.
Works out-of-the-box on macOS.  rs may need to be installed on Linux systems:
sudo apt-get install rs