Latex support guide

Updated at:

This document explains how the CosyVoice large model provides speech synthesis for LaTeX formulas in primary and secondary school mathematics scenarios.

Scenarios

Scenario: Teaching mathematics in primary and secondary schools.

Supported languages

Only Chinese is supported.

Supported models

Currently, only the cosyvoice-v2 model is supported.

Usage

You can wrap the LaTeX formula in your text with \ or $ separators. The system then converts the formula into natural language for speech synthesis.

Supported formats include the following, where ... represents the actual formula content:

  • $...$

  • $$...$$

  • \(...\)

  • \[...\]

For example, the text "Let's do a math problem, $2 + 3 = 5$" is read aloud as "Let's do a math problem, two plus three equals five".

Notes

  • In a string literal, you must escape the backslash character using a double backslash \\. For example:

    • \a becomes \\a

    • \n becomes \\n

    • \t becomes \\t

    • \f becomes \\f

    • \r becomes \\r

    • \v becomes \\v

  • Formulas not enclosed by \ or $ separators may be read incorrectly or ignored.

  • Speech synthesis for mathematical formulas in Markdown format is not supported.

  • If Chinese characters are included within the separator tags (\ or $), the speech synthesis result may be inaccurate.

  • If English text appears before or after a formula, the content within the \ or $ tags is skipped.

  • Formulas in unsupported formats are output in their original form.

Supported tags and symbols

This section lists the supported mathematical tags and symbols for categories such as basic math, special symbols, geometry, conditional expressions, and units. For each entry, the table provides its meaning, a formula example, and the corresponding speech synthesis output in Chinese.

Basic math

Tag or symbol

Function

Formula content example

Text for synthesis example

Chinese reading

+

Add

2 + 3 = 5

$2 + 3 = 5$

Two plus three equals five

-

Subtract

3 - 2 = 1

$3 - 2 = 1$

Three minus two equals one

\pm

Plus-minus

\pm 1 \pm 2

$\pm 1\pm 2$

Positive or negative one plus or minus two

Positive/Negative

\times

Multiply

2 \times 3 = 6

$2 \times 3 = 6$

Two times three equals six

×

2 × 3 = 6

$$2 × 3 = 6$$

*

2 * 3 = 6

\(2 * 3 = 6\)

\div

Divide

6\div2=3

\[6\div2=3\]

Six divided by two equals three

÷

6÷2=3

$6÷2=3$

/

6/2=3

$6/2=3$

=

Equals

3+5=8

$3+5=8$

Three plus five equals eight

<

Less than

1< 2

$1< 2$

One is less than two

Less than or equal to

3≤5

$3≤5$

Three is less than or equal to five

<=

3<=5

$3<=5$

\leq

3\leq5

$3\leq 5$

\le

3\le5

$3\le 5$

\leqq

3\leqq5

$3\leqq 5$

\leqslant

3\leqslant5

$3\leqslant 5$

>

Greater than

2>1

$2>1$

Two is greater than one

Greater than or equal to

5≥3

$5≥3$

Five is greater than or equal to three

>=

5>=3

$5>=3$

\geq

5\geq3

$5\geq 3$

\ge

5\ge3

$5\ge 3$

\geqq

5\geqq3

$5\geqq 3$

\geqslant

5\geqslant3

$5\geqslant 3$

\frac

Fraction

2\frac3

$\frac {2}{3}$

Two-thirds

^

Power

2^1

$2^{1}$

Two to the power of one

\sqrt

Root

\sqrt{9} = 3

$\sqrt {9} = 3$

The square root of nine equals three

\sqrt[3]{8} = 2

$\sqrt[3]{8} = 2$

The cube root of eight equals two

\%

Percentage

5\%

$5\%$

Five percent

|

Absolute value

∣3∣=3

$|3| =3$

The absolute value of three equals three

\vert

3\vert=3

$\vert 3\vert =3$

The absolute value of three equals three

\lg

Logarithm

lg {10}

$\lg {10}$

log ten

\log

Logarithm

\log{5}

$\log{5}$

log five

\ln

Natural logarithm

\lnX

$ln {10}$

LN ten

!

Factorial

5!

$5!$

Five factorial

()

Parentheses

(2+1)

$(2+1)$

Parentheses two plus one

\{ \}

$\{2+1\}$

Open brace two plus one close brace

Special mathematical symbols

Tag or symbol

Transform

Formula content example

Text for synthesis example

Chinese reading

\alpha

alpha

\alpha

$\alpha$

α

 

\Alpha

\Alpha

$\Alpha$

\beta

beta

\beta

$\beta$

beta

 

\Beta

\Beta

$\Beta$

\gamma

gamma

\gamma

$\gamma$

γ

 

\Gamma

\Gamma

$\Gamma$

\delta

delta

\delta

$\delta$

Delta

 

\Delta

\Delta

$\Delta$

\infty

Infinity (Part 2)

\infty

$\infty$

Infinity

 

infty (English)

$∞$

Geometry

Tag or symbol

Function

Formula content example

Formula input example

Chinese reading

\pi

Dispatch

\pi=3.14159

$\pi =3.14159$

Pi equals three point one four one five nine

\sin (sine)

Trigonometric function

\sin (sine30^\circ=1\frac2

$\sin 30^\circ =\frac {1}{2}$

sine thirty degrees equals one-half

\cos (cosine)

$\cos 30^\circ =\frac {\sqrt {2}}{2}$

cosine thirty degrees equals the square root of two over two

\tan (tangent)

$\tan 30^\circ =\frac {\sin 30^\circ}{\cos 30^\circ}$

tangent thirty degrees equals sine thirty degrees over cosine thirty degrees

\csc (cosecant)

$\csc A$

cosecant A

\sec (secant)

$\sec A$

secant A

\cot (cotangent)

$\cot A$

cotangent A

\angle

Angle

\angle AB

$\angle AB$

Angle A B

∠AB

$∠AB$

^\circ

Degree

∠AB = 30^\circ

$∠AB = 30^\circ$

Angle A B equals thirty degrees

\odot

Circle

\odot

$\odot$

Circle

\overset\frown

Arc

\overset\frown {BC}

$\overset\frown {BC}$

Arc BC

\rm{Rt}

Right angle

\because \rm{Rt}\triangle ABC

$\because \rm{Rt}\triangle ABC$

Because right triangle ABC

\mathrm{Rt}

\therefore AB \perp BC

$\therefore AB \perp BC$

Therefore AB is perpendicular to BC

\triangle

Triangle

\triangleABC

$\triangle ABC$

Triangle ABC

△ABC

$△ABC$

\parallelogram

Parallelogram

\parallelogramABCD

$\parallelogram ABCD$

Parallelogram ABCD

\perp

Perpendicular

AB \perp BC

$AB \perp BC$

A B is perpendicular to B C

\bot

AB \bot BC

$AB \bot BC$

AB ⊥ BC

$AB ⊥ BC$

\parallel

Parallel

A\parallel B

$A\parallel B$

A is parallel to B

\equalparallel

Parallel and equal to

A\equalparallel B

$A\equalparallel B$

A is parallel and equal to B

\cong

Congruent to

△ABC\cong△DEF

$△ABC\cong△DEF$

Triangle ABC is congruent to triangle DEF

Conditions

Tag or symbol

Function

Formula content example

Formula input example

Chinese reading

\implies

Launch

\implies 1+1=2

$\implies 1+1=2$

Implies one plus one equals two

\iff

Equivalent to

p\iffq

$p\iffq$

p is equivalent to q

\because 

Because

\because a = b \therefore b=a

$\because a = b \therefore b=a$

Because a equals b, therefore b equals a

\therefore 

Therefore

Units

Units must be enclosed by \unit, \quantity, \mathit, \mathrm, or \rm tags. For example, \unit{cm}.

Tag or symbol

Reading

Formula content example

Formula input example

Chinese reading

mm

millimeter

5\quantity{mm}

$5\quantity{mm}$

five millimeters

cm

centimeter

5\quantity{cm}

$5\quantity{cm}$

five centimeters

dm

decimeter

5\quantity{dm}

$5\quantity{dm}$

five decimeters

m

meter

5\quantity{m}

$5\quantity{m}$

five meters

km

kilometer

5\quantity{km}

$5\quantity{km}$

five kilometers

g

gram

5\quantity{g}

$5\quantity{g}$

five grams

kg

kilogram

5\quantity{kg}

$5\quantity{kg}$

five kilograms

t

ton

5\quantity{t}

$5\quantity{t}$

five tons

mm^2

square millimeter

5\quantity{mm^2}

$5\quantity{mm^2}$

five square millimeters

cm^2

square centimeter

5\quantity{cm^2}

$5\quantity{cm^2}$

five square centimeters

dm^2

square decimeter

5\quantity{dm^2}

$5\quantity{dm^2}$

five square decimeters

m^2

square meter

5\quantity{m^2}

$5\quantity{m^2}$

five square meters

km^2

square kilometer

5\quantity{km^2}

$5\quantity{km^2}$

five square kilometers

mm^3

cubic millimeter

5\quantity{mm^3}

$5\quantity{mm^3}$

five cubic millimeters

cm^3

cubic centimeter

5\quantity{cm^3}

$5\quantity{cm^3}$

five cubic centimeters

dm^3

cubic decimeter

5\quantity{dm^3}

$5\quantity{dm^3}$

five cubic decimeters

m^3

cubic meter

5\quantity{m^3}

$5\quantity{m^3}$

five cubic meters

km^3

cubic kilometer

5\quantity{km^3}

$5\quantity{km^3}$

five cubic kilometers

ml

milliliter

5\quantity{ml}

$5\quantity{ml}$

five milliliters

s

second

5\quantity{s}

$5\quantity{s}$

five seconds

min

minute

5\quantity{min}

$5\quantity{min}$

five minutes

h

hour

5\quantity{h}

$5\quantity{h}$

five hours

km/h

kilometers per hour

5\quantity{km/h}

$5\quantity{km/h}$

five kilometers per hour

g/l

grams per liter

5\quantity{g/l}

$5\quantity{g/l}$

five grams per liter