Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

KaTeX font size

Tags:

katex

The function support page of KaTeX states that the dimension of KaTeX units used for font dimensions are computed with respect to the surrounding HTML text. In particular, it states that

G = 1.21 by default, because KaTeX font-size is normally 1.21 × the surrounding font size. This value can be over-ridden by the CSS of an HTML page. For example, on this page, G = 1.0.

Now the question is, where I should change the value of G?

like image 536
gvgramazio Avatar asked Jun 17 '18 11:06

gvgramazio


People also ask

What is KaTeX format?

KaTeX is a cross-browser JavaScript library that displays mathematical notation in web browsers. It puts special emphasis on being fast and easy to use. KaTeX. Stable release. v0.15.2 / January 12, 2022.


2 Answers

As stated in the KaTex wiki, that can be reset in CSS as, for example,

.katex { font-size: 1em !important; } 

Edit

The documentation is no more hosted on the wiki of the project. You can see the same information in the new official documentation page here.

like image 87
gvgramazio Avatar answered Sep 28 '22 02:09

gvgramazio


This is now documented at: https://katex.org/docs/font.html

By default, KaTeX math is rendered in a 1.21× larger font than the surrounding context, which makes super- and subscripts easier to read. You can control this using CSS, for example, to set to 1.1×:

.katex { font-size: 1.1em; }

Doc source at: https://github.com/KaTeX/KaTeX/blob/v0.10.2/docs/font.md