Right now, the line height of generated data is hard-coded to 1.2. Unfortunately, the lh unit is far off, so, it would likely have to be a setting on the katex.render function.
It would be desirable to have this so that the line height of equations could match the line height of their surrounding text. This already happens for inline equations, but doesn't if the equations span multiple lines.
Line height is (I believe) controlled by CSS. Did you try defining a custom CSS rule to override tue built-in one, like
.katex { line-height: 1.5 !important; }
?
I agree that it would be nice to make this more naturally configurable. This is essentially asking for \baselineskip/\baselinestretch as part of #687.
@edemaine You can change the line height for katex and it will actually affect the text, if it takes up only one line. Otherwise, text which takes up multiple lines will always have lines 1.2em tall, as that's factored into the spacing that KaTeX does normally.
So, to clarify, setting line-height for katex does work, and setting font-size works too because everything is in terms of em. But because everything is in terms of em, there's actually no way of configuring line-height for multiline content via katex-display. It will only affect the line-height of the first line.
Ah I think I see. Can you provide an example of something that ought to be (i.e. in LateX) is more vertically spaced when the line height is larger?
@clarcharr We don't currently have an an equivalent to LaTeX \renewcommand{\arraystretch}{1.5}, which would change the line spacing of an entire environment. But you can set extra environment line spacing on a line by line basis, using \cr[0.3em] as your line separator.
By the way, \gdef\arraystretch{1.5} will be pretty easy to support once we have #1309.
I would like to see this feature as well, especially with auto-render extracting the line height from the parent DOM node to apply it to multi-line blocks like array or equation. @edemaine I changed the line-height attribute of .katex in the web developer tools on site and it appears to leave exponentials and subscripts of symbols behind, even if it principally works.
Implementing arraystretch could make sense in a second step but in contrast to LaTex, in the web world the renderer should obey the main document.
Adding line height as a config option as suggested by the OP plus making it set by the auto-renderer should be the better option in my opinion.
So, what exactly is the current progress on this?
No progress on this. I've added \baselinestretch to the list of lengths we want to support with \setlength in #687. I think this ticket is a duplicate of that one some I'm going to close this.
One other update that didn't make it to this thread is that we do now support \def\arraystretch; see https://katex.org/docs/support_table.html