Skip to content

Commit

Permalink
20230927 Update .cls, add compile script.
Browse files Browse the repository at this point in the history
  • Loading branch information
lavandejoey committed Sep 27, 2023
1 parent df7eb92 commit f7e6e0d
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 32 deletions.
78 changes: 46 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,60 @@
# ECUST Thesis Latex
# [ECUST Thesis Latex](https://github.com/lavandejoey/ECUSTThesisLatex)

该仓库包含华东理工大学的论文Latex模板[`ecustthesis.cls`](src/ecustthesis.cls)及一个简单的使用样例[`ecustthesis.tex`](src/ecustthesis.tex),使用 xelatex/lualatex 环境编译。
[//]: # (The badges)
[![stars](https://img.shields.io/github/stars/lavandejoey/ECUSTThesisLatex)]()
[![license](https://img.shields.io/github/license/lavandejoey/ECUSTThesisLatex)](LICENSE)
[![Miktex](https://img.shields.io/badge/Miktex-2.9-blue)](https://miktex.org/download)
[![TexiFy](https://img.shields.io/badge/TexiFy-1.0.0-blue)](https://plugins.jetbrains.com/plugin/9473-texify-idea)

该仓库包含华东理工大学的论文Latex模板[`ecustthesis.cls`](src/ecustthesis.cls)
及一个简单的使用样例[`ecustthesis.tex`](src/ecustthesis.tex),使用 xelatex/lualatex 环境编译。

## 仓库结构

```tree
├── img/
│ └── ECUST-logo.png
├── src/
│ ├── code/
│ ├── sections/
│ ├── Acknowledgements.tex
│ ├── Appendix.tex
│ ├── ecustthesis.bib
│ ├── ecustthesis.cls
│ └── ecustthesis.tex
└── LICENSE
ECUSTThesisLatex/
├── img/
│ └── ECUST-logo.png
├── src/
│ ├── Acknowledgements.tex
│ ├── Appendix.tex
│ ├── code/
│ ├── ecustthesis.bib
│ ├── ecustthesis.cls
│ ├── ecustthesis.tex
│ └── sections/
│ ├── 0Abstract.tex
│ ├── 1Introduction.tex
│ ├── 2RelatedWork.tex
│ ├── 3Methodology.tex
│ ├── 4experiments.tex
│ └── 5Conclusion.tex
├── tex2pdf.sh
├── tex2pdf.bat
├── README.md
└── LICENSE
```

## 使用方法

### Linux (Ubuntu 22测试)

1. 安装[TeXLive](https://tug.org/texlive/acquire-netinstall.html)[MiKTeX](https://miktex.org/download)
2. 安装[TexStudio](https://www.texstudio.org/)[JetBrains TeXiFy插件](https://plugins.jetbrains.com/plugin/9473-texify-idea)或其他LaTeX编辑器
2. 安装[TexStudio](https://www.texstudio.org/)[JetBrains TeXiFy插件](https://plugins.jetbrains.com/plugin/9473-texify-idea)
或其他LaTeX编辑器
3. 在工作目录下clone仓库或下载并解压压缩包

```shell
git clone https://github.com/lavandejoey/ECUSTThesisLatex.git
```

```shell
git clone https://github.com/lavandejoey/ECUSTThesisLatex.git
```
5. 在ecustthesis.tex中编辑论文内容
6. 使用xelatex或lualatex编译ecustthesis.tex生成pdf

```shell
xelatex ecustthesis.tex
```

8. 使用biber编译文献bib文件

```shell
biber ecustthesis
```
6. 使用xelatex或lualatex编译ecustthesis.tex生成pdf(使用biber编译文献bib文件)
- 通过 JetBrain (PyCharm) / TexStudio 编译
- Linux:
```shell
sh tex2pdf.sh
```
- Windows 下点击运行`tex2pdf.bat`文件
7. 在out目录下查看生成的pdf文件 (`$THESIS_ROOT/out/ecustthesis.pdf`

## Todo

Expand All @@ -57,6 +70,7 @@ biber ecustthesis
## 更新记录

- [2023-09-13] 修复目录字体大小问题
- [2023-09-27] 新增Linux (Ubuntu 22测试)、Windows 编译脚本

## 贡献者

Expand Down
21 changes: 21 additions & 0 deletions src/ecustthesis.cls
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@
%! Author = lavandejoey
%! Date = 20/6/2023
%! 华东理工大学本科毕业论文模板
%MIT License
%
%Copyright (c) 2023 LAVANDEJOEY
%
%Permission is hereby granted, free of charge, to any person obtaining a copy
%of this software and associated documentation files (the "Software"), to deal
%in the Software without restriction, including without limitation the rights
%to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
%copies of the Software, and to permit persons to whom the Software is
%furnished to do so, subject to the following conditions:
%
%The above copyright notice and this permission notice shall be included in all
%copies or substantial portions of the Software.
%
%THE SOFTWARE IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
%IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
%FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
%AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
%LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
%SOFTWARE.
%========================================================单位换算========================================================
% 中文字号 英文字号(磅)/pt 毫米/mm 像素/px
% 初号 42.0 14.82 56
Expand Down
1 change: 1 addition & 0 deletions src/ecustthesis.tex
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
\addbibresource{ecustthesis.bib}%设置参考文献的路径

\title{华东理工大学本科毕业论文\LaTeX{}模板}
\author{小花梨}

% Document
\begin{document}
Expand Down
30 changes: 30 additions & 0 deletions tex2pdf.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@echo off
setlocal

:: Get the current directory and set THESIS_ROOT variable
for /f %%A in ('cd') do set "THESIS_ROOT=%%A"

:: Change to the src directory, exit with an error message if not found
cd "%THESIS_ROOT%\src" || (echo src not found & exit /b 1)

:: Compile the LaTeX document with xelatex
xelatex -file-line-error -interaction=nonstopmode -synctex=1 -output-directory="%THESIS_ROOT%\out" -aux-directory="%THESIS_ROOT%\auxil" ecustthesis.tex

:: Change to the auxil directory, exit with an error message if not found
cd "%THESIS_ROOT%\auxil" || (echo auxil not found & exit /b 1)

:: Run biber to process the bibliography
biber --input-directory="%THESIS_ROOT%\src" ecustthesis

:: Change back to the src directory
cd "%THESIS_ROOT%\src" || (echo src not found & exit /b 1)

:: Compile the LaTeX document again
xelatex -file-line-error -interaction=nonstopmode -synctex=1 -output-directory="%THESIS_ROOT%\out" -aux-directory="%THESIS_ROOT%\auxil" ecustthesis.tex
xelatex -file-line-error -interaction=nonstopmode -synctex=1 -output-directory="%THESIS_ROOT%\out" -aux-directory="%THESIS_ROOT%\auxil" ecustthesis.tex

:: Change back to the root directory
cd "%THESIS_ROOT%" || (echo root not found & exit /b 1)

:: End of the script
endlocal
34 changes: 34 additions & 0 deletions tex2pdf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
#MIT License
#
#Copyright (c) 2023 LAVANDEJOEY
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#copies of the Software, and to permit persons to whom the Software is
#furnished to do so, subject to the following conditions:
#
#The above copyright notice and this permission notice shall be included in all
#copies or substantial portions of the Software.
#
#THE SOFTWARE IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
#SOFTWARE.

THESIS_ROOT=`pwd`
cd $THESIS_ROOT/src || echo "src not found"
xelatex -file-line-error -interaction=nonstopmode -synctex=1 -output-directory=$THESIS_ROOT/out -aux-directory=$THESIS_ROOT/auxil ecustthesis.tex

cd $THESIS_ROOT/auxil || echo "auxil not found"
biber --input-directory=$THESIS_ROOT/src ecustthesis

cd $THESIS_ROOT/src || echo "src not found"
xelatex -file-line-error -interaction=nonstopmode -synctex=1 -output-directory=$THESIS_ROOT/out -aux-directory=$THESIS_ROOT/auxil ecustthesis.tex
xelatex -file-line-error -interaction=nonstopmode -synctex=1 -output-directory=$THESIS_ROOT/out -aux-directory=$THESIS_ROOT/auxil ecustthesis.tex
cd $THESIS_ROOT || echo "root not found"

0 comments on commit f7e6e0d

Please sign in to comment.