Skip to content

Commit

Permalink
Add dynamically scaled cover items
Browse files Browse the repository at this point in the history
  • Loading branch information
RizhongLin committed Apr 25, 2024
1 parent c1ee5d6 commit 9914a85
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 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}}}
\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 9914a85

Please sign in to comment.