31 个版本 (9 个重大更新)

0.11.10 2024年7月24日
0.11.8 2024年5月15日
0.11.6 2024年3月27日
0.11.1 2023年12月8日
0.3.8 2022年11月14日

#125 in 文本处理

Download history 126/week @ 2024-05-02 126/week @ 2024-05-09 43/week @ 2024-05-16 5/week @ 2024-05-23 1/week @ 2024-05-30 3/week @ 2024-06-27 31/week @ 2024-07-04 123/week @ 2024-07-18 256/week @ 2024-07-25 24/week @ 2024-08-01

每月403次下载

MIT 许可证

175KB
4.5K SLoC

vesti

一个编译成 LaTeX 的转译器。

为什么需要一个 LaTeX 转译器?

我以前使用 LaTeX (或 plainTeX) 创建了多个文档,但它的语法并不方便使用。例如,一个简单的 LaTeX 文档。

% coprime is my custom class. See https://github.com/e0328eric/coprime.
\documentclass[tikz, geometry]{coprime}

\settitle{My First Document}{Sungbae Jeong}{}
\setgeometry{a4paper, margin = 2.5cm}

\begin{document}
\section{Foo}
Hello, World!
\begin{figure}[ht]
    \centering
    \begin{tikzpicture}
        \draw (0,0) -- (1,1);
    \end{tikzpicture}
\end{figure}

Upper code is a figure using tikz.

\end{document}

我使用它的烦恼在于 \begin\end 块。有没有办法写得简单一些?这个问题促使我开始这个项目。目前,以下代码使用 vesti 生成 LaTeX 代码(除了注释)。

% coprime is my custom class. See https://github.com/e0328eric/coprime.
docclass coprime (tikz, geometry)

\settitle{My First Document}{Sungbae Jeong}{}
\setgeometry{a4paper, margin = 2.5cm}

startdoc

\section{Foo}
Hello, World!
useenv figure [ht] {
    \centering
    useenv tikzpicture {
        \draw (0,0) -- (1,1);
    }
}

Upper code is a figure using tikz.

安装

Vesti 可以使用 cargo 安装。

$ cargo install vesti

配置文件

默认情况下,它使用本地 pdflatex 编译 vesti。如果您想更改默认行为,请将 config.yaml 添加到 $CONFIG_PATH/vesti 并按照以下内容进行操作

engine:
  main:
    "tectonic"

此示例将 vesti 默认设置为运行 tectonic 后端。 (您必须使用 tectonic-backend 下载 vesti 以使用 tectonic)。主要引擎的完整列表位于 src/commands.rs 中。

警告

此语言处于测试版本,因此未来可能会存在重大更改。请谨慎用于大型项目。

依赖项

~3–37MB
~581K SLoC