KaTeX / KaTeX/KaTeX

Font size for `$...$` inside of `\text` inside of `\substack`

Open
#3,178 1 comment 1 reaction 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
20.4k
Forks
1.3k
Avg merge
14h 37m
Merged PRs (30d)
7

Description

> Before reporting a bug
- [x] Check [common issues](https://katex.org/docs/issues.html).
- [x] Check the bug is reproducible in [the demo](https://katex.org). If not, check KaTeX is up-to-date and installed correctly.
- [x] Search for [existing issues](https://github.com/KaTeX/KaTeX/issues).

**Describe the bug:**

Font size is not set consistently when using inline math `$...$` and `\text{...}` inside of the `\substack` command.

**To Reproduce:**

Visit [katex.org](https://katex.org/) and enter the following:

```
\bigg\{ \;\mathbb{F}[x]\text{-modules } V\; \bigg\}
\longleftrightarrow
\bigg\{ \substack{\text{$\mathbb{F}$-vector spaces $V$ with a}\\ \text{linear map $T : V \rightarrow V$}} \bigg\}
```

KaTeX renders the inline math `$...$` with a normal-sized font, but renders the rest of the `\text{...}` with a smaller font.

![image](https://user-images.githubusercontent.com/221963/130331319-d58a1604-6d58-4db7-86e9-b3614e0f8b94.png)

**Expected behavior:**

The math font and text font should be the same size. For example, LaTeX produces:

![image](https://user-images.githubusercontent.com/221963/130331242-6afa5a3e-1c12-4eb6-a5ba-5cd1ca3d9cb1.png)

**Workarounds:**

Explicitly including a size like `\small` or `\normalsize` produces more acceptable output:

```
\bigg\{ \;\mathbb{F}[x]\text{-modules } V\; \bigg\}
\longleftrightarrow
\bigg\{ \substack{\small\text{$\mathbb{F}$-vector spaces $V$ with a}\\\small \text{linear map $T : V \rightarrow V$}} \bigg\}
```

![image](https://user-images.githubusercontent.com/221963/130331333-55bb4964-3090-409b-b79f-0bfa708c011e.png)

**Environment (please complete the following information):**
- KaTeX Version: 0.13.13
- Device: Desktop
- OS: Ubuntu 20.04
- Browser: Chrome
- Version: 92

**Additional context:**
N/A

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.