-
Notifications
You must be signed in to change notification settings - Fork 499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Difficulties vertically aligning inline latexmath #1483
Comments
Asciidoctor PDF is centering the image on the line (emulating |
To a certain degree, this is just the way those are going to be (once the image can be aligned to text-bottom). Asciidoctor PDF doesn't see text with subscript. It just sees an image. So the bottom of the image, no matter where it is, would align with the bottom of the text. That's just a limitation of this integration approach. |
Yes, I can see that for each embedded image you'd have to know the vertical coordinate of where the base of the text is supposed to be. Tricky! But thanks for the feedback. |
One thing I would recommend for asciidoctor-mathematical is to allow the image to be scaled by a fixed amount. That would allow the image to take up more of the line and thus align better with the existing text. I'm not sure how it determines the sizes now, but if they aren't adjustable, that itself can be problematic. |
I would like to add logic in asciidoctor-mathematical for a better inline equation layout. The feature I would like to have from asciidoctor-pdf, maybe from asciidoctor for inline images in general, is like the following:
This feature can only be provided as an extension to the inline image macro at the moment since inline markups are not part of the AST. |
In fact, I once tried to make the equations scale with the text, to make them the same size as the texts in titles, but without any successes. So at the moment, the equations in titles look extremely ugly since they are too small. The same happens in asciidoctor and asciidoctor-pdf. |
In the current version of Asciidoctor PDF, it's possible to make the image fit to the height of the line using I agree we can consider having control over the vertical alignment. Like I said, what you probably want is baseline so that the image lines up with the bottom of the text. (It already does center, and top and bottom would be above and below the text, respectively). There are, however, limits to how much this can even work. Prawn doesn't really have the same concept of lines like HTML/CSS. So we can fake it to a point, but then it gets really fuzzy. |
There are actually two problems here. First is the vertical alignment of the image. Second is that there doesn't seem to be any way to influence the height of the inline image that Asciidoctor Mathematical generates. It only bases the size on ppi for PNG and zoom for SVG. That's where the Perhaps we need
I don't think Asciidoctor Mathematical should manipulate the height and width itself (aside from the global scaling). It should be reporting the intrinsic height and width, but also include a role or option that allows the converter (or browser) to make the final adjustment. |
I'm starting to think a role might be best so that the HTML converter can control the size with CSS. @ProgramFan Would you also consider adding support for the mathematical-zoom attribute to control the base zoom for SVG images? |
I can add the mathematical-zoom attribute, but how shall it be defined? |
I would just allow the user to define |
I don't quite understand the idea. Here is my confusion: asciidoctor-mathematical works as a tree-preprocessor and just replaces the stem macros with image macros, so it generates the images prior to asciidoctor-pdf. But the zoom value can only be determined in asciidoctor-pdf and can be different under different scenarios (for example in titles and paragraphs). How can asciidoctor-mathematical act on a value that is not defined? My first imagnation of a solution is that the backends act on things like |
Yes, I get that. But for environments for where that doesn't apply or it can't work, the zoom would be a way to influence the intrinsic size that mathematical produces. It's a global setting, defined by the Regardless, we can't use |
I see. I will add mathematical-zoom just like that. |
👍 We'll then continue this discussion about how to coordinate so that the converter can resize the equation to fit with the size of the text. |
Has any progress been made on this front? |
If there were progress, it would be reported here. |
Oh, got it! |
Related to asciidoctor/asciidoctor-mathematical#45. |
Hi! Is there a version of asciidoctor where the inline math characters are aligned with the text in the PDF output? If not, is there a way to tweak this somehow? |
The current state is reflected by this issue and the linked one. If there was a change, this issue would be updated or closed. If you need help with a workaround, please ask in the project chat at https://chat.asciidoctor.org. Someone there may be able to help you. |
I guess what we really need is a proper engine which can layout images with height be the same as the line height. For block math, the image shall be even larger. asciidoctor-mathematical renders inline and block math as fix-sized svg images, then rely on the backend to adapt the size. asciidoc, as far as I know, has not yet provided a way to enforce the required behavior for images. |
Hi, I was advised in the asciidoctor-mathematical issues list to post this report here.
I have made a very simple example, consisting of a file with a single line.
An inline equation latexmath:[w] and bigger latexmath:[{\large w}]. With subscripts latexmath:[w_{ij}] bigger latexmath:[{\large w_{ij}}]. (As plain text, not an equation, we get _w~ij~_)
and turn it into a pdf using
asciidoctor-pdf -r asciidoctor-mathematical -o test.pdf test.adoc
My problem is that the inline equations (whether using png or svg mode) don't sit on the line with the other text - and it gets worse when there are subscripts. Does anyone know of any techniques to work around this situation?
Here's a screenshoot of how it looks:
The text was updated successfully, but these errors were encountered: