// LaTeX tests for the basic mathml tags. // These come from three pages: // https://augenbit.de/wiki/index.php?title=LaTeX-Manual_LaTeX_Grundregeln // https://augenbit.de/wiki/index.php?title=LaTeX-Manual_Sekundarstufe_1 // https://augenbit.de/wiki/index.php?title=LaTeX-Manual_Sekundarstufe_2 // The names of the tests refer to these as augenbit0, augenbit1, and augenbit2. // Each table on the page are numbered starting at 1, and then the examples in the table are numbered. // Thus the first example on the first page is named "augenbit0_1_1" and the "a_{12}" example on that pages is "augenbit0_2_6". // This naming scheme makes it easy to find the source of the example and what the translation should be. use crate::common::*; #[test] fn augenbit0_1_1 () { let expr = "2+x=5"; test_braille("LaTeX", expr, r"2 +x =5"); } #[test] fn augenbit0_1_2 () { let expr = "|x-1|=|1-x|"; test_braille("LaTeX", expr, r"| x -1| =| 1 -x|"); } #[test] fn augenbit0_1_3 () { let expr = "n!=n*(n-1)!"; test_braille("LaTeX", expr, r"n! =n *(n -1)!"); } #[test] fn augenbit0_2_1 () { let expr = "x2"; test_braille("LaTeX", expr, r"x^2"); } #[test] fn augenbit0_2_2 () { let expr = "x10"; test_braille("LaTeX", expr, r"x^{10}"); } #[test] fn augenbit0_2_3 () { let expr = "a1+an"; test_braille("LaTeX", expr, r"a_1 +a_n"); } #[test] fn augenbit0_2_4 () { let expr = "xn+m"; test_braille("LaTeX", expr, r"x^{n +m}"); } #[test] fn augenbit0_3_1 () { let expr = "n"; test_braille("LaTeX", expr, r"n \to \infty"); } #[test] fn augenbit0_3_2 () { let expr = "x{3;4}"; test_braille("LaTeX", expr, r"x \notin \{3; 4\}"); } #[test] fn augenbit0_4_1 () { let expr = "a+ba-b"; test_braille("LaTeX", expr, r"\frac{a +b}{a -b}"); } #[test] fn augenbit0_4_2 () { let expr = "a+b"; test_braille("LaTeX", expr, r"\sqrt{a +b}"); } #[test] fn augenbit0_4_3 () { let expr = r#" n=1 12n=1 "#; test_braille("LaTeX", expr, r"\sum_{n =1}^\infty \frac{1}{2^n} =1"); } #[test] fn augenbit0_5_1 () { let expr = r#"AB"#; test_braille("LaTeX", expr, r"\overline{A \cup B}"); } #[test] fn augenbit1_1_1 () { let expr = r#"{1,2,3,4}"#; test_braille("LaTeX", expr, r"\{1, 2, 3, 4\}"); } #[test] fn augenbit1_2_3 () { let expr = r#"0-"#; test_braille_prefs("LaTeX", vec![("LaTeX_UseShortName", "false" )], expr, r"\mathbb Z_0^-"); test_braille_prefs("LaTeX", vec![("LaTeX_UseShortName", "true")], expr, r"\Z_0^-"); } #[test] fn augenbit1_3_2 () { let expr = r#"935"#; test_braille("LaTeX", expr, r"9 -3 \not= 5"); } #[test] fn augenbit1_3_3 () { let expr = r#"x±3"#; test_braille("LaTeX", expr, r"x \pm 3"); } #[test] fn augenbit1_3_6 () { let expr = r#"x10"#; test_braille_prefs("LaTeX", vec![("LaTeX_UseShortName", "false" )], expr, r"x \le 10"); test_braille_prefs("LaTeX", vec![("LaTeX_UseShortName", "true")], expr, r"x <=10"); } #[test] fn augenbit1_3_10 () { let expr = r#"π3,14"#; test_braille_prefs("LaTeX", vec![("LaTeX_UseShortName", "false"), ("DecimalSeparators", ","), ("BlockSeparators", ". ")], expr, r"\pi \approx 3,14"); test_braille_prefs("LaTeX", vec![("LaTeX_UseShortName", "true" ), ("DecimalSeparators", ","), ("BlockSeparators", ". ")], expr, r"~p \apx 3,14"); } #[test] fn augenbit1_3_14 () { let expr = r#"a=^b"#; test_braille("LaTeX", expr, r"a \hat{=} b"); } #[test] fn augenbit1_5_2 () { let expr = r#"1x"#; test_braille_prefs("LaTeX", vec![("LaTeX_UseShortName", "false" )], expr, r"\frac{1}{x}"); test_braille_prefs("LaTeX", vec![("LaTeX_UseShortName", "true")], expr, r"\f{1}{x}"); } #[test] fn augenbit1_5_7 () { // put number together -- editor created "0,1" and canonicalize didn't fix it let expr = r#" 0,1 6 = 1/6 "#; test_braille_prefs("LaTeX", vec![("LaTeX_UseShortName", "false" )], expr, r"0,1\overline{6} =1/6"); test_braille_prefs("LaTeX", vec![("LaTeX_UseShortName", "true")], expr, r"0,1\ol{6} =1/6"); } #[test] fn augenbit1_5_8 () { let expr = r#"75%=3/4"#; test_braille("LaTeX", expr, r"75% =3/4"); } #[test] fn augenbit1_6_8 () { let expr = r#" a23= a2/3 "#; test_braille_prefs("LaTeX", vec![("LaTeX_UseShortName", "false" )], expr, r"\sqrt[3]{a^2} =a^{2/3}"); test_braille_prefs("LaTeX", vec![("LaTeX_UseShortName", "true")], expr, r"\s[3]{a^2} =a^{2/3}"); } #[test] fn augenbit1_6_11() { // this is a slightly cleaned up version that comes for the original example (via MathJax) let expr = r#" 95 238 U "#; test_braille("LaTeX", expr, r"_{95}^{238}U"); } #[test] fn augenbit1_7_7 () { let expr = r#"logax"#; test_braille("LaTeX", expr, r"\log_a x"); } #[test] fn augenbit1_7_10 () { let expr = r#"cos2β"#; test_braille_prefs("LaTeX", vec![("LaTeX_UseShortName", "false" )], expr, r"\cos^2 \beta"); test_braille_prefs("LaTeX", vec![("LaTeX_UseShortName", "true")], expr, r"cos^2 ~b"); } #[test] fn augenbit1_7_12 () { let expr = r#"cot45°"#; test_braille("LaTeX", expr, r"\cot 45°"); } #[test] fn augenbit1_8_2 () { let expr = r#"ABC"#; test_braille("LaTeX", expr, r"\triangle ABC"); } #[test] fn augenbit1_8_4 () { let expr = r#"α,β,γ,δ,ϵ"#; test_braille("LaTeX", expr, r"\alpha, \beta, \gamma, \delta, \epsilon"); } #[test] fn augenbit2_1_3 () { // original display code contains forced spaces not in the output -- they are cleaned up here let expr = r#" lim x x0 "#; test_braille("LaTeX", expr, r"\lim_{x \to x_0}"); } #[test] fn augenbit2_1_4 () { // original display code contains forced spaces not in the output -- they are cleaned up here let expr = r#" f' (x), f''(x) "#; test_braille("LaTeX", expr, r"f'(x), f''(x)"); } #[test] fn augenbit2_2_2 () { // original display code contains forced spaces not in the output -- they are cleaned up here let expr = r#" ( nk ) "#; test_braille("LaTeX", expr, r"\binom{n}{k}"); } #[test] fn augenbit2_3_2 () { let expr = r#" q= 5 0,5 k+4 "#; // set number preferences to European style test_braille_prefs("LaTeX", vec![("DecimalSeparators", ","), ("BlockSeparators", ". ")], expr, r"\vec{q} = \begin{pmatrix} -5 \\ 0,5 \\ k +4 \end{pmatrix}"); } #[test] fn augenbit2_3_4 () { let expr = r#" ( abc def ) "#; // set number preferences to European style test_braille_prefs("LaTeX", vec![("DecimalSeparators", ","), ("BlockSeparators", ". ")], expr, r"\begin{pmatrix} a & b & c \\ d & e & f \end{pmatrix}"); }