39个版本 (6个重大更改)

0.7.2 2023年4月29日
0.6.1 2023年3月23日
0.3.3 2022年12月6日
0.3.0 2022年11月30日
0.1.0 2022年7月19日

#649 in 文本处理

每月27次 下载
4 crate 中使用

MIT 许可证

69KB
2K SLoC

TexCore

GitHub Workflow Status Crates.io Lines of code Crates.io GitHub top language

TexCore 库遵循 MIT 许可证

TexCore 是一个库,允许开发人员使用原生 Rust 类型编写 LaTeX。我们还提供了使用 Rust 构建的 LaTeX 编译器 tectonic 编译代码的功能。

将其添加到您的项目中

[dependencies]
texcore = "0.7"

编译功能

为了使此库能够在 Windows 系统上运行,我已经将 tectonic 依赖项设置为可选,并且仅在 compile 功能下可用。这意味着函数 texcore::compile()ElementList::compile() 被隐藏在此功能之下。

[dependencies]
texcore = { version = "0.7", features = ["compile"] }

TexCreate 模板功能

为了更容易地与 TexCreate 项目一起开发,我决定将 texcreate-templates 部分添加到 texcreate_template 功能中。

texcore = { version = "0.7", features = ["texcreate_template"] }

异步功能

此功能提供使用类型 TexAsync 的异步选项,它不是一个特质,而是一个需要 T 实现 Tex 的泛型结构体。不使用特质的原因是特质中的异步方法尚不稳定。最重要的是,我们从 future 模块中获得了以下函数

  • async_latex_string<T:Tex>(t: &T) ->implFuture<Output=String> + Send
  • Element<Any>::async_latex_string()
  • ElementList::async_latex_string()
  • ElementList::async_latex_split_string()
  • ElementList::async_write()
  • ElementList::async_split_write()

使用异步写入操作的优势在于它们是并发执行的,而且在 async_split_write() 中,写入每个文件的任务是并行执行的。

texcore = { version = "0.7", features = ["async"] }

并行功能

本功能利用 rayon 库,使 ElementList 包含以下功能:

  • ElementList::par_write()
  • ElementList::par_write_split()
  • ElementList::par_iter()
  • ElementList::par_iter_mut()
texcore = { version = "0.7", features = ["parallel"] }

完整功能

要启用上述所有功能,可以使用 full 功能。

texcore = { version = "0.7", features = ["full"] }

0.7 版本中添加的模块

  • bundle 模块提供类型,以便轻松添加到您的文档中
    • 在模块 graphicx 下使用包添加图片
    • 在模块下添加数学符号或方程,texcore::bundle::math
  • 可以使用 modify_element() 函数为元素添加额外参数
    • 此功能位于 texcore::extra_ops 模块下

在此处阅读文档 here

依赖项

~0.4–17MB
~227K SLoC