I have a matrix in C++
Matrix<double> A = {
{31, -13, 0, 0, 0, -10, 0, 0, 0},
{-13, 35, -9, 0, -11, 0, 0, 0, 0},
{0, -9, 31, -10, 0, 0, 0, 0, 0},
{0, 0, -10, 79, -30, 0, 0, 0, -9},
{0, 0, 0, -30, 57, -7, 0, -5, 0},
{0, 0, 0, 0, -7, 47, -30, 0, 0},
{0, 0, 0, 0, 0, -30, 41, 0, 0},
{0, 0, 0, 0, -5, 0, 0, 27, -2},
{0, 0, 0, -9, 0, 0, 0, -2, 29}
};
Tried M-- M-x align
but that gives
Matrix<double> A = {
{31, -13, 0, 0, 0, -10, 0, 0, 0},
{-13, 35, -9, 0, -11, 0, 0, 0, 0},
{0, -9, 31, -10, 0, 0, 0, 0, 0},
{0, 0, -10, 79, -30, 0, 0, 0, -9},
{0, 0, 0, -30, 57, -7, 0, -5, 0},
{0, 0, 0, 0, -7, 47, -30, 0, 0},
{0, 0, 0, 0, 0, -30, 41, 0, 0},
{0, 0, 0, 0, -5, 0, 0, 27, -2},
{0, 0, 0, -9, 0, 0, 0, -2, 29}
};
which is not particularly visually-appealing! How can I align elements to the right? (,
s on one column)
align-rules-alist
(C-h v RET align-rules-alist RET
)? Are you runningM-x align
with a prefix argument (e.g. usingC-u M-x align-rules alist
in vanilla emacs, or4 SPC SPC align-rules-alist
in spacemacs)?-
in numbers as part of the thing that should be aligned. The details of alignment behaviour are I think configured byalign-rules-alist
. I guess it's working the way you see in part because of the value of that variable (in particular,c-comma-delimiter
).align
doesn't work, how can I solve it byalign-regexp
?