Skip to content

SVG-based functions like \sqrt don't render reliably inside other SVG images. #1088

@davidflanagan

Description

@davidflanagan

At Khan Academy we sometimes use KaTeX strings inside of SVG images. But now that \sqrt{} and \vec{} are themselves rendered as SVGs we've discovered a problem. Our SVG images set fill-opacity to 0, so when we try to render \sqrt{2} inside of one of these images, the square root sign is fully transparent and does not show up at all.

I've discussed this with @kevinbarabash. We're thinking that we should add some kind of svg-reset class name to the toplevel HTML element that we output. And then define this class to reset SVG css properties (like fill-opacity and stroke-width) to their default values.

The idea is that we don't want SVG glyphs to be distinguishable from glyphs actually rendered by a real font, so we shouldn't allow anything in the CSS environment to affect SVG glyphs if it would not also affect font glyphs. So presumably we should inherit the CSS color property, but not the SVG-specific CSS stroke property.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions