Align bottom of fraction with text.

20 views
Skip to first unread message

Andrew Murdza

unread,
Nov 12, 2025, 2:59:55 PM (8 days ago) Nov 12
to MathJax Users
I have something like this: <p>Some text \(\begin{gathered}\frac{2}{3}+1\\[-2pt]\text{second row}\end{gathered}\) some more text.</p> I want the "\text{second row}" to line up with "Some text" and "some more text." I want it to make the special alignment only apply to that specific MathJax container, with all other MathJax containers having the normal behavior.

Is this possible?

Thank you,
Andrew Murdza

Davide Cervone

unread,
Nov 13, 2025, 7:03:30 AM (7 days ago) Nov 13
to mathja...@googlegroups.com
Remove the gathered environment.  That is

<p>Some text \(\frac{2}{3}+1\\[-2pt]\text{second row}\) some more text.</p>
 
gives you

PastedGraphic-1.png 
Note, however, that the [-2pt] will have no effect on this in-line break.

Davide

--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/mathjax-users/d24b431b-a59b-49fa-b563-c5f7bd8debden%40googlegroups.com.

Andrew Murdza

unread,
Nov 13, 2025, 12:55:05 PM (7 days ago) Nov 13
to MathJax Users
Hi Davide,

I didn't make this clear earlier, but I want "Some text" to also be aligned with "second row" as well as "some more text." I also want \frac{2}{3}+1 and "second row" to be horizontally centered, like in a gathered environment. I also have another version that uses \begin{aligned}\end{aligned} with one & in each row, but I figured if I could use gathered I could also do \begin{aligned}.

Davide Cervone

unread,
Nov 13, 2025, 1:04:07 PM (7 days ago) Nov 13
to mathja...@googlegroups.com
Because your previous questions where about horizontal alignment, I misunderstood your request, here.  You are interested in vertical alignment, then, right?  in that case, use [b] after the \begin{gathered} to align on the bottom line.  E.g.

<p>Some text \(\begin{gathered}[b]\frac{2}{3}+1\\[-2pt]\text{second row}\end{gathered}\) some more text.</p>

produces


PastedGraphic-1.png

just as it would in actual LaTeX.

Davide


Andrew Murdza

unread,
Nov 13, 2025, 1:13:51 PM (7 days ago) Nov 13
to MathJax Users
That's exactly what I wanted, thanks! I should have asked much earlier because I wasted a lot of time on this. I didn't know that \gathered had the [b] option (in MathJax or LaTeX), so I was trying to do it CSS and JS.

Murray

unread,
Nov 13, 2025, 6:33:24 PM (7 days ago) Nov 13
to MathJax Users
I had a go at this and produced this hacky solution.

Davide's answer, as usual, is way better.

Regards
Murray

Reply all
Reply to author
Forward
0 new messages