Skip to content

Commit

Permalink
fix #5
Browse files Browse the repository at this point in the history
  • Loading branch information
Astro-Lee committed Feb 23, 2024
1 parent 9132230 commit f64ca76
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
11 changes: 10 additions & 1 deletion YNUthesis.cls
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,16 @@
\__YNU_sanitize_chapter_title:n {#1}
\group_begin:
\ctexset { chapter / numbering = false }
\chapter [ \l__YNU_tmpa_tl ] {#1}
% 使用正则表达式匹配只包含英文字符的标题
\regex_match:nnTF {^[A-Za-z]+$} {#1}
{
% 如果标题只包含英文字符,则将标题设置为罗马字体
\chapter [ \l__YNU_tmpa_tl ] {\rmfamily #1}
}
{
% 如果标题不只包含英文字符,则保持默认字体
\chapter [ \l__YNU_tmpa_tl ] {#1}
}
\group_end:
\__YNU_chapter_header:n {#1}
}
Expand Down
11 changes: 10 additions & 1 deletion YNUthesis.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -1547,7 +1547,16 @@ Copyright (C) 2023 by Rui-Zhi Li <[email protected]>
\@@_sanitize_chapter_title:n {#1}
\group_begin:
\ctexset { chapter / numbering = false }
\chapter [ \l_@@_tmpa_tl ] {#1}
% 使用正则表达式匹配只包含英文字符的标题
\regex_match:nnTF {^[A-Za-z]+$} {#1}
{
% 如果标题只包含英文字符,则将标题设置为罗马字体
\chapter [ \l_@@_tmpa_tl ] {\rmfamily #1}
}
{
% 如果标题不只包含英文字符,则保持默认字体
\chapter [ \l_@@_tmpa_tl ] {#1}
}
\group_end:
\@@_chapter_header:n {#1}
}
Expand Down

0 comments on commit f64ca76

Please sign in to comment.