Skip to content

Commit

Permalink
Add dynamically scaled cover items (#44)
Browse files Browse the repository at this point in the history
* Add dynamically scaled cover items

* fix ci

* fix ci

* fix ci

* fix ci

* fix ci
  • Loading branch information
RizhongLin committed Apr 25, 2024
1 parent c1ee5d6 commit 0796856
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
- name: install Python for minted
uses: actions/setup-python@v4
with:
python-version: "3.9"
python-version: "3.11"
- name: pip install Pygments for minted
run: pip install Pygments
- name: install TeXLive
Expand Down Expand Up @@ -97,7 +97,7 @@ jobs:
- name: install Python for minted
uses: actions/setup-python@v4
with:
python-version: "3.9"
python-version: "3.11"
- name: pip install Pygments for minted
run: pip install Pygments
- name: install TeXLive
Expand Down
34 changes: 24 additions & 10 deletions style/tongjithesis.cls
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,9 @@

% 设置参考文献格式
\RequirePackage[
backend=biber,
style=gb7714-2015,
natbib=true,
backend=biber,
style=gb7714-2015,
natbib=true,
]{biblatex}
\addbibresource{bib/note.bib}

Expand All @@ -294,8 +294,22 @@
\zihao{-3}\oldtabular[#1]
}{\renewcommand{\arraystretch}{1.2}\endoldtabular
}
\RequirePackage{ulem}
\newcommand{\ulinecentered}[1]{\uline{\makebox[20em][c]{#1}}}

\RequirePackage{ulem,calc}
\newlength{\covertextwidth}
\newlength{\covermaxwidth}

\newcommand{\ulinecentered}[1]{
\setlength{\covertextwidth}{\widthof{#1}}
\setlength{\covermaxwidth}{20em} % Set the maximum width you allow
\ifthenelse{\lengthtest{\covertextwidth > \covermaxwidth}}{
% Calculate scale factor and scale down text if too wide
\pgfmathsetmacro{\scalefactor}{\covermaxwidth/\covertextwidth}
\uline{\makebox[\covermaxwidth][c]{\scalebox{\scalefactor}[1]{#1}}}
}{
\uline{\makebox[\covermaxwidth][c]{#1}} % Use normal text if within the limit
}
}


% 加载包部分结束,此后开始定义内容 Layout
Expand Down Expand Up @@ -398,10 +412,10 @@

\makeatletter
\def\clearchapterpage{%
\@ifclasswith{tongjithesis}{twoside}{%
\cleardoublepage % 如果使用双面模式的 tongjithesis 文档类,使用 \cleardoublepage 清除页面
}{%
\clearpage % 否则,使用 \clearpage 清除页面
}
\@ifclasswith{tongjithesis}{twoside}{%
\cleardoublepage % 如果使用双面模式的 tongjithesis 文档类,使用 \cleardoublepage 清除页面
}{%
\clearpage % 否则,使用 \clearpage 清除页面
}
}
\makeatother

0 comments on commit 0796856

Please sign in to comment.