Files
ouc_latex_template/.gitattributes
T
laoyang ef1bc72603 加入 WSL 编译取回脚本与换行符策略 #18
build.sh      在 WSL 内编译(默认 xelatex),成功后用 scp 把 PDF 取回
              Windows 侧同路径。支持单模板与 all 全库。路径全部走环境
              变量覆盖,默认值可用,不硬编码某个人的目录。

verify_all.sh 批量编译验证全库主文件,打印 error / Overfull / Underfull
              与页数。每个模板都在自己目录下编译 —— 模板的 .sty 与
              ../fonts/ 是相对编译工作目录解析的,从仓库根调用找不到字体。

.gitattributes 把所有 .sh 钉成 eol=lf。Windows 侧 core.autocrlf=true 会把
              脚本存成 CRLF,到 Linux 上执行就报
                  /bin/bash^M: bad interpreter: No such file or directory
              这个错误容易误判成"没装 bash",所以在仓库层面固定规则,
              不依赖各人本机的 autocrlf 设置。.tex/.sty/.cls 同样钉 lf,
              避免中文注释行尾残留 CR 被 XeTeX 当字符排出来。

关于脚本为什么要写成「编译-取回」而不是纯编译:
WSL2 会按空闲把整个虚拟机 poweroff,届时 xelatex 连同 PID 1 一起消失,
/tmp 也一并清空(后台日志丢失)。脚本的 ssh 会话在编译期间保持不断,
顺带起了保活作用,所以不要把它改成后台运行。
2026-10-29 12:01:06 +08:00

36 lines
1.2 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 换行符策略
#
# 背景:这个仓库同时在 Windows(TeX Live 2022)和 WSL/Linux(TeX Live 2025)
# 上使用。Windows 侧 core.autocrlf=true 会把文本文件存成 CRLF,
# 而 shell 脚本一旦是 CRLF,在 Linux 上执行会报
# bash: ./build.sh: /bin/bash^M: bad interpreter: No such file or directory
# 这个报错不直观(看起来像"没有 bash",实际是行尾多了回车),
# 所以在仓库层面把规则固定下来,不依赖每个人本机的 autocrlf 设置。
# 所有 .sh 一律 LF,Windows 侧检出也不转换
*.sh text eol=lf
# TeX 源码与样式:LaTeX 对 CRLF 容忍度好,但 eol=lf 能避免
# 中文注释在行尾残留 CR 被 XeTeX 当成字符排出来
*.tex text eol=lf
*.sty text eol=lf
*.cls text eol=lf
*.bib text eol=lf
# 配置文件
*.gitignore text eol=lf
.gitignore text eol=lf
.gitattributes text eol=lf
*.md text eol=lf
# 二进制:不参与换行符转换与文本 diff
*.pdf binary
*.otf binary
*.ttf binary
*.ttc binary
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.zip binary