I’d like to add annotations on the far right of my math environments. Is there a built-in way to do this, or do I need a workaround?
I’ll show you an example of what I mean.
I’d like to add annotations on the far right of my math environments. Is there a built-in way to do this, or do I need a workaround?
I’ll show you an example of what I mean.
Just writing "LHS &= "RHS" & "(comment)"
might be enough?
When equations include multiple alignment points (
&
), this creates blocks of alternatingly right- and left-aligned columns.
$
& norm(abs(f+g)^(p-1) dot f)_1 + norm(abs(f+g)^(p-1) dot g)_1 \
&= norm(abs(f+g)^(p-1) dot (abs(f) + abs(g)))_1
&wide "(积分是线性运算)" \
&>= norm(abs(f+g)^(p-1) dot abs(f+g))_1
&wide "(绝对值的三角不等式)" \
&= norm(abs(f+g)^p)_1 \
&= norm(f+g)_p^p
&wide "(定义)"
$
Note that wide
in math means #h(2em)
.
It would work as workaround and for me it’s fine. However wide
is an arbitrary space in between math and annotations. It’s not like one is aligned to the left and the other to the right.
Is this a desirable feature? I could try to develop a solution since there appears to be none out of the box.
Hello Alberto! I am not sure what you mean here, can you explain? As far as I understand @Y.D.X’s answer, the “wide” spacing is here only for aesthetic purposes, to make sure there is always enough space between the comment and the equation.
Actually, the equation is left-aligned due to &, and the tag is right-aligned, because of another &. The alignment always occur within the column, hence you cannot see the alignment unless there is difference in width. To make sure you have a column gutter, you can either put &wide
, after the separator, or put a single spacing before wide&
, either ways works.
$
& "this is a very long text"\
& "left" & "longright"\
& "left" & "right"\
$
$
& "this is a very long text"&wide\
& "left" &wide "longright"\
& "wide spacing" &wide "right"
$
Indeed what @Y.D.X proposed does align text on both sides, therefore it’s the correct answer.
What I meant but failed to express was the equation spanning the entire page width, so that math is against the left margin of the page, and annotations on the right margin. Anyway, it doesn’t look good, so I’ll go with @Y.D.X solution.