Suggestion Why is the math output hard to read sometimes?

  • Thread starter Thread starter squidsoft
  • Start date Start date
AI Thread Summary
The discussion focuses on the readability issues of math output in the forum, particularly regarding the display of LaTeX-rendered equations. Users have noted that the equal sign alignment and font clarity are problematic, especially on a grey background. Changes in LaTeX distributions have been identified as a potential cause of these issues, prompting suggestions for adjustments to the LaTeX renderer. Warren, a participant, has experimented with anti-aliasing settings and is considering switching to ImageMagick for better output quality. Overall, there is a consensus that improving the math output's appearance would enhance the forum's professionalism and user experience.
squidsoft
Messages
56
Reaction score
0
May I suggest improving the format of the math output in the forum.

Consider the following code:

<br /> \mathop\textnormal{Res}\limits_{z=-n}\left\{\frac{\pi}{x^s\sin(\pi s)}\right\}=(-x)^n,\quad n=0,-1,-2,\cdots<br />

The equal sign is not well displayed under the Res symbol and the "s" in sine is broken up. I've noticed other problems like this in general. I think PF would look more polished if the math output was nicer looking.
 
Physics news on Phys.org
If I recall correctly, it used to be better. I'm not sure when or why the change occurred.
 
I suspect the problem might be that the LaTeX renderer (which generates the equation images) may work on the assumption that the equations will be displayed on a white background. On a grey background, some of the pixels are too faint. Is it possible to tweak the LaTeX renderer to take account of the grey background?
 
Hey all,

A year ago or so, something changed in the fonts included in the normal LaTeX distributions that come with most Linux distributions. Along with it were a number of other changes that broke PF's latex system. I rewrote some of it, but never really figured out the problem with the fonts.

I will look into it more. I don't actually think it has anything to do with anti-aliasing. The images are currently anti-aliased to white, and then white is dropped out as transparent. If the strokes look correct when anti-aliased to white, it seems that changing the surrounding white pixels to transparent would not affect them. It's worth a shot, though.

- Warren
 
chroot said:
Hey all,

A year ago or so, something changed in the fonts included in the normal LaTeX distributions that come with most Linux distributions. Along with it were a number of other changes that broke PF's latex system. I rewrote some of it, but never really figured out the problem with the fonts.

I will look into it more. I don't actually think it has anything to do with anti-aliasing. The images are currently anti-aliased to white, and then white is dropped out as transparent. If the strokes look correct when anti-aliased to white, it seems that changing the surrounding white pixels to transparent would not affect them. It's worth a shot, though.

- Warren

For what it's worth, I took the PNG image in post #1, on its default white background, and decreased the brightness until its background matched this thread's grey background. I think the result (attached) is therefore what you'd get if anti-aliased to grey. Slightly more legible, I think, but still not great, and I guess that's down to a poor choice of font. Or something.
 

Attachments

  • 2201627-0 darkened.png
    2201627-0 darkened.png
    959 bytes · Views: 556
Can the font be made bold, either in a default setting or when typed by the user (I never use LaTex, so don't know the ins and outs of this)? It just looks like the font is a bit thin and loses something, so if there's a way to make it bold, that might be enough to improve readability.
 
Moonbear said:
Can the font be made bold, either in a default setting or when typed by the user (I never use LaTex, so don't know the ins and outs of this)? It just looks like the font is a bit thin and loses something, so if there's a way to make it bold, that might be enough to improve readability.
That wouldn't be a solution as such, because some equations use both bold and plain font, e.g.

\mathbf{z} = a\mathbf{x} + b\mathbf{y}​

although personally I prefer

\textbf{z} = a\textbf{x} + b\textbf{y}​

However, if you have a greater choice of font weights than just "plain" and "bold", then some slightly heavier fonts might help.
 
Okay, guys... I changed some of the antialiasing behavior in Ghostscript (I turned it down!), and I think the output looks a little better now. If you could, post some troublesome LaTeX here and see if it renders better now.

- Warren
 
<br /> <br /> \mathop\textnormal{Res}\limits_{z=-n}\left\{\frac{\pi}{x^s\sin(\pi s)}\right\}=(-x)^n,\quad n=0,-1,-2,\cdots<br /> <br />
 
  • #10
\sum_{n=a}^bf(n) has a very strong summation symbol.
 

Attachments

  • strong_sigma.png
    strong_sigma.png
    362 bytes · Views: 597
  • #11
This is how it looked with the old antialiasing options:

<br /> \sum_{n=a}^bf(n)<br />

- Warren
 
  • #12
And now the new:

<br /> \sum_{n=a}^bf(n)<br />

It's really strange that antialiasing options could even cause this in the first place...

- Warren
 
  • #13
And with no anti-aliasing at all:

<br /> \sum_{n=a}^bf(n)<br />

- Warren
 
  • #14
Fooling around some more:

<br /> \sum_{n=a}^bf(n)<br />
 
  • #15
Hmmm...

<br /> \sum_{n=a}^bf(n)<br />
 
  • #16
Try try again:

<br /> \sum_{n=a}^bf(n)<br />
 
  • #17
<br /> <br /> \mathop\textnormal{Res}\limits_{z=-n}\left\{\frac{\pi}{x^s\sin(\pi s)}\right\}=(-x)^n,\quad n=0,-1,-2,\cdots<br /> <br />
 
  • #18
I'm not really sure I've found a solution. I'll have to keep hunting.

<br /> <br /> \mathop\textnormal{Res}\limits_{z=-n}\left\{\frac{\pi}{x^s\sin(\pi s)}\right\}=(-x)^n,\quad n=0,-1,-2,\cdots<br /> <br />

- Warren
 
  • #19
Some of those versions looked better...not perfect, but certainly better.
 
  • #20
\begin{pmatrix}1 &amp; 0 &amp; 0\\ 0 &amp; \frac{u_x}{u} &amp; \frac{u_y}{u}\\ 0 &amp; -\frac{u_y}{u} &amp; \frac{u_x}{u} \end{pmatrix}

Hm, both the parentheses and the zeroes look better than they did here. They used to look like the pixel size was bigger in the LaTeX font. I'm not a big fan of the new \sum though, and x and y are still just barely legible. Have you tried a slightly bigger font size?

It would also be nice if the \dot code would make a slightly bigger dot: \dot{\vec r} (but I realize of course that you can't do anything that changes only that symbol).
 
  • #21
Could it be an issue with the number of colors in the rendered image?

It seems that many of the old LaTeX images were 8-bit images (up to 256 colors) but the new ones are 4-bit (up to 16 colors) [which have smaller file sizes]. (To save, I right-click on the image then save to my desktop.)

When counting colors in some of the new images, I get 4 colors.
 
  • #22
I'm playing with it again, so expect a little weirdness.

robphy, the images are being generated explicitly as 8-bit. If they're somehow being down-converted, I'll have to figure out where...

- Warren
 
  • #23
Strange brackets (I'm seeing the right bracket much thicker at the top :redface:):

\frac{dr}{d\tau}\ =\ \pm\sqrt{E^2\ -\ \left(1 - \frac{2M}{r}\right)\left(m^2\ +\ \frac{L^2}{r^2}\right)}

and don't the r and the tau look very similar?
 
  • #24
tiny-tim said:
Strange brackets (I'm seeing the right bracket much thicker at the top :redface:):

\frac{dr}{d\tau}\ =\ \pm\sqrt{E^2\ -\ \left(1 - \frac{2M}{r}\right)\left(m^2\ +\ \frac{L^2}{r^2}\right)}

and don't the r and the tau look very similar?

Yes, the r and tau are too similar, IMO. But the brackets have a nice calligraphy look to them.
 
  • #25
Argh I'm just making it worse! :smile:

- Warren
 
  • #26
I don't know how they did it but mathlinks has very readable equations without cranking up the resolution higher than PF
 
  • #27
qntty said:
I don't know how they did it but mathlinks has very readable equations without cranking up the resolution higher than PF

Impressive indeed:

http://alt2.mathlinks.ro/latexrender/pictures/e/6/f/e6f7873e4868755812ca60c34dd13a22e4ea785b.gif

Gif images with alpha anti-aliasing, so I presume they map to 32 bit ARGB colors...

Maybe one of these?

http://packages.debian.org/search?keywords=mimetex

Regards, Hans.
 
Last edited by a moderator:
  • #29
Hans de Vries said:
Impressive indeed:

http://alt2.mathlinks.ro/latexrender/pictures/e/6/f/e6f7873e4868755812ca60c34dd13a22e4ea785b.gif

Gif images with alpha anti-aliasing, so I presume they map to 32 bit ARGB colors...

That image is 8-bit with about 27 indexed-colors...with transparency.
I suspect one can do fine with 4-bit grey images if it uses up to 16 indexed-colors.
Some of the images I found have been 4-bit with only 4 colors.

When PF first supported \LaTeX, it also was and has been impressive.
It's just recently that something seems to have changed.
 
Last edited by a moderator:
  • #30
  • #31
And the current PF...
<br /> \sum_{n=1}^{\infty}\frac{\chi(n) }{n^{s}}=\prod_{p\in\mathbb{P}}\left(\frac{1}{1-\frac{\chi(p)}{p^{s}}}\right)<br />
 
  • #33
The back end tools are all pretty much the same. Just takes some tweaking on chroots behalf.
 
  • #34
Thanks for the links, guys. The LatexRender program seems to be doing exactly the same sort of stuff that I'm doing, so I'm going to look through it to find the subtle differences.

<br /> <br /> \sum_{n=1}^{\infty}\frac{\chi(n) }{n^{s}}=\prod_{p\in\mathbb{P}}\left(\frac{1}{1-\frac{\chi(p)}{p^{s}}}\right)<br /> <br />

- Warren
 
  • #35
Actually, it looks like LatexRender is using ImageMagick for its conversions from PostScript to png images, whereas I chose to use pstoimg many years ago. ImageMagick is a bit more resource-intensive, but I don't think it's a big concern.

I'm going to try switching to ImageMagick and see what happens... cross your fingers and toes.

- Warren
 
  • #36
Testing with ImageMagick...

<br /> \sum_{n=1}^{\infty}\frac{\chi(n) }{n^{s}}=\prod_{p\in\mathbb{P}}\left(\frac{1}{1-\frac{\chi(p)}{p^{s}}}\right)<br />

Another test... \sqrt{2}

- Warren
 
Last edited:
  • #37
Alright folks, tell me what you think of the output now.

- Warren
 
  • #38
chroot said:
Testing with ImageMagick...

<br /> \sum_{n=1}^{\infty}\frac{\chi(n) }{n^{s}}=\prod_{p\in\mathbb{P}}\left(\frac{1}{1-\frac{\chi(p)}{p^{s}}}\right)<br />

Another test... \sqrt{2}

- Warren

Looks like professional textbook style, Warren. :smile:


Regards, Hans
 
  • #39
Inline TeX needs to look good too... \sqrt{2} should not be confused with s=j\omega or E=mc^2

- Warren
 
  • #40
Yeah, as I suspected, the tools are no longer respecting my baselines... argh. Not a huge problem, though. I might be able to change the way they're aligned in the HTML.

- Warren
 
  • #41
chroot said:
Testing with ImageMagick...

<br /> \sum_{n=1}^{\infty}\frac{\chi(n) }{n^{s}}=\prod_{p\in\mathbb{P}}\left(\frac{1}{1-\frac{\chi(p)}{p^{s}}}\right)<br />

Another test... \sqrt{2}

- Warren

That looks really nice.

I think ImageMagick also uses Ghostscript.
(I really like ImageMagick. If it's too resource-intensive, you might try GraphicsMagick http://www.graphicsmagick.org/ . For many operations, instead of "convert ... " you use "gm convert ..." . Here are some benchmarks: http://www.graphicsmagick.org/benchmarks.html .
 
Last edited by a moderator:
  • #42
Are you using the 16-bit ImageMagick?
The 8-bit version would be more than sufficient... and may more easily yield smaller image files.

GIMP complained about one of the images having a layer positioned outside of the visible image. You might have to use a +repage command (http://www.imagemagick.org/Usage/basics/#page) to correct that.

The new images do look very nice.
 
  • #43
If resources are an issue then you might want to look at jsMath because it allows you to download fonts so that the web server doesn't need to process the LaTeX
 
  • #44
qntty said:
If resources are an issue then you might want to look at jsMath because it allows you to download fonts so that the web server doesn't need to process the LaTeX

You do have to have enable javascript.
Without it, nothing seems to be rendered... although the latex source is embedded (but not displayed) in the html page.

Disable javascript. Then visit
http://www.math.union.edu/~dpvc/jsMath/examples/ .

Rendered \LaTeX looks so much nicer.

I believe the LaTeX is rendered once into an image during authoring.
Then, they are just plain image files served up by the webserver.

The resource-intensiveness probably refers to (say)
the number of CPU cycles and amount of allocated memory during authoring,
placing limits on the number of renderings that can be handled simultaneously.
 
  • #45
It's very light. I can hardly see this: e^{\ln x} = 7.
 
  • #46
It is maybe a tad too light yes, but I came to this section to feedback you on the new tex rendering, it's beautiful!
 
  • #47
Hmm. I'll try antialiasing it to gray.

- Warren
 
  • #48
oooh, that's much better …

\frac{dr}{d\tau}\ =\ \pm\sqrt{E^2\ -\ \left(1 - \frac{2M}{r}\right)\left(m^2\ +\ \frac{L^2}{r^2}\right)}

and larger too! :smile:

Great work, Warren! :biggrin:
 
  • #49
Ooh, that last one I can even read easily while sitting here with the small laptop outside with the sun behind me (tends to make things hard to read on the screen as I have added glare)...so good job! :approve:
 
  • #50
<br /> e^{\ln x} = 7 <br />
Maybe a gamma correction would help...

insert in the ImageMagick line
-gamma 0.5
and I think you still need to insert
+repage
after a crop or a trim.
 

Similar threads

Replies
6
Views
7K
Replies
2
Views
2K
Replies
42
Views
10K
2
Replies
86
Views
13K
3
Replies
100
Views
11K
3
Replies
102
Views
10K
2
Replies
64
Views
15K
Replies
25
Views
4K
Back
Top