-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
423 additions
and
68 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,180 @@ | ||
: 设置编码为utf-8,解决中文显示问题 | ||
chcp 65001 | ||
|
||
@echo off | ||
|
||
:: 设置标题 | ||
title %date% %time% makefile | ||
:: 基本设置 | ||
set File_Name=main | ||
set TeX_Name=xelatex | ||
set Bib_Name=bibtex | ||
|
||
:: 计算开始时间 | ||
set Start_Time=%time% | ||
:: ========================================================================================== | ||
echo ================================================================================ | ||
echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 清除辅助文件 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
echo ================================================================================ | ||
echo. | ||
echo. | ||
:: clear aux files | ||
del /q %File_Name%.pdf %File_Name%.synctex *.aux *.bbl *.blg *.log *.out *.toc *.bcf *.xml *.nlo *.nls *.bak *.ind *.idx *.ilg *.lof *.lot *.ent-x *.tmp *.ltx *.los *.lol *.loc *.listing *.gz *.synctex(busy) *.nav *.snm *.vrb *.fls *.xdv *.fdb_latexmk | ||
|
||
:: ========================================================================================== | ||
echo. | ||
echo. | ||
echo ================================================================================ | ||
echo XXXXXXXXXXXXXXXXXXXXXXXXXXXX 开始一次 %TeX_Name% 编译 XXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
echo ================================================================================ | ||
echo. | ||
echo. | ||
:: compile the tex file nonstopmode batchmode 批处理运行模式,无日志显示,利于提速 | ||
%TeX_Name%.exe -no-pdf -shell-escape -file-line-error -halt-on-error -interaction=batchmode --synctex=-1 %File_Name%.tex | ||
echo. | ||
echo. | ||
echo ================================================================================ | ||
echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 开始文献编译 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
echo ================================================================================ | ||
echo. | ||
echo. | ||
:: compile bibliography | ||
%Bib_Name% %File_Name% | ||
echo. | ||
echo. | ||
echo ================================================================================ | ||
echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 开始目录编译 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
echo ================================================================================ | ||
echo. | ||
echo. | ||
set Catalogs=没有插入任何索引 | ||
:: 编译目录和符号说明索引 | ||
:: 判断是否存在 .gls 文件,判断是否采用glossaries宏包生成符号说明表 | ||
if exist "%File_Name%.glo" ( | ||
:: 执行 makeindex 命令 | ||
makeindex -s %File_Name%.ist -o %File_Name%.gls %File_Name%.glo | ||
set Catalogs=采用glossaries宏包生成符号说明表 | ||
) else ( | ||
:: 判断是否存在 .nls 文件,判断是否采用nomencl宏包生成符号说明表 | ||
if exist "%File_Name%.nlo" ( | ||
:: 执行 makeindex 命令 | ||
makeindex -s nomencl.ist -o %File_Name%.nls %File_Name%.nlo | ||
set Catalogs=采用nomencl宏包生成符号说明表 | ||
) else ( | ||
:: 判断是否存在 .xdv 文件,判断是否需要生成索引 | ||
if exist "%File_Name%.xdv" ( | ||
:: 执行 makeindex 命令 | ||
makeindex %File_Name%.xdv | ||
set Catalogs=有目录但没符号说明表 | ||
) else ( | ||
:: 打印该文章没有插入任何索引 | ||
set Catalogs=没有插入任何索引 | ||
) | ||
) | ||
) | ||
echo. | ||
echo. | ||
echo ================================================================================ | ||
echo XXXXXXXXXXXXXXXXXXXXXXXXXXXX 开始二次 %TeX_Name% 编译 XXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
echo ================================================================================ | ||
echo. | ||
echo. | ||
:: compile the tex file batchmode nonstopmode | ||
%TeX_Name%.exe -no-pdf -shell-escape -file-line-error -halt-on-error -interaction=batchmode --synctex=-1 %File_Name%.tex | ||
echo. | ||
echo. | ||
echo ================================================================================ | ||
echo XXXXXXXXXXXXXXXXXXXXXXXXXXXX 开始三次 %TeX_Name% 编译 XXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
echo ================================================================================ | ||
echo. | ||
echo. | ||
:: compile the tex file nonstopmode batchmode: 不输出过程信息,提高速度 | ||
%TeX_Name%.exe -shell-escape -file-line-error -halt-on-error -interaction=batchmode --synctex=-1 %File_Name%.tex | ||
echo. | ||
echo. | ||
echo ================================================================================ | ||
echo ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 完成所有编译 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ | ||
echo ================================================================================ | ||
echo. | ||
echo. | ||
|
||
:: ========================================================================================== | ||
echo ================================================================================ | ||
echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 清除辅助文件 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
echo ================================================================================ | ||
echo. | ||
echo. | ||
:: call makeclear | ||
del /q *.aux *.bbl *.blg *.log *.out *.toc *.bcf *.xml *.nlo *.nls *.bak *.ind *.idx *.ilg *.lof *.lot *.ent-x *.tmp *.ltx *.los *.lol *.loc *.listing *.gz *.synctex(busy) *.nav *.snm *.vrb *.fls *.xdv *.fdb_latexmk | ||
|
||
:: ========================================================================================== | ||
echo ================================================================================ | ||
echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 清除已有结果文件 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
echo ================================================================================ | ||
:: 处理上次生成的结果文件 | ||
set Build_Path="./build/" | ||
:: 检查是否存在./Build/文件夹 | ||
if exist %Build_Path% ( | ||
:: 存在./Build/文件夹,则删除 | ||
rd /s /q %Build_Path% | ||
echo 删除上次生成的结果文件 | ||
mkdir %Build_Path% | ||
echo 创建 Build 文件夹 | ||
) else ( | ||
:: 不存在./Build/文件夹,则创建 | ||
mkdir %Build_Path% | ||
echo 创建 Build 文件夹 | ||
) | ||
echo. | ||
echo. | ||
:: ========================================================================================== | ||
echo ================================================================================ | ||
echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 移动生成文件 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
echo ================================================================================ | ||
:: 移动结果文件到指定文件夹 | ||
if exist "%File_Name%.pdf" ( | ||
move "%File_Name%.pdf" %Build_Path% | ||
move "%File_Name%.synctex" %Build_Path% | ||
echo 移动生成文件到 Build 文件夹中 | ||
) else ( | ||
echo 未检索到生成的pdf文件 | ||
) | ||
echo. | ||
echo. | ||
echo ================================================================================ | ||
echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 目录生成情况 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
echo ================================================================================ | ||
echo %Catalogs% | ||
echo. | ||
echo. | ||
:: ========================================================================================== | ||
echo ================================================================================ | ||
echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 统计编译时长 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
echo ================================================================================ | ||
:: 计算结束时间 | ||
set End_Time=%time% | ||
:: 格式化时间 | ||
set options="tokens=1-4 delims=:.," | ||
for /f %options% %%a in ("%Start_time%") do set start_h=%%a&set /a start_m=100%%b %% 100&set /a start_s=100%%c %% 100&set /a start_ms=100%%d %% 100 | ||
for /f %options% %%a in ("%End_time%") do set end_h=%%a&set /a end_m=100%%b %% 100&set /a end_s=100%%c %% 100&set /a end_ms=100%%d %% 100 | ||
set /a hours=%end_h%-%start_h% | ||
set /a mins=%end_m%-%start_m% | ||
set /a secs=%end_s%-%start_s% | ||
set /a ms=%end_ms%-%start_ms% | ||
if %ms% lss 0 set /a secs = %secs% - 1 & set /a ms = 100%ms% | ||
if %secs% lss 0 set /a mins = %mins% - 1 & set /a secs = 60%secs% | ||
if %mins% lss 0 set /a hours = %hours% - 1 & set /a mins = 60%mins% | ||
if %hours% lss 0 set /a hours = 24%hours% | ||
if 1%ms% lss 100 set ms=0%ms% | ||
:: 计算时间并输出 | ||
set /a totalsecs = %hours%*3600 + %mins%*60 + %secs% | ||
echo 编译时长为:%hours% 小时 %mins% 分 %secs% 秒 %ms% 毫秒 (%totalsecs%.%ms%s total) | ||
echo. | ||
|
||
:: 结束 | ||
echo ================================================================================ | ||
echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXX 查看生成文件 XXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
echo ================================================================================ | ||
echo 请在 "%Build_Path%" 文件夹中查看编译后的文件。 | ||
pause | ||
exit /b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
|
||
#!/bin/bash | ||
|
||
# 基本设置 | ||
File_Name="main" | ||
TeX_Name="xelatex" | ||
Bib_Name="biber" | ||
|
||
# 计算开始时间 | ||
Start_Time=$(date +"%s") | ||
#========================================================================== | ||
echo "" | ||
echo "" | ||
echo ================================================================================ | ||
echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 清除辅助文件 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
echo ================================================================================ | ||
echo "" | ||
echo "" | ||
# 清除辅助文件 | ||
rm -r $File_Name.pdf $File_Name.synctex *.aux *.bbl *.blg *.log *.out *.toc *.bcf *.xml *.synctex *.nlo *.nls *.bak *.ind *.idx *.ilg *.lof *.lot *.ent-x *.tmp *.ltx *.los *.lol *.loc *.listing *.gz *.userbak *.nav *.snm *.vrb *.fls *.xdv *.fdb_latexmk | ||
|
||
#========================================================================== | ||
echo "" | ||
echo "" | ||
echo ================================================================================ | ||
echo XXXXXXXXXXXXXXXXXXXXXXXXXXXX 开始一次 $TeX_Name 编译 XXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
echo ================================================================================ | ||
echo "" | ||
echo "" | ||
# 编译 Tex 文件 nonstopmode batchmode 批处理运行模式,无日志显示,利于提速 | ||
$TeX_Name -no-pdf -shell-escape -file-line-error -halt-on-error -interaction=batchmode --synctex=-1 $File_Name.tex | ||
|
||
echo "" | ||
echo "" | ||
echo ================================================================================ | ||
echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 开始文献编译 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
echo ================================================================================ | ||
echo "" | ||
echo "" | ||
# 编译参考文献 | ||
$Bib_Name $File_Name | ||
echo "" | ||
echo "" | ||
echo ================================================================================ | ||
echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 开始目录编译 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
echo ================================================================================ | ||
echo "" | ||
echo "" | ||
Catalogs="没有插入任何索引" | ||
# 编译目录和符号说明索引 | ||
# 判断是否存在 .gls 文件,判断是否采用 glossaries 宏包生成符号说明表 | ||
if [[ -f "$File_Name.glo" ]]; then | ||
# 执行 makeindex 命令 | ||
makeindex -s $File_Name.ist -o $File_Name.gls $File_Name.glo | ||
Catalogs="采用 glossaries 宏包生成符号说明表" | ||
# 判断是否存在 .nls 文件,判断是否采用 nomencl 宏包生成符号说明表 | ||
elif [[ -f "$File_Name.nlo" ]]; then | ||
# 执行 makeindex 命令 | ||
makeindex -s nomencl.ist -o $File_Name.nls $File_Name.nlo | ||
Catalogs="采用 nomencl 宏包生成符号说明表" | ||
# 判断是否存在 .idx 文件,判断是否需要生成索引 | ||
elif [[ -f "$File_Name.xdv" ]]; then | ||
# 执行 makeindex 命令 | ||
makeindex "$File_Name.xdv" | ||
Catalogs="有目录 没符号说明表" | ||
else | ||
# 打印该文章没有插入任何索引 | ||
Catalogs="没有插入任何索引" | ||
fi | ||
|
||
echo "" | ||
echo "" | ||
echo ================================================================================ | ||
echo XXXXXXXXXXXXXXXXXXXXXXXXXXXX 开始二次 $TeX_Name 编译 XXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
echo ================================================================================ | ||
echo "" | ||
echo "" | ||
# 编译 Tex 文件 | ||
$TeX_Name -no-pdf -shell-escape -file-line-error -halt-on-error -interaction=batchmode --synctex=-1 $File_Name.tex | ||
|
||
echo "" | ||
echo "" | ||
echo ================================================================================ | ||
echo XXXXXXXXXXXXXXXXXXXXXXXXXXXX 开始三次 $TeX_Name 编译 XXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
echo ================================================================================ | ||
echo "" | ||
echo "" | ||
# 编译 Tex 文件 | ||
$TeX_Name -shell-escape -file-line-error -halt-on-error -interaction=batchmode --synctex=-1 $File_Name.tex | ||
|
||
echo "" | ||
echo "" | ||
echo ================================================================================ | ||
echo ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 完成所有编译 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ | ||
echo ================================================================================ | ||
echo "" | ||
echo "" | ||
|
||
#========================================================================== | ||
|
||
echo "" | ||
echo "" | ||
echo ================================================================================ | ||
echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 清除辅助文件 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
echo ================================================================================ | ||
echo "" | ||
echo "" | ||
# 清除辅助文件 | ||
rm -r *.aux *.bbl *.blg *.log *.out *.toc *.bcf *.xml *.nlo *.nls *.bak *.ind *.idx *.ilg *.lof *.lot *.ent-x *.tmp *.ltx *.los *.lol *.loc *.listing *.gz *.userbak *.nav *.snm *.vrb *.fls *.xdv *.fdb_latexmk | ||
|
||
#========================================================================== | ||
|
||
echo "" | ||
echo "" | ||
echo ================================================================================ | ||
echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 清除已有结果文件 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
echo ================================================================================ | ||
# 处理上次生成的结果文件 | ||
Build_Path="./Build/" | ||
# 检查是否存在 ./Build/ 文件夹 | ||
if [[ -d "$Build_Path" ]]; then | ||
# 存在 ./Build/ 文件夹,则删除 | ||
rm -rf "$Build_Path" | ||
echo "删除上次生成的结果文件" | ||
mkdir $Build_Path | ||
echo "创建 Build 文件夹" | ||
else | ||
# 不存在 ./Build/ 文件夹,则创建 | ||
mkdir $Build_Path | ||
echo "创建 Build 文件夹" | ||
fi | ||
echo "" | ||
echo "" | ||
#========================================================================== | ||
echo ================================================================================ | ||
echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 移动生成文件 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
echo ================================================================================ | ||
# 移动结果文件到指定文件夹 | ||
if [[ -f "$File_Name.pdf" ]]; then | ||
mv "$File_Name.pdf" $Build_Path | ||
mv "$File_Name.synctex" $Build_Path | ||
echo "移动结果文件到 Build 文件夹中" | ||
else | ||
echo "未生成结果文件" | ||
fi | ||
echo "" | ||
echo "" | ||
echo ================================================================================ | ||
echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 目录生成情况 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
echo ================================================================================ | ||
echo $Catalogs | ||
echo "" | ||
echo "" | ||
#========================================================================== | ||
echo ================================================================================ | ||
echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 统计编译时长 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
echo ================================================================================ | ||
# 计算结束时间 | ||
End_Time=$(date +"%s") | ||
# 计算运行时长 | ||
Run_Time=$(($End_Time - $Start_Time)) | ||
Hours=$((Run_Time / 3600)) | ||
Minutes=$(((Run_Time % 3600)/60)) | ||
Seconds=$((Run_Time % 60)) | ||
|
||
echo "编译时长为:$Hours 小时 $Minutes 分 $Seconds 秒 (($Run_Time)s total)" | ||
echo "" | ||
|
||
# 延时关闭 5s | ||
# sleep 5 |
Oops, something went wrong.