On Thu, Nov 06, 2025 at 09:21:42AM +0200, Eli Zaretskii wrote: > > From: Gavin Smith <[email protected]> > > Date: Wed, 5 Nov 2025 21:25:41 +0000 > > Cc: [email protected], [email protected], [email protected] > > > > On Wed, Nov 05, 2025 at 10:48:06PM +0200, Eli Zaretskii wrote: > > > > From: Gavin Smith <[email protected]> > > > > Date: Wed, 5 Nov 2025 20:08:35 +0000 > > > > > > > > The results look ok with your test file, as you described below. I've > > > > attached a screen shot. One problem is the alignment of the math > > > > images, > > > > which appears to be inconsistent. > > > > > > I'm guessing this depends on the image. You could also experiment > > > with the various attributes of the image, described in "Image > > > Descriptors" node of the ELisp Reference manual. For example, > > > :ascent, :margin, and :height sound relevant. > > > > The image is inserted into the buffer by Info mode. I have practically > > no knowledge of Emacs Lisp and would assume it is up to whoever works > > on Info mode to set the code to set these properties appropriately. I > > don't know how to inspect the attributes of the image anyway: I got > > as far as trying to run "M-x eval-expression RET (get-display-property) RET" > > before giving up. > > OK, understood. FTR, the handling of images in Info is in the > function Info-display-images-node. I guess we will need some special > stuff there for math images. Currently, that function does not apply > any special image attributes that might affect how the image is > displayed, so perhaps doing something specific to math images will > make the display look better. > > Would it be possible for you to make the example Info and image files > you were working with available somewhere for download, so that someone > else (perhaps rahguzar) could pick up where you left off and try to > improve the situation? > > Thanks.
Yes, it's possible. Hovever, generating and distributing PNG files for the benefit of Emacs Info may be the wrong approach. Given that we have reached the point of extending the Info format to mark output as originating from @math or @displaymath (in order to record the image generation DPI setting), why not leave it to Emacs itself to generate these images, rather than distributing them? I have installed and tried AUCTeX with preview-latex and it appears to work fine with text the same size and aligned with surrounding text. So we could allow Info mode to follow the approach of AUCTeX. The downside of this approach is that it would require people to have LaTeX packages installed to view the mathematical formatting in Info files. Another possibility is to use another image format (EPS?) that does in fact have baseline information. Then Info mode would only do part of the job that AUCTeX does, not relying on LaTeX but still inserting, scaling and shifting an image. preview.el that comes with AUCTeX does have code to set the :ascent value that you mentioned. According to the preview-latex manual(*), AUCTeX does use png files, but generates these from dvi files, so presumably gets some more information about the geometry of the formatted text than would just be present in a png file. (*) https://www.gnu.org/software/auctex/manual/preview-latex.html Perhaps it will be an easy change to texi2any to switch the image format for INFO_MATH_IMAGES from .png to .eps?
