Skip to content

vertical alignment for \rule seems off #646

@tscholl2

Description

@tscholl2

When a \rule has a height argument, its vertical alignment seems to be off:

image

You can see the issue without \frac or \color, I just used them to highlight the issue.

Here is a similar expression in latex:

image

rendered with:

\documentclass{article}
\usepackage{color}
\begin{document}
$$
\frac{\textcolor{blue}{\rule{2em}{2em}}}{2}
$$
\end{document}

The katex screenshot was taken from the katex homepage today, and I've seen the same thing running version 0.7.1 (I'm not sure if the github pages has the most up to date version).

I'd love to help fix this if possible, but my fear is that it's a very subtle and complicated CSS issue. My guess is to look at the rule for \rule in the buildHTML? Specifically, I thought this function might be important:

https://github.com/Khan/KaTeX/blob/master/src/buildHTML.js#L1319

I don't know if this is a known issue, I couldn't find it searching, so sorry if this is a duplicate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions