forked from Baiyu3618/SJTUThesis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
56 changed files
with
421 additions
and
1,707 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
Binary file not shown.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
./resources/sjtu-badge-blue.pdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
./resources/sjtu-logo-black.pdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
./resources/sjtu-name-blue.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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 - |
Oops, something went wrong.