规范一些用法

1. 注意.gitignore 要把 build 文件夹加进来
2. 类似 `\LaTeX{} ` 的 hologo 替换为 `\LaTeX\ `
3. lua 中, 由于使用了 `latexmk`, 则需要设置 `typesetruns` 为 1, 否则默认他给你跑三遍, 浪费时间; `l3build` 官方提供了 specialtypesetting 用户接口, 无需用 `string.match` 这种内部命令; description 等不要断行, 否则 CTAN 收到的也是断行版, 虽然他们会人工干预阻止这一行为.
This commit is contained in:
myhsia
2026-02-28 15:47:02 +08:00
parent e8777c67dd
commit c536351538
4 changed files with 57 additions and 59 deletions

View File

@@ -1,5 +1,5 @@
--[==========================================[--
L3BUILD FILE FOR ELEGANTBOOK
L3BUILD FILE FOR ELEGANTBOOK
Check PDF File & Directory After Build
--]==========================================]--
@@ -17,11 +17,7 @@ repository = "https://github.com/" .. maintainid .. "/" .. module
announcement = ""
note = ""
summary = "Elegant LaTeX Template for Books"
description = [[
ElegantBook is designed for writing Books. This template is based on
the standard LaTeX book class. The goal of this template is
to make the writing process more elegant.
]]
description = [[ElegantBook is designed for writing Books. This template is based on the standard LaTeX book class. The goal of this template is to make the writing process more elegant.]]
--[==========================================[--
Build, Pack and Upload To CTAN
@@ -30,10 +26,15 @@ to make the writing process more elegant.
ctanzip = module
excludefiles = {"*~"}
textfiles = {"*.md", "LICENSE", "*.lua", "*.cls", "*.bib"}
typesetexe = "latexmk -pdf"
typesetfiles = {module .. "-cn.tex", module .. "-en.tex"}
typesetopts = "-interaction=nonstopmode"
typesetsuppfiles = {"*.cls", "*.bib"}
typesetruns = 1
imagesuppdir = "image"
figuresuppdir = "figure"
specialtypesetting = specialtypesetting or {}
specialtypesetting[module .. "-cn.tex"] = {cmd = "latexmk -xelatex"}
uploadconfig = {
pkg = module,
@@ -55,16 +56,10 @@ uploadconfig = {
update = true
}
-- cn uses XeLaTeX, en uses pdfLaTeX
function typeset(file, dir, exe)
dir = dir or typesetdir
local cmd
if string.match(file, "%-cn%.tex$") then
cmd = "latexmk -pdfxe -interaction=nonstopmode "
else
cmd = "latexmk -pdf -interaction=nonstopmode "
end
return run(dir, cmd .. file)
function tex(file, dir, cmd)
dir = dir or "."
cmd = cmd or typesetexe .. " " .. typesetopts
return run(dir, cmd .. " " .. file)
end
-- Copy required files into the typeset build dir