Skip to content

Commit

Permalink
Clean up repository [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexaraWu committed Jun 23, 2019
1 parent 3d9ccf4 commit 9a71ccd
Show file tree
Hide file tree
Showing 56 changed files with 421 additions and 1,707 deletions.
12 changes: 11 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,14 @@
*.bat eol=crlf

# Ignore binary or vendored files
*.pl linguist-vendored
*.jpg binary
*.pdf binary
*.png binary

# Excluding files and folders from export
/.ci export-ignore
/.github export-ignore
.appveyor.yml export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.travis.yml export-ignore
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -250,5 +250,10 @@ ehthumbs_vista.db
[Dd]esktop.ini

# Project specific
release/*
*.cls
*.ins
*.ltx
sjtuthesis.pdf
thesis.pdf
thesis-bot.yml
74 changes: 18 additions & 56 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,67 +1,29 @@
# Makefile for SJTUThesis

# Basename of thesis
THESIS = thesis
PACKAGE = sjtuthesis
CLSFILES = $(PACKAGE).cls $(PACKAGE)-bachelor.ltx $(PACKAGE)-graduate.ltx

# Option for latexmk
LATEXMK_OPT = -xelatex -silent -file-line-error -halt-on-error -interaction=nonstopmode
LATEXMK_OPT_PVC = $(LATEXMK_OPT_BASE) -pvc

# make deletion work on Windows
ifdef SystemRoot
RM = del /Q
OPEN = start
else
RM = rm -f
OPEN = open
endif

.PHONY : all cls doc pvc validate view viewdoc wordcount cleana cleanall FORCE_MAKE

all : $(THESIS).pdf

cls : $(CLSFILES)

$(CLSFILES) : $(PACKAGE).dtx
xetex --interaction=batchmode $<

doc : $(PACKAGE).pdf

$(PACKAGE).pdf : $(PACKAGE).dtx FORCE_MAKE
latexmk $(LATEXMKOPTS) $<

$(THESIS).pdf : $(THESIS).tex $(CLSFILES) FORCE_MAKE
latexmk $(LATEXMKOPTS) $<
SOURCE_DIR = source
LOGO_DIR = logos
RELEASE_DIR = release
SAMPLE_DIR = sample
THESIS = thesis

pvc : $(THESIS).tex $(CLSFILES)
latexmk $(LATEXMK_OPT_PVC) $(THESIS)
SOURCE = $(SOURCE_DIR)/$(PACKAGE).dtx
SCRIPTS = $(SOURCE_DIR)/latexmkrc $(SOURCE_DIR)/sample.bat $(SOURCE_DIR)/sample.mak
LOGOS = $(LOGO_DIR)/sjtu-badge.pdf $(LOGO_DIR)/sjtu-logo.pdf $(LOGO_DIR)/sjtu-name.pdf

validate : $(THESIS).tex $(CLSFILES)
xelatex -no-pdf -halt-on-error $(THESIS)
biber --debug $(THESIS)
VERSION = $(shell git describe --tags)
TEXMF = $(shell kpsewhich --var-value TEXMFHOME)

view : $(THESIS).pdf
$(OPEN) $<
TDS_ARCHIVE = $(RELEASE_DIR)/$(PACKAGE).tds.zip
PACK = scripts/pack.sh

viewdoc : $(PACKAGE).pdf
$(OPEN) $<
.PHONY : all install

wordcount : $(THESIS).tex
@if grep -v ^% $< | grep -qz '\\documentclass\[[^\[]*english'; then \
texcount $< -inc -char-only | awk '/total/ {getline; print "英文字符数\t\t\t:",$$4}'; \
else \
texcount $< -inc -ch-only | awk '/total/ {getline; print "纯中文字数\t\t\t:",$$4}'; \
fi
@texcount $< -inc -chinese | awk '/total/ {getline; print "总字数(英文单词 + 中文字)\t:",$$4}'
all : $(TDS_ARCHIVE)

clean :
-@latexmk -c -silent $(THESIS).tex 2> /dev/null
-@latexmk -c -silent $(PACKAGE).dtx 2> /dev/null
-@rm -f $(TEX_DIR)/*.aux 2> /dev/null || true
$(TDS_ARCHIVE) : $(PACK) $(SOURCE) $(SCRIPTS) $(LOGOS)
@$(PACK) $(SOURCE_DIR) $(LOGO_DIR) $(SAMPLE_DIR) $(RELEASE_DIR) $(VERSION)

cleanall :
-@latexmk -C -silent $(THESIS).tex 2> /dev/null
-@latexmk -C -silent $(PACKAGE).dtx 2> /dev/null
-@rm -f $(TEX_DIR)/*.aux 2> /dev/null || true
install : $(TDS_ARCHIVE)
unzip -o -q $(TDS_ARCHIVE) -d $(TEXMF)/
9 changes: 1 addition & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,7 @@
[![GitHub Release Date](https://img.shields.io/github/release-date/sjtug/SJTUThesis.svg)](https://github.com/sjtug/SJTUThesis/releases)
[![Join the chat at https://gitter.im/sjtug/SJTUThesis](https://badges.gitter.im/sjtug/SJTUThesis.svg)](https://gitter.im/sjtug/SJTUThesis?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

这是为撰写上海交通大学学士、硕士、博士学位论文或课程论文而准备的 XeLaTeX 模板,非官方出品。使用文档参见 [sjtuthesis.pdf](./docs/sjtuthesis.pdf),详细使用说明参见 [SJTUThesis Wiki](https://github.com/sjtug/SJTUThesis/wiki)

## 封面展示

<div align="center">
<a href="./docs/bachelor.pdf"><img src="./docs/images/bachelor.png" height="300"></a>
<a href="./docs/master.pdf"><img src="./docs/images/master.png" height="300"></a>
</div>
这是为撰写上海交通大学学士、硕士、博士学位论文或课程论文而准备的 XeLaTeX 模板,非官方出品。详细使用说明参见 [SJTUThesis Wiki](https://github.com/sjtug/SJTUThesis/wiki)

## 如何使用

Expand Down
2 changes: 1 addition & 1 deletion README_en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

SJTUThesis is an *unofficial* XeLaTeX template for preparing bachelor, master, or doctor thesis in Shanghai Jiao Tong University.

The generated thesis example PDF file can be found at `README.pdf` (this file has been removed, see sjtug/SJTUThesis/#26 contributing PDF into repo will increase the repo size) . The user guide will be found at [SJTUThesis Wiki](https://github.com/sjtug/SJTUThesis/wiki),welcome for contribution。
The user guide will be found at [SJTUThesis Wiki](https://github.com/sjtug/SJTUThesis/wiki),welcome for contribution。

## User Guide

Expand Down
Binary file removed docs/bachelor.pdf
Binary file not shown.
Binary file removed docs/images/bachelor.png
Binary file not shown.
Binary file removed docs/images/master.png
Binary file not shown.
Binary file removed docs/master.pdf
Binary file not shown.
Binary file removed docs/sjtuthesis.pdf
Binary file not shown.
File renamed without changes.
File renamed without changes.
Binary file added logos/resources/sjtu-logo-red.pdf
Binary file not shown.
File renamed without changes.
1 change: 1 addition & 0 deletions logos/sjtu-badge.pdf
1 change: 1 addition & 0 deletions logos/sjtu-logo.pdf
1 change: 1 addition & 0 deletions logos/sjtu-name.pdf
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions tex/example.tex → sample/tex/example.tex
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ \subsection{支持的图片格式}
{\includegraphics[height=2.5cm]{example/sjtulogo.eps}}
\hspace{4em}
\subcaptionbox{PDF 图像,注意这个图略矮些。如果标题很长的话,它会自动换行\label{fig:epspdf:b}}
{\includegraphics[height=2cm]{sjtulogo.pdf}}
{\includegraphics[height=2cm]{example/sjtulogo.eps}}
\bicaption{插入eps和pdf的例子(使用 subcaptionbox 方式)}{An EPS and PDF demo with subcaptionbox}
\label{fig:pdfeps-subcaptionbox}
\end{figure}
Expand All @@ -213,7 +213,7 @@ \subsection{支持的图片格式}
\hspace{4em}
\begin{subfigure}{0.4\textwidth}
\centering
\includegraphics[height=2cm]{sjtulogo.pdf}
\includegraphics[height=2cm]{example/sjtulogo.eps}
\caption{PDF 图像,注意这个图略矮些。subfigure中同一行的子图在顶端对齐。}
\end{subfigure}
\bicaption{插入eps和pdf的例子(使用 subfigure 方式)}{An EPS and PDF demo with subfigure}
Expand All @@ -230,7 +230,7 @@ \subsection{长标题的换行}

\begin{figure}[!htp]
\centering
\includegraphics[width=4cm]{sjtubadge.pdf}
\includegraphics[width=4cm]{example/sjtulogo.eps}
\bicaption[这里将出现在插图索引]
{上海交通大学是我国历史最悠久的高等学府之一,是教育部直属、教育部与上海市共建的全国重点大学.}
{Where there is a will, there is a way.}
Expand All @@ -241,7 +241,7 @@ \subsection{长标题的换行}
\centering
\begin{minipage}[b]{0.6\textwidth}
\centering
\includegraphics[width=4cm]{sjtubadge.pdf}
\includegraphics[width=4cm]{example/sjtulogo.eps}
\bicaption[出现在插图索引中]
{上海交通大学是我国历史最悠久的高等学府之一,是教育部直属、教育部与上海市共建的全国重点大学.}
{Where there is a will, there is a way.}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion thesis.tex → sample/thesis.tex
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

% 无编号内容:中英文论文封面、授权页
\maketitle
\makeDeclareOriginality[pdf/original.pdf]
\makeDeclareOriginality[pdf/originality.pdf]
\makeDeclareAuthorization

% 使用罗马数字对前言编号
Expand Down
113 changes: 113 additions & 0 deletions scripts/pack.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#!/usr/bin/env bash

# This script is used for creating CTAN archive of sjtuthesis.

if [ "$#" -ne 5 ]; then
echo "Usage: $0 SOURCE_DIR LOGO_DIR SAMPLE_DIR RELEASE_DIR VERSION" >&2
exit 1
fi

JOB_NAME=sjtuthesis
WORKING_DIR=$PWD
VERSION=$5

TEMP_DIR=/tmp/$JOB_NAME

SOURCE_DIR=$WORKING_DIR/$1
LOGO_DIR=$WORKING_DIR/$2
SAMPLE_DIR=$WORKING_DIR/$3
RELEASE_DIR=$WORKING_DIR/$4
OUTPUT_DIR=$RELEASE_DIR/$JOB_NAME-$VERSION

TDS_DIR=$TEMP_DIR/TDS
CTAN_DIR=$TEMP_DIR/$JOB_NAME

SRC_DIR=$TDS_DIR/source/latex/$JOB_NAME
TEX_DIR=$TDS_DIR/tex/latex/$JOB_NAME
DOC_DIR=$TDS_DIR/doc/latex/$JOB_NAME

mkdir -p $TEMP_DIR
mkdir -p $TDS_DIR
mkdir -p $CTAN_DIR

if [ -d $RELEASE_DIR ]; then
echo 'Directory' $4 'already exists'
exit 1
else
mkdir -p $RELEASE_DIR
fi

cp -r $SAMPLE_DIR $OUTPUT_DIR

mkdir -p $SRC_DIR
mkdir -p $TEX_DIR
mkdir -p $DOC_DIR

cp $SOURCE_DIR/$JOB_NAME.dtx $TEMP_DIR/
cp $SOURCE_DIR/latexmkrc $TEMP_DIR/
cp $SAMPLE_DIR/thesis.tex $TEMP_DIR/
cp $LOGO_DIR/sjtu-badge.pdf $TEMP_DIR/
cp $LOGO_DIR/sjtu-logo.pdf $TEMP_DIR/
cp $LOGO_DIR/sjtu-name.pdf $TEMP_DIR/

cd $TEMP_DIR
xetex --interaction=batchmode $JOB_NAME.dtx >/dev/null
latexmk -silent $JOB_NAME.dtx >/dev/null
latexmk -silent -c $JOB_NAME.dtx >/dev/null

# All files should be rw-r--r--
chmod 644 $TEMP_DIR/*.*

cp $TEMP_DIR/*.dtx $SRC_DIR/
cp $TEMP_DIR/*.ins $SRC_DIR/
cp $TEMP_DIR/sjtudoc.cls $SRC_DIR/

cp $TEMP_DIR/$JOB_NAME.cls $TEX_DIR/
cp $TEMP_DIR/*.ltx $TEX_DIR/

# These files should not be put in doc/
cp $TEMP_DIR/sjtu-badge.pdf $TEX_DIR/
cp $TEMP_DIR/sjtu-logo.pdf $TEX_DIR/
cp $TEMP_DIR/sjtu-name.pdf $TEX_DIR/

cp $TEMP_DIR/$JOB_NAME.pdf $DOC_DIR/
cp $TEMP_DIR/$JOB_NAME.pdf $RELEASE_DIR/

# Overleaf
cp $TEX_DIR/*.* $OUTPUT_DIR/
cp $(kpsewhich gb7714-2015.bbx) $OUTPUT_DIR/
cp $(kpsewhich gb7714-2015.cbx) $OUTPUT_DIR/

# Make Overleaf zip
cd $RELEASE_DIR
zip -q -r -9 $JOB_NAME-overleaf-v$VERSION.zip $JOB_NAME-$VERSION

rm $OUTPUT_DIR/gb7714-2015.*
cp $SOURCE_DIR/latexmkrc $OUTPUT_DIR/.latexmkrc
cp $SOURCE_DIR/sample.mak $OUTPUT_DIR/Makefile
cp $SOURCE_DIR/sample.bat $OUTPUT_DIR/compile.bat

zip -q -r -9 $JOB_NAME-v$VERSION.zip $JOB_NAME-$VERSION

# Make TDS zip
cd $TDS_DIR
zip -q -r -9 $JOB_NAME.tds.zip .

cp $TEMP_DIR/*.dtx $CTAN_DIR/
cp $TEMP_DIR/*.ins $CTAN_DIR/
cp $TEMP_DIR/*.pdf $CTAN_DIR/

rm $TEMP_DIR/*.*
cp $TDS_DIR/*.zip $TEMP_DIR/
rm -r $TDS_DIR

# Make CTAN zip
cd $TEMP_DIR
rm $TEMP_DIR/latexmkrc
zip -q -r -9 $JOB_NAME.zip .

cd $WORKING_DIR
cp -f $TEMP_DIR/*.zip $RELEASE_DIR/

rm -r $TEMP_DIR
rm -r $OUTPUT_DIR
18 changes: 18 additions & 0 deletions scripts/unpack.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

cd logos

cp sjtu-badge.pdf ../sample
cp sjtu-logo.pdf ../sample
cp sjtu-name.pdf ../sample

cd -

cd source

xetex -interaction=batchmode sjtuthesis.dtx
cp sjtuthesis.cls ../sample
cp sjtuthesis-bachelor.ltx ../sample
cp sjtuthesis-graduate.ltx ../sample

cd -
Loading

0 comments on commit 9a71ccd

Please sign in to comment.