-
Notifications
You must be signed in to change notification settings - Fork 15
/
latex_test.sj
19 lines (16 loc) · 875 Bytes
/
latex_test.sj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
ClearAll(a,b,c,d,x,y,f)
T LaTeXString(x) == "x"
T LaTeXString(1/2) == "\\frac{1}{2}"
T LaTeXString(I) == "\\mathbb{i}"
T LaTeXString(I+1.0) == "1.0 + 1.0\\mathbb{i}"
T LaTeXString(Cos(x)) == "\\text{Cos} \\! \\left( x \\right) "
T LaTeXString(a => b) == "a \\Rightarrow b"
T LaTeXString(x/y) == "\\frac{x}{y}"
T LaTeXString((a+b)/(c+d)) == "\\frac{a + b}{c + d}"
T LaTeXString(x*(a+b)/(c+d)) == "\\frac{ \\left( a + b \\right) \\ x}{c + d}"
T LaTeXString(f(x)) == "f \\! \\left( x \\right) "
T LaTeXString((a+b)*x^2 ) == " \\left( a + b \\right) \\ x^{2}"
#T LaTeXString(((1 + x)^(-1))*y - ((2 + x)^(-1))*y) == "\\frac{y}{1 + x} + \\frac{- \\ y}{2 + x}"
## Print + before a fraction with leading - in numerator. (better than printing nothing)
T LaTeXString(((1 + x)^(-1))*y - ((2 + x)^(-1))*y) == "\\frac{y}{1 + x} \\ + \\frac{- \\ y}{2 + x}"
ClearAll(a,b,c,d,x,y,f)