Registry / RepositoryTypeScriptRustPython
Rollpie
ReadmeFiles
Versions
Info
Download
0.2.0579.9 KB2026-09-150.1.1576.6 KB2026-09-12
Version
0.1.1
Copyright
Rollpie, Irohabook
Publisher
math
Published
2026-09-12
Size
576.6 KB
Downloads
4
Checksum
8e0181e42f4abdc9f91c1ff48b058761bf1940be8d2d4747e5e74bd3014f4322
Dependencies
None

grid.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//! 行列まわりを大きく見るための一枚

use suki::font;
use suki::{Mode, Shape, escape};

const SOURCES: &[&str] = &[
    r"A = \begin{pmatrix} a & b \\ c & d \end{pmatrix}",
    r"\det A = \begin{vmatrix} a & b \\ c & d \end{vmatrix}",
    r"I = \begin{bmatrix} 1 & \cdots & 0 \\ \vdots & \ddots & \vdots \\ 0 & \cdots & 1 \end{bmatrix}",
    r"f(x) = \begin{cases} 1 & x > 0 \\ 0 & x \leq 0 \end{cases}",
    r"\begin{array}{lcr} \hline a & bb & ccc \\ \hline 1 & 22 & 333 \\ \hline \end{array}",
];

fn main() {
    let path = std::env::args().nth(1).unwrap_or_else(|| "font/latinmodern-math.otf".to_string());
    let loaded = font::load(std::fs::read(&path).unwrap()).unwrap();

    println!("<!DOCTYPE html><html lang=\"ja\"><head><meta charset=\"utf-8\"><title>行列</title><style>");
    println!("@font-face{{font-family:\"{}\";src:url(\"{}\")}}",
        escape(font::family(&loaded)), escape(&path));
    println!("{}", suki::style(&loaded));
    println!("body{{margin:0;padding:28px;font-family:system-ui,sans-serif;font-size:12px}}");
    println!(".row{{margin-bottom:34px}}");
    println!(".big{{font-size:54px}}");
    println!(".src{{color:#767676;margin-bottom:6px}}");
    println!("</style></head><body>");

    for source in SOURCES {
        println!("<div class=\"row\"><div class=\"src\">{}</div>", escape(source));
        println!("<div class=\"big\">{}</div></div>",
            suki::render_svg(source, &loaded, Mode::Display, Shape::Outline).unwrap());
    }

    println!("</body></html>");
}