Can in-line latex be aligned better?

  • LaTeX
  • Thread starter jackmell
  • Start date
  • Tags
    Latex
In summary, the inline latex in posts can be improved by aligning it better and trimming certain excess parts of the image.
  • #1
jackmell
1,807
54
Hi. May I suggest the administrators consider improving how in-line latex appears in posts? For example consider:

This is my in-line post of [itex]\sqrt{x}=y[/itex] and note how [itex]\sqrt{x}[/itex] is not aligning perfectly with the text. The [itex]\sqrt{x}[/itex] would look nicer if it were just slightly lower in the line and it also appears to have a slightly smaller font then the text. Notice other posts when lots of in-line latex appears, the entire paragraph looks awkward due to this mis-alignment. Here is another actual example of just one I picked at random in the homework forum:

Tom Mattson said:
Dick's method is the right one, but it's not what you were saying in post 5. In that post you said multiply the top and the bottom by [itex]1+e^u-e^u[/itex]. That's not what Dick is doing. He is simply using [itex]1=1+e^u-e^u[/itex] in the numerator alone. That's the way to do it.

Notice how the in-line latex is way-off center.

I don't wish to be critical but rather am offering a constructive criticism that if it were fixed, would improve the look of the forum.
 
Physics news on Phys.org
  • #2
Looks like it's been fixed. :smile:

Unfortunately, symbols, like arrows, over letters still get cut off. For example, [itex]\vec{F}[/itex] should be an F with an arrow over it, but all you see is a dot at the right.
 
  • #3
I'm no expert on this, but it seems that the cutting off above a certain height is necessary:
chroot said:
Yeah, the inline LaTeX is a little tough.. I can't just use a trim command. I have to trim it exactly to some known y dimension.
The following should read eX2/2 (that's uppercase "X")...

itex: [itex]\frac{e^{X^2}}{2}[/itex]

tex: [tex]\frac{e^{X^2}}{2}[/tex]
 
  • #4
Yeah, I realize there's got to be some limit. It's just unfortunate that currently you can't write [tex]\vec{F}[/tex] or [tex]\ddot{X}[/tex] using inline TeX.
 
  • #5
Redbelly98 said:
I'm no expert on this, but it seems that the cutting off above a certain height is necessary:
From a software perspective, it's certainly possible to trim the images. I do that on my personal blog. It can mess up the vertical alignment a bit, depending on which browser is being used, but I personally think including the important parts of the image is more important than preserving the line alignment.

Of course, if/when PF transitions to MathJax, I think that whole issue goes away :wink:
 
Last edited:
  • #6
Guys look, I don't want to be annoying but I would like to more explicitly illustrate what I am suggesting and I apologize for using another forum as an example:

http://www.artofproblemsolving.com/Forum/viewtopic.php?f=359&t=371489&

Now look through that thread. All the in-line latex is perfectly adjusted, perfectly formatted, aligned, whatever to make a very nice presentation.

What they got that we ain't got?
 
  • #7
That does look really good. I'll try a copy and paste of post #19 from that thread, with itex tags around the math, just to see what it looks like here:



There is no function f continuous on a disc [itex]D(i,r)[/itex] such that [itex]f(z)^2 = z^2+1[/itex]. Proof: Think of [itex]r[/itex] as small. Suppose there is such an [itex]f[/itex]. Then [itex]f[/itex] is nonzero in [itex]D(i,r)- \{i\}[/itex]. Let [itex]z\in D(i,r)- \{i\}[/itex]. Then [itex]\frac{f(z+h)^2-f(z)^2}{h} = \frac{f(z+h)-f(z)}{h} (f(z+h)+f(z)) \to 2z[/itex] as [itex]h\to 0[/itex]. By the continuity of [itex]f[/itex], we get [itex]f'(z) = \frac{2z}{2f(z)}= \frac{z}{f(z)}[/itex]. This shows f is analytic in [itex]D(i,r)- \{i\}[/itex]. But clearly [itex]f[/itex] is bounded near [itex]i[/itex], so the singularity at [itex]i[/itex] is removable, hence [itex]f[/itex] is analytic in [itex]D(i,r)[/itex]. But [itex]f(i)=0[/itex], and this implies [itex]f'(z)[/itex] blows up at [itex]i[/itex], contradiction.



The alignment is fine, isn't it? But the images at the other forum are much sharper for some reason, and larger. We get a really tiny font in the fractions. They don't. And of course, that large fraction is messed up. We would have to use tex tags around that one:



There is no function f continuous on a disc [itex]D(i,r)[/itex] such that [itex]f(z)^2 = z^2+1[/itex]. Proof: Think of [itex]r[/itex] as small. Suppose there is such an [itex]f[/itex]. Then [itex]f[/itex] is nonzero in [itex]D(i,r)- \{i\}[/itex]. Let [itex]z\in D(i,r)- \{i\}[/itex]. Then [tex]\frac{f(z+h)^2-f(z)^2}{h} = \frac{f(z+h)-f(z)}{h} (f(z+h)+f(z)) \to 2z[/tex] as [itex]h\to 0[/itex]. By the continuity of [itex]f[/itex], we get [itex]f'(z) = \frac{2z}{2f(z)}= \frac{z}{f(z)}[/itex]. This shows f is analytic in [itex]D(i,r)- \{i\}[/itex].


Not very pretty. I will also mention that I find it annoying that itex increases the distance to the next line, e.g. when I write [itex]\mathbb R[/itex]. (There seems to be no reason why this particular symbol would do that). Maybe it would be a good idea to increase the default distance between two lines of text by a small amount.
 
Last edited:
  • #8
Fredrik said:
That does look really good. I'll try a copy and paste of post #19 from that thread, with itex tags around the math, just to see what it looks like here:



There is no function f continuous on a disc [itex]D(i,r)[/itex] such that [itex]f(z)^2 = z^2+1[/itex]. Proof: Think of [itex]r[/itex] as small. Suppose there is such an [itex]f[/itex]. Then [itex]f[/itex] is nonzero in [itex]D(i,r)- \{i\}[/itex]. Let [itex]z\in D(i,r)- \{i\}[/itex]. Then [itex]\frac{f(z+h)^2-f(z)^2}{h} = \frac{f(z+h)-f(z)}{h} (f(z+h)+f(z)) \to 2z[/itex] as [itex]h\to 0[/itex]. By the continuity of [itex]f[/itex], we get [itex]f'(z) = \frac{2z}{2f(z)}= \frac{z}{f(z)}[/itex]. This shows f is analytic in [itex]D(i,r)- \{i\}[/itex]. But clearly [itex]f[/itex] is bounded near [itex]i[/itex], so the singularity at [itex]i[/itex] is removable, hence [itex]f[/itex] is analytic in [itex]D(i,r)[/itex]. But [itex]f(i)=0[/itex], and this implies [itex]f'(z)[/itex] blows up at [itex]i[/itex], contradiction.

The alignment is fine, isn't it?

No. It's not. Look at the very first line:

There is no function f continuous on a disc [itex]D(i,r)[/itex]

The [itex]D(i,r)[/itex] is not vertically aligned with the rest of the text. It is shifted far upward with the lower boundary at near mid-line or is that just my browser doing that?
 
  • #9
jackmell said:
The [itex]D(i,r)[/itex] is not vertically aligned with the rest of the text. It is shifted far upward with the lower boundary at near mid-line or is that just my browser doing that?
It doesn't look that way for me. I'm using Firefox, but I verified that it's the same in IE. The bottom of the text is aligned with the bottom of the rest of the text on the line.
 
  • #10
Fredrik said:
It doesn't look that way for me. I'm using Firefox, but I verified that it's the same in IE. The bottom of the text is aligned with the bottom of the rest of the text on the line.

Ok Fredrik. Maybe it's just me. Sorry about that guys. I really don't mind too much anyway. Just suggesting something I though might be helpful.
 
  • #11
I do note that the tops of some of the fractions are cut off - that part of the problem is not browser-dependent.
 
  • #12
jackmell said:
Ok Fredrik. Maybe it's just me. Sorry about that guys. I really don't mind too much anyway. Just suggesting something I though might be helpful.
I agree that the LaTeX on that other site looks better. I wonder why their images are sharper, and not so small.

A minor correction to what I said earlier: The bottom of the D is aligned with the bottom of the text. The parentheses go down a little bit further. The D is a bit taller than the rest of the text.

diazona said:
I do note that the tops of some of the fractions are cut off - that part of the problem is not browser-dependent.
I think we all see the same images, but apparently not in the exact same location.
 
  • #13
Could someone please explain to me how to fix my browser? Take this line:

The [itex]D(i,r)[/itex] is not vertically aligned with the rest of the text. It is shifted far upward with the lower boundary at near mid-line or is that just my browser doing that?

The bottom of the D is aligned with the horizontal line of the "e" preceding it, that is, it's shifted up. Other in-line code is even more mis-aligned.

I'm using Firefox 3.6.12 and also, I recently got one of those larger monitors I think 12x18 but I believe this occurred with my previous monitor as well.
 

Related to Can in-line latex be aligned better?

1. What is in-line latex alignment?

In-line latex alignment refers to the positioning of latex equations or symbols within a line of text. This allows for a more seamless integration of mathematical expressions within written content.

2. Why is it important for in-line latex to be aligned properly?

Proper alignment of in-line latex is important for the readability and clarity of mathematical content. It allows for easier understanding and interpretation of equations and symbols within the context of written text.

3. How can in-line latex be aligned better?

In-line latex can be aligned better by using the proper formatting and spacing commands in the code. This includes using the correct alignment symbols such as "&" and "\\" and adjusting the spacing between symbols and text.

4. Are there any tools or software that can help with in-line latex alignment?

Yes, there are various tools and software available that can assist with in-line latex alignment. Some examples include LaTeX editors such as Overleaf, Texmaker, and TeXstudio, which have built-in features for aligning equations. There are also online resources and tutorials that provide tips and tricks for better alignment.

5. What are some common mistakes to avoid when aligning in-line latex?

Some common mistakes to avoid when aligning in-line latex include using incorrect or inconsistent formatting and spacing, not using the proper alignment symbols, and not properly checking for errors or discrepancies in the code. It is also important to be aware of any specific syntax rules for the specific type of in-line latex being used.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
993
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
298
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
6K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Back
Top