From 9b849dd0132494b92af5d5fca40d89c32186e095 Mon Sep 17 00:00:00 2001 From: Feng Kaiyu Date: Sat, 17 Jun 2023 17:28:17 +0800 Subject: [PATCH] feat: support hyphenation by default. fix: 357 --- bithesis.dtx | 7 ++++--- templates/graduate-thesis/bithesis.cls | 7 ++++--- templates/paper-translation/bithesis.cls | 7 ++++--- templates/undergraduate-thesis-en/bithesis.cls | 7 ++++--- templates/undergraduate-thesis/bithesis.cls | 7 ++++--- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/bithesis.dtx b/bithesis.dtx index 6b48c9a8..4853a058 100644 --- a/bithesis.dtx +++ b/bithesis.dtx @@ -739,6 +739,9 @@ % Windows 平台开启宋体伪粗体。 windowsSimSunFakeBold .bool_set:N = \l_@@_style_windows_simsum_fake_bold, windowsSimSunFakeBold .initial:n = {false}, + % 控制英文是否使用 hyphen 进行换行 + hyphen .bool_set:N = \l_@@_style_hyphen_bool, + hyphen .initial:n = {true}, } % \end{macrocode} % @@ -1474,13 +1477,11 @@ % 是的,这是祖传代码。 % 在英文模式下禁用,因为这段代码会禁用 hyphenation. % \begin{macrocode} -\@@_if_thesis_english:TF{ +\bool_if:NF \l_@@_style_hyphen_bool { \hbadness=10000 -}{ \tolerance=1 \emergencystretch=\maxdimen \hyphenpenalty=10000 - \hbadness=10000 } % \end{macrocode} % diff --git a/templates/graduate-thesis/bithesis.cls b/templates/graduate-thesis/bithesis.cls index 68672059..c55716cb 100644 --- a/templates/graduate-thesis/bithesis.cls +++ b/templates/graduate-thesis/bithesis.cls @@ -487,6 +487,9 @@ % Windows 平台开启宋体伪粗体。 windowsSimSunFakeBold .bool_set:N = \l__bithesis_style_windows_simsum_fake_bold, windowsSimSunFakeBold .initial:n = {false}, + % 控制英文是否使用 hyphen 进行换行 + hyphen .bool_set:N = \l__bithesis_style_hyphen_bool, + hyphen .initial:n = {true}, } \keys_define:nn { bithesis / TOC } { @@ -1020,13 +1023,11 @@ \cs_gset:Npn \lstlistingname {\c__bithesis_label_code_tl} } \captionsetup[lstlisting]{font=small,labelsep=space} -\__bithesis_if_thesis_english:TF{ +\bool_if:NF \l__bithesis_style_hyphen_bool { \hbadness=10000 -}{ \tolerance=1 \emergencystretch=\maxdimen \hyphenpenalty=10000 - \hbadness=10000 } \definecolor{codegreen}{rgb}{0,0.6,0} \definecolor{codegray}{rgb}{0.5,0.5,0.5} diff --git a/templates/paper-translation/bithesis.cls b/templates/paper-translation/bithesis.cls index 68672059..c55716cb 100644 --- a/templates/paper-translation/bithesis.cls +++ b/templates/paper-translation/bithesis.cls @@ -487,6 +487,9 @@ % Windows 平台开启宋体伪粗体。 windowsSimSunFakeBold .bool_set:N = \l__bithesis_style_windows_simsum_fake_bold, windowsSimSunFakeBold .initial:n = {false}, + % 控制英文是否使用 hyphen 进行换行 + hyphen .bool_set:N = \l__bithesis_style_hyphen_bool, + hyphen .initial:n = {true}, } \keys_define:nn { bithesis / TOC } { @@ -1020,13 +1023,11 @@ \cs_gset:Npn \lstlistingname {\c__bithesis_label_code_tl} } \captionsetup[lstlisting]{font=small,labelsep=space} -\__bithesis_if_thesis_english:TF{ +\bool_if:NF \l__bithesis_style_hyphen_bool { \hbadness=10000 -}{ \tolerance=1 \emergencystretch=\maxdimen \hyphenpenalty=10000 - \hbadness=10000 } \definecolor{codegreen}{rgb}{0,0.6,0} \definecolor{codegray}{rgb}{0.5,0.5,0.5} diff --git a/templates/undergraduate-thesis-en/bithesis.cls b/templates/undergraduate-thesis-en/bithesis.cls index 68672059..c55716cb 100644 --- a/templates/undergraduate-thesis-en/bithesis.cls +++ b/templates/undergraduate-thesis-en/bithesis.cls @@ -487,6 +487,9 @@ % Windows 平台开启宋体伪粗体。 windowsSimSunFakeBold .bool_set:N = \l__bithesis_style_windows_simsum_fake_bold, windowsSimSunFakeBold .initial:n = {false}, + % 控制英文是否使用 hyphen 进行换行 + hyphen .bool_set:N = \l__bithesis_style_hyphen_bool, + hyphen .initial:n = {true}, } \keys_define:nn { bithesis / TOC } { @@ -1020,13 +1023,11 @@ \cs_gset:Npn \lstlistingname {\c__bithesis_label_code_tl} } \captionsetup[lstlisting]{font=small,labelsep=space} -\__bithesis_if_thesis_english:TF{ +\bool_if:NF \l__bithesis_style_hyphen_bool { \hbadness=10000 -}{ \tolerance=1 \emergencystretch=\maxdimen \hyphenpenalty=10000 - \hbadness=10000 } \definecolor{codegreen}{rgb}{0,0.6,0} \definecolor{codegray}{rgb}{0.5,0.5,0.5} diff --git a/templates/undergraduate-thesis/bithesis.cls b/templates/undergraduate-thesis/bithesis.cls index 68672059..c55716cb 100644 --- a/templates/undergraduate-thesis/bithesis.cls +++ b/templates/undergraduate-thesis/bithesis.cls @@ -487,6 +487,9 @@ % Windows 平台开启宋体伪粗体。 windowsSimSunFakeBold .bool_set:N = \l__bithesis_style_windows_simsum_fake_bold, windowsSimSunFakeBold .initial:n = {false}, + % 控制英文是否使用 hyphen 进行换行 + hyphen .bool_set:N = \l__bithesis_style_hyphen_bool, + hyphen .initial:n = {true}, } \keys_define:nn { bithesis / TOC } { @@ -1020,13 +1023,11 @@ \cs_gset:Npn \lstlistingname {\c__bithesis_label_code_tl} } \captionsetup[lstlisting]{font=small,labelsep=space} -\__bithesis_if_thesis_english:TF{ +\bool_if:NF \l__bithesis_style_hyphen_bool { \hbadness=10000 -}{ \tolerance=1 \emergencystretch=\maxdimen \hyphenpenalty=10000 - \hbadness=10000 } \definecolor{codegreen}{rgb}{0,0.6,0} \definecolor{codegray}{rgb}{0.5,0.5,0.5}