diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml new file mode 100644 index 0000000..ec33895 --- /dev/null +++ b/.github/workflows/compile.yml @@ -0,0 +1,61 @@ +# The name of this action +name: Compile Project to PDF + +# Controls when the workflow will run +on: + # Triggers the workflow on push to any tags + push: + tags: + - "v*.*.*" + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + + Compile: + + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + + # This action checks-out your repository under $GITHUB_WORKSPACE, so your workflow can access it. + - name: Set up Git Repository + uses: actions/checkout@v2 + + # This action is to modify Chinese font name declared in the config + # 1. Downliad the font file online. + # 2. Add the required package to include ttf file directly. + # 3. Modify the font name declared in the config. + - name: Modify Chinese Font + run: | + wget -O cwTeXKai.ttf https://fonts.gstatic.com/ea/cwtexkai/v3/cwTeXKai-zhonly.ttf + echo -e "\n\\usepackage{fontspec}" >> Config/fonts.tex + sed -i 's/標楷體/\[cwTexKai.ttf\]/1' Config/fonts.tex && cat Config/fonts.tex + + # This action is to install English font + # 1. Accept the EULA that will pop-up during installation + # 2. Install the font package + # 3. Copy font file to local directory + # 4. Modify the font name declared in the config. + - name: Modify English Font + run: | + echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections + sudo apt-get install ttf-mscorefonts-installer + cp /usr/share/fonts/truetype/msttcorefonts/times.ttf . + sed -i 's/Times New Roman/\[times.ttf\]/1' Config/fonts.tex && cat Config/fonts.tex + + # This action is to compile LaTeX documents + - name: Compile LaTeX Documents + uses: xu-cheng/latex-action@v2 + with: + root_file: main.tex + # compile with xelatex + latexmk_use_xelatex: true + + # This action is to create GitHub Releases + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: | + main.pdf \ No newline at end of file diff --git a/Makefile b/Makefile index c483f71..7492dc4 100644 --- a/Makefile +++ b/Makefile @@ -10,4 +10,4 @@ run: $(LATEX_BUILD_TOOL) $(TEX_ARGS) $(ROOT_FILE).tex clean: - rm -f *.aux *.bbl *.blg *.bcf *.idx *.ind *.lof *.lot *.out *.toc *.acn *.acr *.alg *.glg *.glo *.gls *.ist *.fls *.log *.run.xml *.fdb_latexmk *.synctex.g \ No newline at end of file + rm -f *.aux *.bbl *.blg *.bcf *.idx *.ind *.lof *.lot *.out *.toc *.acn *.acr *.alg *.glg *.glo *.gls *.ist *.fls *.log *.run.xml *.fdb_latexmk *.synctex.gz *.xdv \ No newline at end of file diff --git a/README.md b/README.md index 8ab7a64..4c7e57d 100644 --- a/README.md +++ b/README.md @@ -10,13 +10,18 @@ 1. 總結:TeX檔案需使用`xelatex`編譯,Bib的部分則需使用`biber`編譯。 > * 那個比較潮用`pdflatex`搭配對utf-8支援的使用方法,我怎麼用就是不成功啦,QQ。所以中文是使用`xeCJK`套件完成的,所以需要使用`xelatex`才可以編。 > * 阿那個Bib好像大部分的人都是用`bibtex`編的,但是他不會自動對URL出現`visited on`字樣,我不是很開心,所以我就改用`biblatex`搭配`biber`編譯了,然後我覺得很棒。 -2. 編譯順序:`xelatex` -> `biber` -> `xelatex` -> `xelatex` - ```bash - xelatex main.tex - biber main - xelatex main.tex - xelatex main.tex - ``` +2. 編譯順序: + 1. 方法一:`xelatex` -> `biber` -> `xelatex` -> `xelatex`(我自己的編法) + ```bash + xelatex main.tex + biber main + xelatex main.tex + xelatex main.tex + ``` + 2. 方法二:用很潮的`latexmk`就好了(我試過可以用的編法) + ```bash + latexmk -xelatex main.tex + ``` 3. 我有準備makefile,所以 ```bash ## 一般Linux的同學: @@ -85,6 +90,9 @@ ``` * 由於陽明交大至今(Sep. 8, 2021)尚未決定校徽,故目前繳交之論文仍不需要附上浮水印,所以本模板沒有浮水印的功能。 * 學校僅針對封面與書名頁等非內文之內容有相關論文格式規範,有關內文之規範則由各研究系所訂定細則。由於本人為資科工碩畢業,所以基本上此Template應該是可以無痛通過資科工碩的系所審查,但是其餘科系真的不好說,QQ。 + +### 我不知道怎麼分類 +* 有寫個GitHub Action啦,只要將專案Push Tag到GitHub就會觸發(Tag名稱須為`v*.*.*`),請GitHub幫你編譯並將編完的PDF發到Release。 ## 資料夾結構 ```bash diff --git a/WinMakefile b/WinMakefile index 8c7d7e2..24282d2 100644 --- a/WinMakefile +++ b/WinMakefile @@ -10,4 +10,4 @@ run: $(LATEX_BUILD_TOOL) $(TEX_ARGS) $(ROOT_FILE).tex clean: - DEL /Q *.aux *.bbl *.blg *.bcf *.idx *.ind *.lof *.lot *.out *.toc *.acn *.acr *.alg *.glg *.glo *.gls *.ist *.fls *.log *.run.xml *.fdb_latexmk *.synctex.gz 2> nul \ No newline at end of file + DEL /Q *.aux *.bbl *.blg *.bcf *.idx *.ind *.lof *.lot *.out *.toc *.acn *.acr *.alg *.glg *.glo *.gls *.ist *.fls *.log *.run.xml *.fdb_latexmk *.synctex.gz *.xdv 2> nul \ No newline at end of file