From 420a841c5758450535887c7f47427aaae7cfdc68 Mon Sep 17 00:00:00 2001 From: Feng Kaiyu Date: Thu, 15 Dec 2022 21:00:19 +0800 Subject: [PATCH 1/2] build(makefile): improve Overleaf pack logic. --- Makefile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 3799cf6e..9f72f712 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ endif .PHONY: all cls doc clean FORCE_MAKE copy $(PACKAGE).pdf: cls FORCE_MAKE - $(LATEXMK) -xelatex $(PACKAGE).dtx + @$(LATEXMK) -xelatex $(PACKAGE).dtx $(CLSFILE): $(SOURCES) yes y | xetex $(PACKAGE).ins @@ -70,13 +70,19 @@ copy: cls # Generate scaffolds for overleaf overleaf: doc FORCE_MAKE + # if $version is not specified, alert the user. + @if [ -z "$$version" ]; then \ + echo -e "\e[32mPlease specify the version of the template you want to generate.\e[0m"; \ + echo -e "\e[32mFor example: make overleaf version=1.0.0\e[0m"; \ + exit 1; \ + fi git clean -fdx ./templates/ rm -rf overleaf make copy mkdir overleaf ls templates | \ xargs -I {} bash -c \ - "cp -r ./templates/{} overleaf && cp $(PACKAGE).pdf ./overleaf/{} && zip -r ./overleaf/{}.zip ./overleaf/{}" + "cp -r ./templates/{} overleaf && cp $(PACKAGE).pdf ./overleaf/{} && zip -r ./overleaf/BIThesis-{}-v$(version).zip ./overleaf/{}" dev: ls bithesis.dtx | entr -s 'yes y | make doc && make copy' From f477e2db879ca5722c18397bac74d2e146ed2074 Mon Sep 17 00:00:00 2001 From: Feng Kaiyu Date: Thu, 15 Dec 2022 21:00:58 +0800 Subject: [PATCH 2/2] fix: add pdf bookmarks for \chapter* --- bithesis.dtx | 7 +++++-- templates/graduate-thesis/bithesis.cls | 5 ++++- templates/paper-translation/bithesis.cls | 5 ++++- templates/undergraduate-thesis-en/bithesis.cls | 5 ++++- templates/undergraduate-thesis/bithesis.cls | 5 ++++- 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/bithesis.dtx b/bithesis.dtx index 7669b656..f34e8fa9 100644 --- a/bithesis.dtx +++ b/bithesis.dtx @@ -2229,7 +2229,7 @@ \RequirePackage{tikz} \RequirePackage{etoolbox} % Hide color and border in hyperref. -\RequirePackage[hidelinks]{hyperref} +\RequirePackage[hidelinks,bookmarksnumbered]{hyperref} \RequirePackage{xcolor} \RequirePackage{caption} \RequirePackage{array} @@ -3594,6 +3594,7 @@ \chapter{\c_@@_label_abstract_tl} } { \chapter*{\c_@@_label_abstract_tl} + \currentpdfbookmark{\c_@@_label_abstract_tl}{ch:abstract} } } \vspace*{1mm} @@ -3664,6 +3665,7 @@ \chapter{\c_@@_label_abstract_en_tl} } { \chapter*{\c_@@_label_abstract_en_tl} + \currentpdfbookmark{\c_@@_label_abstract_en_tl}{ch:abstract:en} } } } @@ -4034,7 +4036,7 @@ % \end{environment} % \begin{environment}{symbols} -% 生成主要术语对照包。 +% 生成主要术语对照表。 % \begin{macrocode} \NewDocumentEnvironment {symbols} {} { @@ -4042,6 +4044,7 @@ \chapter{\c_@@_label_symbols_tl} } { \chapter*{\c_@@_label_symbols_tl} + \currentpdfbookmark{\c_@@_label_symbols_tl}{ch:symbols} } \zihao{-4} \begin{itemize}[ diff --git a/templates/graduate-thesis/bithesis.cls b/templates/graduate-thesis/bithesis.cls index 8943863b..4306607e 100644 --- a/templates/graduate-thesis/bithesis.cls +++ b/templates/graduate-thesis/bithesis.cls @@ -418,7 +418,7 @@ \RequirePackage{multirow} \RequirePackage{tikz} \RequirePackage{etoolbox} -\RequirePackage[hidelinks]{hyperref} +\RequirePackage[hidelinks,bookmarksnumbered]{hyperref} \RequirePackage{xcolor} \RequirePackage{caption} \RequirePackage{array} @@ -1480,6 +1480,7 @@ \chapter{\c__bithesis_label_abstract_tl} } { \chapter*{\c__bithesis_label_abstract_tl} + \currentpdfbookmark{\c__bithesis_label_abstract_tl}{ch:abstract} } } \vspace*{1mm} @@ -1544,6 +1545,7 @@ \chapter{\c__bithesis_label_abstract_en_tl} } { \chapter*{\c__bithesis_label_abstract_en_tl} + \currentpdfbookmark{\c__bithesis_label_abstract_en_tl}{ch:abstract:en} } } } @@ -1861,6 +1863,7 @@ \chapter{\c__bithesis_label_symbols_tl} } { \chapter*{\c__bithesis_label_symbols_tl} + \currentpdfbookmark{\c__bithesis_label_symbols_tl}{ch:symbols} } \zihao{-4} \begin{itemize}[ diff --git a/templates/paper-translation/bithesis.cls b/templates/paper-translation/bithesis.cls index 8943863b..4306607e 100644 --- a/templates/paper-translation/bithesis.cls +++ b/templates/paper-translation/bithesis.cls @@ -418,7 +418,7 @@ \RequirePackage{multirow} \RequirePackage{tikz} \RequirePackage{etoolbox} -\RequirePackage[hidelinks]{hyperref} +\RequirePackage[hidelinks,bookmarksnumbered]{hyperref} \RequirePackage{xcolor} \RequirePackage{caption} \RequirePackage{array} @@ -1480,6 +1480,7 @@ \chapter{\c__bithesis_label_abstract_tl} } { \chapter*{\c__bithesis_label_abstract_tl} + \currentpdfbookmark{\c__bithesis_label_abstract_tl}{ch:abstract} } } \vspace*{1mm} @@ -1544,6 +1545,7 @@ \chapter{\c__bithesis_label_abstract_en_tl} } { \chapter*{\c__bithesis_label_abstract_en_tl} + \currentpdfbookmark{\c__bithesis_label_abstract_en_tl}{ch:abstract:en} } } } @@ -1861,6 +1863,7 @@ \chapter{\c__bithesis_label_symbols_tl} } { \chapter*{\c__bithesis_label_symbols_tl} + \currentpdfbookmark{\c__bithesis_label_symbols_tl}{ch:symbols} } \zihao{-4} \begin{itemize}[ diff --git a/templates/undergraduate-thesis-en/bithesis.cls b/templates/undergraduate-thesis-en/bithesis.cls index 8943863b..4306607e 100644 --- a/templates/undergraduate-thesis-en/bithesis.cls +++ b/templates/undergraduate-thesis-en/bithesis.cls @@ -418,7 +418,7 @@ \RequirePackage{multirow} \RequirePackage{tikz} \RequirePackage{etoolbox} -\RequirePackage[hidelinks]{hyperref} +\RequirePackage[hidelinks,bookmarksnumbered]{hyperref} \RequirePackage{xcolor} \RequirePackage{caption} \RequirePackage{array} @@ -1480,6 +1480,7 @@ \chapter{\c__bithesis_label_abstract_tl} } { \chapter*{\c__bithesis_label_abstract_tl} + \currentpdfbookmark{\c__bithesis_label_abstract_tl}{ch:abstract} } } \vspace*{1mm} @@ -1544,6 +1545,7 @@ \chapter{\c__bithesis_label_abstract_en_tl} } { \chapter*{\c__bithesis_label_abstract_en_tl} + \currentpdfbookmark{\c__bithesis_label_abstract_en_tl}{ch:abstract:en} } } } @@ -1861,6 +1863,7 @@ \chapter{\c__bithesis_label_symbols_tl} } { \chapter*{\c__bithesis_label_symbols_tl} + \currentpdfbookmark{\c__bithesis_label_symbols_tl}{ch:symbols} } \zihao{-4} \begin{itemize}[ diff --git a/templates/undergraduate-thesis/bithesis.cls b/templates/undergraduate-thesis/bithesis.cls index 8943863b..4306607e 100644 --- a/templates/undergraduate-thesis/bithesis.cls +++ b/templates/undergraduate-thesis/bithesis.cls @@ -418,7 +418,7 @@ \RequirePackage{multirow} \RequirePackage{tikz} \RequirePackage{etoolbox} -\RequirePackage[hidelinks]{hyperref} +\RequirePackage[hidelinks,bookmarksnumbered]{hyperref} \RequirePackage{xcolor} \RequirePackage{caption} \RequirePackage{array} @@ -1480,6 +1480,7 @@ \chapter{\c__bithesis_label_abstract_tl} } { \chapter*{\c__bithesis_label_abstract_tl} + \currentpdfbookmark{\c__bithesis_label_abstract_tl}{ch:abstract} } } \vspace*{1mm} @@ -1544,6 +1545,7 @@ \chapter{\c__bithesis_label_abstract_en_tl} } { \chapter*{\c__bithesis_label_abstract_en_tl} + \currentpdfbookmark{\c__bithesis_label_abstract_en_tl}{ch:abstract:en} } } } @@ -1861,6 +1863,7 @@ \chapter{\c__bithesis_label_symbols_tl} } { \chapter*{\c__bithesis_label_symbols_tl} + \currentpdfbookmark{\c__bithesis_label_symbols_tl}{ch:symbols} } \zihao{-4} \begin{itemize}[