Skip to content

visual: mid-formula \displaystyle is ignored, and \cfrac is typeset as \frac #894

Description

@d-q222

Two separate math-style bugs, filed together because one repro exposes both and they are likely the same style-tracking code.

Found by visual comparison of rendered pages against pdflatex.

Minimal repro

\documentclass{article}
\usepackage{amsmath}
\begin{document}
A: leading displaystyle: $\displaystyle\sum_{d\mid n}\varphi(d)$.

B: mid-formula displaystyle: $L(n)=\displaystyle\sum_{d\mid n}\varphi(d)$.

C: mid-formula prod: $m=\displaystyle\prod_{k=1}p_k$.

D: no displaystyle: $\sum_{d\mid n}\varphi(d)$.

E: cfrac: $[3,5,2,3]=3+\cfrac{1}{5+\cfrac{1}{2+\cfrac{1}{3}}}$.

F: frac: $[3,5,2,3]=3+\frac{1}{5+\frac{1}{2+\frac{1}{3}}}$.

G: display cfrac:
\[ 3+\cfrac{1}{5+\cfrac{1}{2+\cfrac{1}{3+\cfrac{1}{4}}}} \]
\end{document}

Oracle: /Library/TeX/texbin/pdflatex, TeX Live 2026; Package: amsmath 2025/07/09 v2.17z confirmed in the .log. \cfrac is amsmath's; \displaystyle is plain TeX.

Bug 1 — \displaystyle is honoured only as the first token of the formula

line pdflatex FlashTeX
A $\displaystyle\sum...$ big ∑, limits below big ∑, limits below — ok
B $L(n)=\displaystyle\sum...$ big ∑, limits below small ∑, limits at the side — wrong
C $m=\displaystyle\prod...$ big ∏, limits below small ∏, limits at the side — wrong
D $\sum...$ (no \displaystyle) small ∑, limits at side small ∑, limits at side — ok

Measured inside FlashTeX's own output (page.get_texttrace(), glyph widths):

  • A: glyph 3074, width 14.39 pt (display variant)
  • B: glyph 3060, width 10.52 pt
  • D: glyph 3060, width 10.52 pt

B and D are byte-for-byte the same size, i.e. the \displaystyle in B had no effect at all. pdflatex renders B the same as A.

Bug 2 — \cfrac is typeset as \frac

\cfrac must keep every level of a continued fraction at the same (display) size. FlashTeX shrinks each nesting level exactly as \frac does, so a three- or four-level continued fraction ends up unreadably small.

Lines E and F prove it directly: FlashTeX's \cfrac output is indistinguishable from its own \frac output, while pdflatex renders them very differently. Line G shows the same in a display.

Why the numeric checks missed both

Neither changes the extracted text, and FlashTeX emits no diagnostic for either. They only change glyph sizes and vertical extents.

Corpus occurrences

  • \displaystyle: /Users/dqi26/ross/set11/set11.tex:115 ($L(n) = \displaystyle\sum_{d \mid n} \varphi(d)$) and :145146 ($m = \displaystyle\prod_{k=1} p_k^{e_k}$). Both on page 1 of set11; line 109 in the same file has \displaystyle leading and renders correctly, which is the tell.
  • \cfrac: /Users/dqi26/ross/set3/set3.tex:208, 238, 241, 245, 248. Page 3 of set3 is the clearest side-by-side — the oracle's nested fractions are full height, FlashTeX's collapse to a few points tall.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions