Improve Your Typesetting: Using \vphantom and \phantom in LaTeX

  • Context: LaTeX 
  • Thread starter Thread starter BvU
  • Start date Start date
  • Tags Tags
    Work
Click For Summary

Discussion Overview

The discussion revolves around the use of \vphantom and \phantom in LaTeX typesetting, particularly in the context of aligning differential expressions. Participants explore the visual output of different commands and their effects on the appearance of equations.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant expresses dissatisfaction with the appearance of the equation $$\frac{dr}{dt} = \frac{dr}{d\phi} \frac{d\phi}{dt}$$ and seeks a way to lift the two instances of dr without introducing unwanted elements.
  • Another participant suggests using \frac instead of \over, which seems to improve the situation for some.
  • A later reply confirms that using \frac with \vphantom achieves the desired effect, but raises questions about why \over behaves differently.
  • Some participants note that even with \frac, the positioning of the differential d from dr appears lower than that from d\phi, which they find visually unappealing.
  • There are mentions of potential issues with MathJax rendering as opposed to LaTeX, with some participants asserting that LaTeX renders correctly without the need for \vphantom.
  • One participant shares a link to a MathJax test page that does not exhibit the same issues, prompting questions about MathJax limitations and implementation.
  • Peter from MathJax acknowledges the issue and opens a GitHub issue to track it, indicating that different output mechanisms may yield different results.

Areas of Agreement / Disagreement

Participants express a mix of agreement and disagreement regarding the effectiveness of \vphantom and \phantom, with some finding them useful while others question their necessity. The discussion remains unresolved regarding the best approach to achieve the desired visual alignment in LaTeX.

Contextual Notes

Participants note that the rendering issues may be specific to MathJax rather than LaTeX itself, highlighting potential discrepancies between different rendering environments.

BvU
Science Advisor
Homework Helper
Messages
16,219
Reaction score
4,934
I found (nitpicking, I agree -- but that's what ##\TeX## does to you :smile:)$$
{dr\over dt} = {dr\over d\phi}{d\phi\over dt}$$ looking ugly and want to lift the two dr . However,

{dr\over dt} = {\vphantom {\phi} dr\over d\phi}{d\phi\over dt} didn't deliver as I expect:
$$
{\vphantom {\phi dr } dr\over dt} = {\vphantom {\phi} dr\over d\phi}{d\phi\over dt}$$ where omitting the \vphantom does take care of the lifting :
$$
{ dr\over dt} = {{\phi} \ dr\over d\phi}{d\phi\over dt}$$ (but I of course don't want the ##\phi##)
anyone have a tip how to get this done ?

PS the ordinary \phantom does work as I expect -- vertically as well as horizontally:
$$
{\phantom {\phi } dr\over dt} = {\phantom {\phi} dr\over d\phi}{d\phi\over dt}$$
 
Physics news on Phys.org
try \frac{}{} as opposed to \over
 
  • Like
Likes   Reactions: BvU
Excellent ! Thanks doc !

\frac {\vphantom {\phi} dr} {dt} = \frac {\vphantom {\phi} dr} {d\phi} \frac {d\phi} {dt} does the trick

$$\frac {\vphantom {\phi} dr} {dt} = \frac {\vphantom {\phi} dr} {d\phi} \frac {d\phi} {dt}$$
and leaves me wondering why \over doesn't behave like that ...
 
Have to recant: also with \frac the d from ##dr## is sitting lower than the d from ##d\phi## which I find ugly.
Equally below the line: ##dt## is below ##d\phi##

It's not much but annoying. See post #1.
 
BvU said:
Have to recant: also with \frac the d from ##dr## is sitting lower than the d from ##d\phi## which I find ugly.
Equally below the line: ##dt## is below ##d\phi##

It's not much but annoying. See post #1.
Are you talking on screen? Then it must be a problem in MathJax. LaTeX renders the equation correctly without vphantom.
 
DrClaude said:
Are you talking on screen? Then it must be a problem in MathJax. LaTeX renders the equation correctly without vphantom.
I agree, I just did both in TeXnicenter and they are identical in the pdf file...
 
Yes, on screen. Both Chrome and IE11.
Haven't explored these other environments yet.
 
MathJax issue, not LaTeX issue...
 
  • Like
Likes   Reactions: DrClaude
  • #10
I see your point: wrong forum o0)
I'll have to get used to it -- an imperfect world :rolleyes:
 
Last edited:
  • #11
Have tried http://beta.mathjax.org/mathjax/latest/test/sample-dynamic-2.html -- doesn't show the problem I see on PF. No need to juggle with \vphantom indeed.
Is that link using MathJaX or is it faithful to ##\LaTeX## ?

Anyone know where to find a legible summary of MathJaX limitations ?

Could it be this isn't a MathJaX issue but a MathJaX implementation issue ? @jtbell, @Greg Bernhardt ?

\vphantom itself works alright: with \vphantom\int I can lift the d (more than I need for alignment with ##d\phi##), but with \vphantom\phi it doesn't lift it enough to come to the same height as ##d\phi##
 
  • #12
Sorry, I'm not familiar with the detailed ins/outs of LaTeX and MathJax. I'm basically at the "Primer" level. :frown:
 
  • #14
Peter from MathJax here.

I have opened https://github.com/mathjax/MathJax/issues/1692 to track this on our end.

> Have tried http://beta.mathjax.org/mathjax/latest/test/sample-dynamic-2.html -- doesn't show the problem I see on PF.

That page uses another output mechanism (the older HTML-CSS output). The SVG output (which you can try using the MathJax menu) also does not exhibit the problem AFAICS.
 
  • Like
Likes   Reactions: Greg Bernhardt, BvU and DrClaude

Similar threads

  • · Replies 8 ·
Replies
8
Views
5K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K