Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dynamically scaled cover items #44

Merged
merged 6 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading