Tool tip messes up with equation spacing

26 views
Skip to first unread message

Andrew Murdza

unread,
Jul 22, 2022, 1:45:54 PM7/22/22
to MathJax Users
I have this line on my website:
$$\begin{aligned}
                    \frac{a}{b}&=\frac{a}{b}\\
                    &=\mathtip{\frac{a}{b}}{hi}
                    \end{aligned}$$
I want the = sign to be included in the mathtip. I tried to do this by changing my code to this:
$$\begin{aligned}
                    \frac{a}{b}&=\frac{a}{b}\\
                    &\mathtip{=\frac{a}{b}}{hi}
                    \end{aligned}$$
However, this results in the second line of the equation being shifted so its = sign isn't aligned with the = sign in the first line.
How can I include the = sign in the mathtip without messing up the alignment of the = signs?

Murray

unread,
Jul 23, 2022, 5:02:48 AM7/23/22
to MathJax Users
Unless I'm missing something, this has  an equal sign in the second row that's aligned with the first, and an equal sign in the math tip. Is this what you wanted?

$$\begin{aligned}
\frac{a}{b}&=\frac{a}{b}\\
&=\mathtip{\frac{a}{b}}{=hi}
\end{aligned}$$

Screenshot 2022-07-23 175021.png

Or did you mean you don't want the equals in the second line, but the expression should line up? If so, this hack will get you very close:

$$\begin{aligned}
\frac{a}{b}&=\frac{a}{b}\\
&\hspace{13.5pt} \mathtip{\frac{a}{b}}{=hi}
\end{aligned}$$

Screenshot 2022-07-23 175023.png

The fractions line up nicely:

Image2.png

Regards

Davide Cervone

unread,
Jul 23, 2022, 11:55:50 AM7/23/22
to mathja...@googlegroups.com
Relations like there equal sign get spacing before them only if there is some ordinal item before them.  That would be the case for &=..., so the aligned environment (and other similar environments) insert an empty item before the equal sign in order to get the usual spacing there.  But when you enclose the equal in \mathtip, that means the equal sign again has no ordinal before it, so doesn't get the desired space.  The solution is to use

\begin{aligned}
  \frac{a}{b}&=\frac{a}{b}\\
  &\mathtip{{}=\frac{a}{b}}{hi}
\end{aligned}

which includes {} before the nested equal sign.  You have to do that explicitly because the environment can't see the equal sign that is inside the \mathtip macro.

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 on the web visit https://groups.google.com/d/msgid/mathjax-users/68704f24-18b3-48bf-a3f1-f4f8d83d16b3n%40googlegroups.com.

Andrew Murdza

unread,
Jul 29, 2022, 7:15:02 PM7/29/22
to MathJax Users
Dear Davide,

You have been extremely helpful with setting up my website. I have several other mathjax and CSS issues and I was wondering if I could hire you to fix them and future issues I have with Mathjax and CSS for $1000. I would pay the money right before you started because I don't know when I will have no other CSS and Mathjax questions. I think that the issues in total will take you far less than 20 hours so I hope $1000 is ok. I am ok if you want to post the mathjax and/or CSS issues you solve anywhere. The difference is you would also be helping with CSS and I would be able to share my project with you via Github or something else for you to make edits on.

Reply all
Reply to author
Forward
Message has been deleted
0 new messages