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

  • LaTeX
  • Thread starter BvU
  • Start date
  • Tags
    Work
In summary: That's all with respect to Firefox. Chrome uses its own SVG rendering, so that's a different story. In summary, The conversation discusses an issue with the appearance of equations using the characters "dr" and "dt" in a mathematical context. The use of "\vphantom" is suggested as a solution, but it is noted that it does not work as expected. It is also noted that this issue may be related to the implementation of MathJax. A developer has been contacted to look into the issue.
  • #1
BvU
Science Advisor
Homework Helper
16,060
4,850
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
  • #3
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 ...
 
  • #5
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.
 
  • #6
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.
 
  • #7
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...
 
  • #8
Yes, on screen. Both Chrome and IE11.
Haven't explored these other environments yet.
 
  • #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 Greg Bernhardt, BvU and DrClaude

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

What is typesetting?

Typesetting is the process of arranging and formatting text and images in a visually appealing and organized manner for publication or printing.

What is \vphantom and \phantom in LaTeX?

\vphantom and \phantom are commands in the LaTeX typesetting software that allow for precise vertical spacing and alignment in a document. They are often used to create invisible placeholders or "phantoms" that affect the layout of a document without being visible to the reader.

How can using \vphantom and \phantom improve typesetting?

By using \vphantom and \phantom, you can adjust the vertical spacing and alignment of text and images in your document, resulting in a more polished and professional-looking layout. These commands can also help to prevent awkward spacing and alignment issues that can occur when using different font sizes or styles.

Can \vphantom and \phantom be used for both text and images?

Yes, \vphantom and \phantom can be used for both text and images in a LaTeX document. They can be used to create invisible placeholders for any type of content that affects the layout of the document.

Are there any limitations to using \vphantom and \phantom?

While \vphantom and \phantom can be very useful for improving typesetting, they may not be suitable for all types of documents or layouts. It is important to use them carefully and consider the overall design and readability of your document before implementing these commands.

Similar threads

Replies
7
Views
3K
Replies
2
Views
1K
Replies
7
Views
2K
Replies
3
Views
700
Replies
1
Views
910
Back
Top