Add vertical space

443 views
Skip to first unread message

Daniel

unread,
Oct 8, 2017, 4:47:36 AM10/8/17
to MathJax Users
Is it possible to add vertical space to a formula by some math command?

Let's say I have a formula $x^2$. Now I want to move the formula lower. Something like $\vspace{.5cm}x^2$.

Daniel

David Farmer

unread,
Oct 8, 2017, 9:04:07 AM10/8/17
to MathJax Users

Could you give an actual use case? Moving an $x^2$ lower in the
middle of a sentence does not seem reasonable.
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>
>

Daniel

unread,
Oct 8, 2017, 9:13:10 AM10/8/17
to MathJax Users
Am Sonntag, 8. Oktober 2017 15:04:07 UTC+2 schrieb David Farmer:

Could you give an actual use case?  Moving an $x^2$ lower in the
middle of a sentence does not seem reasonable.

Sure. My website generates equations for labels on diagrams from user input. Sometimes a user wants to have such a label slightly higher or lower. I could create an additional UI for adjust the labels. However, if MathJax supports some kind of vertical adjustment within equations that would solve the problem already. And who knows maybe some user want to place part of a formula higher or lower for some reason...

David Farmer

unread,
Oct 8, 2017, 10:22:44 AM10/8/17
to MathJax Users

How do you initially position the label? Can't you adjust that?

The approach which seems natural to me is to just let MathJax
do its thing. Maybe you can wrap each label in something which
you can style with CSS. (If I recall correctly) there is a MathJax
way to add a class, which then you can style.

Knowing more about what the actual code and HTML output looks like
could make it easier to give a clear suggestion.

Daniel

unread,
Oct 9, 2017, 2:30:59 PM10/9/17
to MathJax Users
Thanks. As I said, anything that cannot go into the actual formula for positioning would need some additional user interface to be said up. I would prefer to avoid that. I was just hoping that there is a way to influence the vertical space within a formula, as is the case for horizontal space via "\", "\,", "\;", etc. Maybe there just isn't.

Davide Cervone

unread,
Oct 9, 2017, 3:41:46 PM10/9/17
to mathja...@googlegroups.com
You could use \raise or \lower.  E.g.,

\lower 2em {x^2}

That may do what you are looking for.

Daniel

unread,
Oct 18, 2017, 2:22:52 AM10/18/17
to MathJax Users
Hi Davide,

Sorry for the delayed answer. It does work indeed. Just awesome!

Daniel

unread,
Oct 18, 2017, 2:41:59 AM10/18/17
to MathJax Users
I noticed there is also a \moveleft and \moveright command. Very handy.

However, chaining them seems tricky. While

\moveleft 2em \raise 2em

works fine,

\raise 2em \moveleft 2em

does not (it only moves things. Any idea why?


Am Montag, 9. Oktober 2017 22:41:46 UTC+3 schrieb Davide Cervone:

Daniel

unread,
Oct 18, 2017, 2:44:25 AM10/18/17
to MathJax Users
Sorry, yet another question: \raise, \lower, etc. seem not to be supported by LaTeX math. Is that correct? Or do I need to load a special package?

What seems to be supported by LaTeX math is \raisebox{2em}{x^2}. However, turns out its not by MathJax. Is there a reason why?

Thanks!


Am Montag, 9. Oktober 2017 22:41:46 UTC+3 schrieb Davide Cervone:

Daniel

unread,
Oct 18, 2017, 3:10:10 AM10/18/17
to MathJax Users
I guess a workaround is to define raisebox with

\def\raisebox#1#2{\raise #1 {#2}}

I am not sure tough, what the proper analogue is for \moveleft.

Still I am wondering why it isn't supported out of the box.

By the way, is there now a way to disable certain LaTeX non-conform macros, such as \raise while still being able to use them in definitions like the one above?

Thanks!

Daniel

unread,
Oct 18, 2017, 3:16:08 AM10/18/17
to MathJax Users


Am Mittwoch, 18. Oktober 2017 10:10:10 UTC+3 schrieb Daniel:
I guess a workaround is to define raisebox with

\def\raisebox#1#2{\raise #1 {#2}}

I am not sure tough, what the proper analogue is for \moveleft.

Okay, \hspace{-2em}x^2 which is already supported by MathJax seems to work fine for that.
Reply all
Reply to author
Forward
0 new messages