How to adjust alignment within Math ($$)?

You don’t have to use the alignment point after everything, you can use only the amount that is enough for it to look good. Additionally, in cases you should use , as a case delimiter (instead of using explicit line breaks):

$ cases(
   &2&y_1 +  &y_2 = x_1,
   & &y_1 + 2&y_2 = x_2,
  -&2&y_1 + 3&y_2 = x_3,
) $

image

I’d argue that using op creates unnecessary complexity in code and it’s better to insert a few alignment point in previous cases:

$ cases(
  & 1 + 2^3 + 3^3 + 4^4
  & = 4 & a_1 + 4^2 & a_2 + 4^3 & a_3 + 4^4 & a_4,
    
  & 1 + 2^3 + 3^3
  & = 3 & a_1 + 3^2 & a_2 + 3^3 & a_3 + 3^4 & a_4,
    
  & 1 + 2^3
  & = 2 & a_1 + 2^2 & a_2 + 2^3 & a_3 + 2^4 & a_4,
    
  & 1
  & =   & a_1 +     & a_2 +     & a_3 +     & a_4,
) $

image

Note that you can also add spaces in the code to make source more readable too.

1 Like