Files
2025-yatcpu/lab1/实验报告/makepdf.bat
2025-10-10 20:07:22 +08:00

35 lines
955 B
Batchfile
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.

@echo off
:: 解决中文乱码(将注释单独成行,避免紧跟命令)
chcp 65001 > nul
:: 启用延迟扩展(确保变量正确解析)
setlocal enabledelayedexpansion
:: 检查必要文件
if not exist "*.md" (
echo 错误:当前目录没有.md文件
pause
exit /b 1
)
if not exist "default-template.latex" (
echo 错误找不到default-template.latex
pause
exit /b 1
)
:: 转换当前目录下所有.md文件
for %%f in (*.md) do (
echo 开始转换:%%f
set "filename=%%~nf"
:: 移除 -V geometry解决选项冲突后面解释
pandoc "%%f" --template=default-template.latex --pdf-engine=xelatex --resource-path=. -o "!filename!.pdf"
if %errorlevel% equ 0 (
echo 转换成功:!filename!.pdf
) else (
echo 转换失败:%%f
)
echo ----------------------
)
endlocal
echo 所有文件处理完毕!
pause