Skip to content

Commit

Permalink
Merge branch 'dev/github-action'
Browse files Browse the repository at this point in the history
  • Loading branch information
JingWangTW committed Sep 9, 2021
2 parents e994a08 + 2e3302f commit 6020d3d
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 9 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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的同學:
Expand Down Expand Up @@ -85,6 +90,9 @@
```
* 由於陽明交大至今(Sep. 8, 2021)尚未決定校徽,故目前繳交之論文仍不需要附上浮水印,所以本模板沒有浮水印的功能。
* 學校僅針對封面與書名頁等非內文之內容有相關論文格式規範,有關內文之規範則由各研究系所訂定細則。由於本人為資科工碩畢業,所以基本上此Template應該是可以無痛通過資科工碩的系所審查,但是其餘科系真的不好說,QQ。

### 我不知道怎麼分類
* 有寫個GitHub Action啦,只要將專案Push Tag到GitHub就會觸發(Tag名稱須為`v*.*.*`),請GitHub幫你編譯並將編完的PDF發到Release。
## 資料夾結構

```bash
Expand Down
2 changes: 1 addition & 1 deletion WinMakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
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

0 comments on commit 6020d3d

Please sign in to comment.