From 1604846d094a2a8e2d7bb45dacf9834d5d2e4a2d Mon Sep 17 00:00:00 2001 From: xphi Date: Sun, 28 Feb 2021 23:44:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0Linux=E4=B8=8EMac=E4=B8=8B?= =?UTF-8?q?=E7=9A=84=E7=BC=96=E8=AF=91=E8=84=9A=E6=9C=AC=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0Overleaf=E4=BD=BF=E7=94=A8=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Readme.md | 23 +++++++++------ compile.bat | 80 +++++++---------------------------------------------- compile.sh | 12 ++++++++ 3 files changed, 36 insertions(+), 79 deletions(-) create mode 100755 compile.sh diff --git a/Readme.md b/Readme.md index 6547d85..2d5ae91 100644 --- a/Readme.md +++ b/Readme.md @@ -11,11 +11,11 @@ 项目根目录下的目录功能如下: -* book:实验指导书主文件 * data:实验指导书分章节内容 -* code:参考代码 +* config:实验指导书格式配置文件 * figure:用到的图片 -* bib:参考文献 + +* code:参考代码 ## 3. 编译 @@ -29,16 +29,21 @@ pip install Pygments 1. Windows 环境下,推荐使用最新版TeX Live套件,然后在工程目录下运行以下命令编译: ``` shell - cd book compile.bat ``` -2. MacOS 环境下,推荐使用MacTex套件,然后编译。 +2. MacOS 环境下,推荐使用MacTex套件,然后在工程目录下运行以下命令编译: + + ``` shell + ./compile.sh + ``` -3. Linux 环境下,推荐使用最新版TeX Live套件,然后编译。 +3. Linux 环境下,推荐使用最新版TeX Live套件,然后在工程目录下运行以下命令编译: -由于实验指导书较长,从头开始进行一次编译需要几分钟时间,请耐心等待。 + ``` shell + ./compile.sh + ``` -## 4. 说明 +4. 本文档支持在Overleaf在线编辑环境中编辑,编译前需要将Compiler配置为XeLaTex。 -项目主要结构参考了“Q-book LaTeX书籍模板”的早期版本。 +由于实验指导书较长,从头开始进行一次编译需要几分钟时间,请耐心等待。 diff --git a/compile.bat b/compile.bat index 0e53ac7..778e1b5 100644 --- a/compile.bat +++ b/compile.bat @@ -1,71 +1,11 @@ @echo off -chcp 65001 >nul - -set flag=%1 -if %flag%x == x ( - set flag=instr -) - -if %flag%x == instrx ( - call :cleanall - call :instr - if ERRORLEVEL 1 ( - echo Error! Please check the 'instructions.log' for more details... - pause - ) else ( - call :clean - echo Finished! - ) - goto :EOF -) - -if %flag%x == cleanx ( - call :clean - goto :EOF -) - -if %flag%x == cleanallx ( - call :cleanall - goto :EOF -) - -:help - echo This is the compile batch script for CNAP Instructions. - echo Usage: - echo make.bat [option] - echo options: - echo instr Compile the instructions book (default) - echo clean Clean all work files - echo cleanall Clean all work files and generated pdf - echo help Print this help message -goto :EOF - -:instr - echo Compile... - latexmk -xelatex -shell-escape --halt-on-error -silent instructions >nul 2>nul -goto :EOF - -:clean - echo Clean files... - latexmk -c -silent 2>nul - del instructions.bbl >nul 2>nul - del instructions.listing >nul 2>nul - del instructions.xdv >nul 2>nul - del instructions.run.xml >nul 2>nul - rmdir /S /Q _minted-instructions >nul 2>nul -goto :EOF - -:cleanall - echo Clean files... - latexmk -C -silent 2>nul - del instructions.bbl >nul 2>nul - del instructions.listing >nul 2>nul - del instructions.xdv >nul 2>nul - del instructions.run.xml >nul 2>nul - rmdir /S /Q _minted-instructions >nul 2>nul - if exist instructions.pdf ( - echo Close the file: instructions.pdf! - pause - call :cleanall - ) -goto :EOF +echo Compiling... +latexmk -xelatex -shell-escape --halt-on-error -silent instructions >nul 2>nul +echo Done! + +echo Clean files... +latexmk -c -silent 2>nul +del instructions.listing >nul 2>nul +del instructions.xdv >nul 2>nul +rmdir /S /Q _minted-instructions >nul 2>nul +echo Done! diff --git a/compile.sh b/compile.sh new file mode 100755 index 0000000..317bdda --- /dev/null +++ b/compile.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +echo Compiling... +latexmk -xelatex -shell-escape --halt-on-error -silent instructions > /dev/null 2>&1 +echo Done! + +echo Clean files... +latexmk -c -silent > /dev/null 2>&1 +rm instructions.listing > /dev/null 2>&1 +rm instructions.xdv > /dev/null 2>&1 +rm -r _minted-instructions > /dev/null 2>&1 +echo Done!