#latex #initialization #build #template #folder #toml #command

app itex

在文件夹内立即初始化一个 LaTex 项目

9 个稳定版本

1.3.5 2023年6月20日
1.3.4 2023年4月30日
1.2.1 2023年3月1日
1.2.0 2023年2月11日

#60模板引擎

每月 50 次下载

GPL-3.0 许可证

49KB
1K SLoC

Rust 1K SLoC // 0.0% comments Python 167 SLoC // 0.0% comments

ITex

version license GitHub code size in bytes Ubuntu-latest codecov

在当前文件夹中初始化一个 latex 项目

用法

Usage: itex <COMMAND>

Commands:
  build          Build ITex project (requires an itex-build.toml file, and pdflatex to be installed)
  count          Count the number of words in the current ITex project (requires texcount to be installed)
  clean          Clean auxillary build files
  init           Initialize LaTex project
  info           Get info about a template
  get            Get current value of a setting
  list           List installed templates
  new-buildfile  Create a new itex build file
  set            Set a setting
  update         Update installed templates
  help           Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

可用的模板

  • 默认(仅包含基础,具有输出文件夹和 Makefile)
  • iSci
  • apa
  • Electron(我自己的模板)

入门指南

第一步是安装 itex,请参阅在 Windows 或 macOS 上的安装说明以安装到您选择的平台。
要复制模板,请使用

itex init <template name>

要获取模板名称列表,请使用

itex list

在复制模板后使用

itex build

来构建项目。
如果您的项目中存在错误,请使用

itex build --debug

以获取调试输出。

选项

ITex 提供了一些选项来控制项目构建的方式。使用

itex get

以获取选项的全列表。
默认情况下,仅设置默认_filename。如果您已将 tex 文件名从 main.tex 更改为其他名称,您还希望将其更改为新文件名。

itex set default_filename <Insert filename here (without the .tex)>

所有选项的描述可以在以下维基百科中找到: https://github.com/oneelectron/itex/wiki/ITex-settings

在 MacOS 上安装

ITex 不在 homebrew 的默认分支上,因此您需要添加我的分支然后安装 ITex

brew tap oneelectron/oneelectron
brew install itex -s

在 Windows 上安装

ITex 还没有 Windows 安装程序,因此建议您使用 cargo 安装 itex,然后使用 itex 安装其模板文件夹。安装 rust 后

cargo install itex
itex update

在 Linux 上安装

在 Linux 上的安装与在 Windows 上相同,因为没有包管理器在它们的列表上有 ITex。随着更多用户和支持,这可能会改变,但到目前为止

cargo install itex
itex update

ITex 构建系统

用户可以通过运行 itex build 来构建他们的 LaTex 项目。这样做需要 ITex 知道要编译哪个文件,这由 itex-build.toml 指定,其外观类似于以下内容

default_filename = "main"
tex_filename = "example.tex"

  • default_filename 指定任何文件的基本名称
  • tex_filename 指定主 tex 文件名。如果没有指定此选项,itex 将假设 default_filename + .tex。在本例中为 main.tex,如果未指定 tex_filename

创建新的模板

要创建一个新的模板,请创建一个文件夹,文件夹的名称即为模板名称,因为ITex就是使用这个名称。

还需要一个名为 itex-info.toml 的文件,包含名称和描述。

name = "Default"
description = "The default template."

开发

为了设置开发环境

  • 克隆仓库
  • 运行 cargo build 以安装依赖项

依赖项

~4–16MB
~206K SLoC