How to make sub cases use same font size as outmost one

I want to set the sub cases’s font size, I don’t want to make it automatically decrease in this case, but can’t find any document or APIs or discussions, thanks in advance!

The code:


$ "数学" cases(
  "基础数学" cases(
    "数论",
    "代数",
    "分析" cases(
      "实分析",
      "复分析",
    ),
  ),
  "应用数学" cases(
    "统计学",
    "计算方法",
    "运筹学"
  ),
  
  "交叉领域:数学物理、计算数学、金融数学"
) $

The current result:

1 Like

you can force cases to show in the default size (display) like this:

#show math.cases: math.display
2 Likes

Thanks, It works!
But I find it’s hard to change the font setting here, I want to use the same font as main text, the font can’t be used as math font.

Do we have any work around?

#show math.equation: set text(font: (
  (name: "Source Han Serif SC", covers: regex("\p{script=Han}")),
  "New Computer Modern Math",
))

$ f(x) #[原神] $

Explanation can be found here:

1 Like

Thanks, it’s better now, still get issue with punct

#show math.cases: it => {
  math.display(it)
}
#show math.equation: set text(font: (
  (name: "Source Han Serif SC", covers: regex("\p{script=Han}")),
  "New Computer Modern Math",
))



$ "数学" cases(
  "基础数学" cases(
    "数论",
    "代数",
    "分析" cases(
      "实分析",
      "复分析",
    ),
  ),
  "应用数学" cases(
    "统计学",
    "计算方法",
    "运筹学"
  ),
  
  "交叉领域:数学物理、计算数学、金融数学"
) $

Extend the cover will fix it:

#show math.equation: set text(font: (
  (name: "Source Han Serif SC", covers: regex("[\p{script=Han}\p{P}]")),
  "New Computer Modern Math",
))

1 Like

Hi chaos1! I have re-examined it and realized that no regex is necessary in your case.

#show math.equation: set text(font: (
  "Noto Serif CJK SC",
  "New Computer Modern Math",
))
#set math.cases(gap: 1em)
#show math.cases: math.display

Full code
#set page(width: auto, height: auto, margin: 1em)

#show math.equation: set text(font: (
  "Noto Serif CJK SC",
  "New Computer Modern Math",
))
#set math.cases(gap: 1em)
#show math.cases: math.display


$ "数学" cases(
  "基础数学" cases(
    "数论",
    "代数",
    "分析" cases(
      "实分析",
      "复分析",
    ),
  ),
  "应用数学" cases(
    "统计学",
    "计算方法",
    "运筹学"
  ),
  
  "交叉领域:数学物理、计算数学、金融数学"
) $

I am updating that FAQ in Update equation-chinese-font.md by YDX-2147483647 · Pull Request #83 · typst-doc-cn/guide · GitHub and the following is a preview.

// Besides, did you forget geometry?

1 Like