2026-10-06 02:16:04 +08:00
|
|
|
.math-fit {
|
|
|
|
|
position: relative;
|
|
|
|
|
display: block;
|
|
|
|
|
width: 100%;
|
|
|
|
|
min-width: 0;
|
|
|
|
|
margin-block: 0.45em 0.5em;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.math-fit-content {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 0;
|
|
|
|
|
left: 50%;
|
|
|
|
|
width: max-content;
|
2026-10-14 14:00:03 +08:00
|
|
|
min-width: 100%;
|
2026-10-06 02:16:04 +08:00
|
|
|
padding-block: 0.1em;
|
|
|
|
|
transform-origin: top center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.math-fit .katex-display {
|
|
|
|
|
margin: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.math-fit .katex-display > .katex {
|
|
|
|
|
font-size: 1.1em;
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-14 14:00:03 +08:00
|
|
|
/* KaTeX tags are out of flow; reserve equal space to keep the formula centered. */
|
|
|
|
|
.math-fit .katex-html:has(> .tag) {
|
|
|
|
|
padding-inline: calc(var(--math-tag-width) + 1em);
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-06 02:16:04 +08:00
|
|
|
.markdown-content li .math-fit {
|
|
|
|
|
margin-block: 0.3em 0.35em;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.markdown-content li > p:has(.math-fit) {
|
|
|
|
|
margin-block: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.markdown-content li:has(.math-fit) {
|
|
|
|
|
margin-block: 0.35em;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.markdown-content li:has(.math-fit) > p:first-child:not(:has(.math-fit)) {
|
|
|
|
|
margin-bottom: 0.3em;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Unindented Markdown equations may follow a list as sibling blocks. */
|
|
|
|
|
.markdown-content :is(ol, ul):has(+ .math-fit) {
|
|
|
|
|
list-style-position: outside;
|
|
|
|
|
padding-left: 1.5em;
|
|
|
|
|
margin-top: 0.85em;
|
|
|
|
|
margin-bottom: 0.3em;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.markdown-content :is(ol, ul):has(+ .math-fit) > li {
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.markdown-content :is(ol, ul) + .math-fit:not([hidden]) {
|
|
|
|
|
width: calc(100% - 1.5em);
|
|
|
|
|
margin-left: 1.5em;
|
|
|
|
|
margin-top: 0.3em;
|
|
|
|
|
margin-bottom: 0.35em;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.markdown-content .math-fit + :is(ol, ul):has(+ .math-fit) {
|
|
|
|
|
margin-top: 0.35em;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Typography paragraph margins otherwise add a full line after equations. */
|
|
|
|
|
.markdown-content .math-fit:not([hidden]) + p,
|
|
|
|
|
.markdown-content :is(ol, ul):has(> li:last-child > .math-fit:last-child) + p {
|
|
|
|
|
margin-top: 0.5em;
|
|
|
|
|
}
|