简体   繁体   English

如何将css样式添加到katex html

[英]how to add css style to katex html

I'm using katex for math symbol in my html.我在我的 html 中使用 katex 作为数学符号。 The elements overflow form the parent div, When I'm adding style to the container div, overflow: hidden to parent div those elements not shown at all, it is possible to limit the size of the element?元素从父div溢出,当我向容器div添加样式时, overflow: hidden到父div那些根本没有显示的元素,是否可以限制元素的大小? thanks.谢谢。

What effect do you expect from limiting the size of the container?你期望限制容器的大小有什么影响?

As far as I know, KaTeX doesn't support wrapping.据我所知,KaTeX 不支持换行。 (In part that's because KaTeX doesn't worry much about horizontal widths. It does vertical positioning but horizontal width was left to the browser to sort out. Or at least that was the case last I worked on it, there might have been changes motivated by constructs such as underbrace.) (部分原因是因为 KaTeX 不太担心水平宽度。它进行垂直定位,但水平宽度留给浏览器来整理。或者至少这是我最后一次工作的情况,可能有改变的动机通过诸如underbrace之类的结构。)

I guess a more reasonable thing to do would be to scale down the math till it fits the desired width.我想更合理的做法是缩小数学范围,直到它适合所需的宽度。 KaTeX doesn't support that either, but there should be ready to use solutions for that or there somewhere. KaTeX 也不支持,但应该准备好使用解决方案。

If you know the setup where your formula will be shown, then wrapping it manually usually gives the best results.如果您知道将显示公式的设置,那么手动包装它通常会得到最好的结果。 Humans are good at finding places where wrapping makes sense, and at seeing alignment to help the reader.人类善于发现换行有意义的地方,并善于看到对齐来帮助读者。

I've faced this situation and found that you can edit the katex.min.css in order to adjust the font or use your own fonts.我遇到过这种情况,发现可以通过编辑katex.min.css来调整字体或者使用自己的字体。 Note that you usually ignore node_modules (if you are working with npm)请注意,您通常会忽略node_modules (如果您正在使用 npm)

Heres is the official guide by Katex.这是 Katex的官方指南

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM