Jinwen-XU / jwjournal

A personal LaTeX class for writing journals
https://ctan.org/pkg/jwjournal
LaTeX Project Public License v1.3c
10 stars 2 forks source link

I can't compile in overleaf with the Chinese version. #5

Open NewerZeus opened 4 months ago

NewerZeus commented 4 months ago

I can compile the demo-cn with Texstudio in a Lualatex compiler. However, I download your code as a zip uploading it to overleaf and I compile the demo-cn in the same config as Texstudio. It takes too much time to compile that overleaf says "timed out". Because I want to write onilne, overleaf is very important. Thank you for your help! 屏幕截图 2024-03-05 131152

Jinwen-XU commented 4 months ago

Thank you for reporting this issue. However, since I hardly use Overleaf, I didn't really tested my code this way. I suspect that the problem is with the font selection, but it might also be that some packages are not quite updated as required (as you are compiling it with TeX Live 2022). Would it be possible for you to provide a complete log file so that I could see what went wrong exactly?

NewerZeus commented 4 months ago

Really thanks for your answer!As you can see on the left side of the picture that I am using TeX Live 2023 for compilation. And this is my log file. It seems to be related to the font, but I can't really understand the log file. The log.txt

Jinwen-XU commented 4 months ago

Thank you for this additional information. From the log file, the packages and classes seem to be newly enough, and it confirms my suspect that the issue was probably on the step of font selection. Though not knowing how much time was spent in each step, according to my past experience, these operations

luaotfload | cache : Lookup cache loaded from /home/tex/texmf-var/luatex-cache/generic/names/luaotfload-lookup-cache.luc.
luaotfload | db : Reload initiated (formats: otf,ttf,ttc); reason: Font "SourceHanSerifSC-Regular" not found.
luaotfload | resolve : sequence of 3 lookups yielded nothing appropriate.(load cache: extra_fandolsong-regular.luc)
luaotfload | aux : font no 42 (nil) does not define feature smcp for script latn with language dflt(load cache: extra_fandolsong-bold.luc)
luaotfload | aux : font no 43 (nil) does not define feature smcp for script latn with language dflt(load cache: extra_fandolkai-regular.luc)

near the end of the log would be what cost most of the compilation time, which on the local version could take up about 1min before the system finally finds out that the default (Chinese) font is not properly installed and then switches to the fallback fonts. That is probably what caused the timeout: according to Overleaf's introduction, its free plan only allows 20secs of compilation time.

As a suggestion for improving this situation, I would recommend that you add the font files for the Source Han font series (思源字体) to Overleaf according to their instruction (see, e.g., this guide). In the README, you may find the links to the Release pages of the corresponding fonts, and I think the OTF version is what you (might) need. On the local version I am usually using the OTC file where one installation would suffice, but on Overleaf you probably need to add the multiple OTF files (files for SC, TC, JP, in Regular, Bold, Italic, etc.) to your file directory.

I am not really sure if things would work out after doing so. If you still encounter problems after (properly) adding the font files, feel free to attach the new log file here, and I shall take a deeper look into it. Later I may decide whether to add some instruction in the README of this package on working with Overleaf, based on your experience ;-)

Jinwen-XU commented 4 months ago

It seems that Overleaf has preinstalled the Google version of "Source Hans": the "Noto CJK" series. Below is a version of the base class einfart.cls that uses the "Noto CJK" fonts instead of "Source Hans". You can copy the code into an empty text file and rename it to einfart.cls and place it in the same folder as your main .tex file. With this, there should be no need for you to upload those font files (but for now I am rather unsure whether calling the font by its PostScript name would work on Overleaf, let's see:).

Un-collapse to see the modified "einfart.cls". ```latex %% %% This is file `einfart/einfart.cls', %% generated with the docstrip utility. %% %% Copyright (C) 2021-2024 by Jinwen XU %% %% This is part of the minimalist class series. %% %% This work may be distributed and/or modified under the conditions of the %% LaTeX Project Public License, either version 1.3c of this license or (at %% your option) any later version. The latest version of this license is in %% %% http://www.latex-project.org/lppl.txt %% %% and version 1.3c or later is part of all distributions of LaTeX version %% 2005/12/01 or later. %% \NeedsTeXFormat{LaTeX2e}[2022-06-01] \ProvidesExplClass {einfart} {2024/03/05} {} {A simple and clear article style} \tl_const:Nn \l__minimclass_base_class_tl { article } \bool_new:N \l__minimclass_load_custom_font_file_bool \bool_set_false:N \l__minimclass_load_custom_font_file_bool \bool_new:N \l__minimclass_load_custom_font_file_latin_bool \bool_set_false:N \l__minimclass_load_custom_font_file_latin_bool \bool_new:N \l__minimclass_load_custom_font_file_cjk_bool \bool_set_false:N \l__minimclass_load_custom_font_file_cjk_bool \bool_new:N \l__minimclass_load_custom_font_file_math_bool \bool_set_false:N \l__minimclass_load_custom_font_file_math_bool \keys_define:nn { minimclass } { , draft .bool_set:N = \l__minimclass_fast_bool , draft .initial:n = { false } , fast .bool_set:N = \l__minimclass_fast_bool , print .bool_set:N = \l__minimclass_print_mode_bool , print .initial:n = { false } , print mode .bool_set:N = \l__minimclass_print_mode_bool , print~mode .bool_set:N = \l__minimclass_print_mode_bool , print-mode .bool_set:N = \l__minimclass_print_mode_bool , print version .bool_set:N = \l__minimclass_print_mode_bool , print~version .bool_set:N = \l__minimclass_print_mode_bool , print-version .bool_set:N = \l__minimclass_print_mode_bool , use indent .bool_set:N = \l__minimclass_useindent_bool , use indent .initial:n = { true } , use~indent .bool_set:N = \l__minimclass_useindent_bool , use-indent .bool_set:N = \l__minimclass_useindent_bool , load custom font file .code:n = { \bool_set_true:N \l__minimclass_load_custom_font_file_bool \str_set:Nn \l__minimclass_custom_font_file_str { #1 } \bool_set_true:N \l__minimclass_load_custom_font_file_latin_bool \str_set:Nn \l__minimclass_custom_font_file_latin_str { minimalist.font.latin } \bool_set_true:N \l__minimclass_load_custom_font_file_cjk_bool \str_set:Nn \l__minimclass_custom_font_file_cjk_str { minimalist.font.cjk } \bool_set_true:N \l__minimclass_load_custom_font_file_math_bool \str_set:Nn \l__minimclass_custom_font_file_math_str { minimalist.font.math } } , load custom font file .default:n = { minimalist.font } , load~custom~font~file .meta:n = { load custom font file = { #1 } } , load~custom~font~file .default:n = { minimalist.font } , load-custom-font-file .meta:n = { load custom font file = { #1 } } , load-custom-font-file .default:n = { minimalist.font } , load custom latin font file .code:n = { \bool_set_true:N \l__minimclass_load_custom_font_file_latin_bool \str_set:Nn \l__minimclass_custom_font_file_latin_str { #1 } } , load custom latin font file .default:n = { minimalist.font.latin } , load~custom~latin~font~file .meta:n = { load custom latin font file = { #1 } } , load~custom~latin~font~file .default:n = { minimalist.font.latin } , load-custom-latin-font-file .meta:n = { load custom latin font file = { #1 } } , load-custom-latin-font-file .default:n = { minimalist.font.latin } , load custom cjk font file .code:n = { \bool_set_true:N \l__minimclass_load_custom_font_file_cjk_bool \str_set:Nn \l__minimclass_custom_font_file_cjk_str { #1 } } , load custom cjk font file .default:n = { minimalist.font.cjk } , load~custom~cjk~font~file .meta:n = { load custom cjk font file = { #1 } } , load~custom~cjk~font~file .default:n = { minimalist.font.cjk } , load-custom-cjk-font-file .meta:n = { load custom cjk font file = { #1 } } , load-custom-cjk-font-file .default:n = { minimalist.font.cjk } , load custom math font file .code:n = { \bool_set_true:N \l__minimclass_load_custom_font_file_math_bool \str_set:Nn \l__minimclass_custom_font_file_math_str { #1 } } , load custom math font file .default:n = { minimalist.font.math } , load~custom~math~font~file .meta:n = { load custom math font file = { #1 } } , load~custom~math~font~file .default:n = { minimalist.font.math } , load-custom-math-font-file .meta:n = { load custom math font file = { #1 } } , load-custom-math-font-file .default:n = { minimalist.font.math } , a4paper .bool_set:N = \l__minimclass_a_four_paper_bool , a4paper .initial:n = { false } , b5paper .bool_set:N = \l__minimclass_b_five_paper_bool , b5paper .initial:n = { false } , oneside .code:n = { \PassOptionsToClass { \CurrentOption } { \l__minimclass_base_class_tl } } , twoside .code:n = { \PassOptionsToClass { \CurrentOption } { \l__minimclass_base_class_tl } } , 11pt .code:n = { \PassOptionsToClass { \CurrentOption } { \l__minimclass_base_class_tl } } , 12pt .code:n = { \PassOptionsToClass { \CurrentOption } { \l__minimclass_base_class_tl } } , unknown .code:n = { \PassOptionsToPackage { \CurrentOption } { minimalist } } } \ProcessKeyOptions [ minimclass ] \LoadClass{\l__minimclass_base_class_tl} \NewDocumentCommand \IfPrintModeTF { m m } { \bool_if:NTF \l__minimclass_print_mode_bool { #1 } { #2 } } \NewDocumentCommand \IfPrintModeT { m } { \bool_if:NT \l__minimclass_print_mode_bool { #1 } } \NewDocumentCommand \IfPrintModeF { m } { \bool_if:NF \l__minimclass_print_mode_bool { #1 } } %%================================ %% Page layout %%================================ \RequirePackage { silence } \WarningFilter { geometry } { Over-specification } \PassOptionsToPackage { heightrounded } { geometry } \RequirePackage { geometry } \geometry { papersize = { 7in, 10in }, total = { 5.535in, 8.300in }, centering, footnotesep = 2em plus 2pt minus 2pt, footskip = .5in, } \bool_if:NT \l__minimclass_b_five_paper_bool { \geometry { b5paper, total = { 5.535in, 8.160in }, centering, footnotesep = 2em plus 2pt minus 2pt, footskip = .5in, } } \bool_if:NT \l__minimclass_a_four_paper_bool { \geometry { a4paper, total = { 6.500in, 9.685in }, centering, footnotesep = 2em plus 2pt minus 2pt, footskip = .5in, } } \bool_if:NT \l__minimclass_fast_bool { \PassOptionsToPackage { fast } { minimalist } \RequirePackage { draftwatermark } \DraftwatermarkOptions { text = { \normalfont DRAFT }, color = paper!97!-paper } } \RequirePackage { minimalist } \str_if_eq:onT { \l__minimalist_style_str } { classical } { \bool_set_false:N \l__minimclass_useindent_bool } \bool_if:NTF \l__minimclass_useindent_bool { \RequirePackage { indentfirst } } { \hook_gput_code:nnn { begindocument/before } { minimclass } { \RequirePackage { parskip } } } %%================================ %% Fonts %%================================ \WarningFilter { latexfont } { Font~shape } \WarningFilter { latexfont } { Some~font } \hook_gput_code:nnn { begindocument/before } { minimclass } { \IfPackageLoadedTF { biblatex } { \PassOptionsToPackage { biblatex } { embrac } } {} \RequirePackage { embrac } } \cs_new_protected:Nn \__minimclass_load_file_or_config:Nnn { \bool_if:NT #1 { \exp_args:Nx \file_if_exist:nT { #2 } { \exp_args:Nx \file_input:n { #2 } \use_none:nn } } \use:n { #3 } } \cs_new_protected:Nn \__minimclass_if_font_exist:nnn { \bool_if:NTF \l__minimclass_fast_bool { #3 } { \fontspec_font_if_exist:nTF { #1 } { #2 } { #3 } } } \__minimclass_load_file_or_config:Nnn \l__minimclass_load_custom_font_file_bool { \l__minimclass_custom_font_file_str } { \RequirePackage { projlib-font } \bool_if:NF \g_projlib_font_already_set_bool { \bool_if:NT \l__minimclass_fast_bool { \RequirePackage { mathpazo } } \PassOptionsToPackage { no-math,quiet } { fontspec } \RequirePackage { fontspec } \__minimclass_load_file_or_config:Nnn \l__minimclass_load_custom_font_file_latin_bool { \l__minimclass_custom_font_file_latin_str } { \bool_if:NTF \l__projlib_font_useosf_bool { \setmainfont { TeXGyrePagellaX } [ Extension = .otf, UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = *-Italic, BoldItalicFont = *-BoldItalic, Numbers = OldStyle , ] \setsansfont { texgyreheros } [ Extension = .otf , Scale = MatchUppercase , UprightFont = *-regular , BoldFont = *-bold , ItalicFont = *-italic , BoldItalicFont = *-bolditalic , Numbers = OldStyle , ] % \setsansfont { SourceSansPro } % [ % Extension = .otf, % UprightFont = *-Regular, % BoldFont = *-Semibold, % ItalicFont = *-RegularIt, % BoldItalicFont = *-SemiboldIt, % WordSpace = {1.25, 1, 1} , % Numbers = OldStyle , % ] } { \setmainfont { TeXGyrePagellaX } [ Extension = .otf, UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = *-Italic, BoldItalicFont = *-BoldItalic, ] \setsansfont { texgyreheros } [ Extension = .otf , Scale = MatchUppercase , UprightFont = *-regular , BoldFont = *-bold , ItalicFont = *-italic , BoldItalicFont = *-bolditalic , ] % \setsansfont { SourceSansPro } % [ % Extension = .otf, % UprightFont = *-Regular, % BoldFont = *-Semibold, % ItalicFont = *-RegularIt, % BoldItalicFont = *-SemiboldIt, % WordSpace = {1.25, 1, 1} , % ] } \setmonofont { NewCMMono10 } [ Scale = 1.05 , Extension = .otf, UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = *-Italic, BoldItalicFont = *-BoldOblique, ] \projlib_language_set_linespacing_latin:n { \setstretch { 1.07 } } \hook_gput_code:nnn { begindocument/before } { minimclass } { \RenewEmph{[}{]} \RenewEmph{(}{)} } } } \PassOptionsToPackage { fontset = none, scheme = plain } { ctex } \RequirePackage { ctex } \__minimclass_load_file_or_config:Nnn \l__minimclass_load_custom_font_file_cjk_bool { \l__minimclass_custom_font_file_cjk_str } { \__minimclass_if_font_exist:nnn { NotoSerifCJKsc-Regular } { \setCJKmainfont { NotoSerifCJKsc } [ UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = *-Regular, BoldItalicFont = *-Bold, ] } { \setCJKmainfont { FandolSong } [ Extension = .otf, UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = FandolKai-Regular , BoldItalicFont = FandolKai-Regular , BoldItalicFeatures = { FakeBold = 4 } , ] } \__minimclass_if_font_exist:nnn { NotoSansCJKsc-Regular } { \setCJKsansfont { NotoSansCJKsc } [ UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = *-Regular, BoldItalicFont = *-Bold, ] } { \setCJKsansfont { FandolHei } [ Extension = .otf, UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = *-Regular, BoldItalicFont = *-Bold, ] } \__minimclass_if_font_exist:nnn { NotoSansMonoCJKsc-Regular } { \setCJKmonofont { NotoSansMonoCJKsc } [ UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = *-Regular, BoldItalicFont = *-Bold, ] } { \setCJKmonofont { FandolFang-Regular.otf } [ BoldFont = * , BoldFeatures = { FakeBold = 4 } , ItalicFont = * , BoldItalicFont = * , BoldItalicFeatures = { FakeBold = 4 } , ] } \bool_if:NT \g__projlib_language_enabled_schinese_bool { \__minimclass_if_font_exist:nnn { NotoSerifCJKsc-Regular } { \setCJKfamilyfont { SCmain } { NotoSerifCJKsc } [ UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = *-ExtraLight, BoldItalicFont = *-SemiBold, ] } { \setCJKfamilyfont { SCmain } { FandolSong } [ Extension = .otf, UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = FandolKai-Regular , BoldItalicFont = FandolKai-Regular , BoldItalicFeatures = { FakeBold = 4 } , ] } \__minimclass_if_font_exist:nnn { NotoSansCJKsc-Regular } { \setCJKfamilyfont { SCsans } { NotoSansCJKsc } [ UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = *-Regular, BoldItalicFont = *-Bold, ] } { \setCJKfamilyfont { SCsans } { FandolHei } [ Extension = .otf, UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = *-Regular, BoldItalicFont = *-Bold, ] } \__minimclass_if_font_exist:nnn { NotoSansMonoCJKsc-Regular } { \setCJKfamilyfont { SCmono } { NotoSansMonoCJKsc } [ UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = *-Regular, BoldItalicFont = *-Bold, ] } { \setCJKfamilyfont { SCmono } { FandolFang-Regular.otf } [ BoldFont = * , BoldFeatures = { FakeBold = 4 } , ItalicFont = * , BoldItalicFont = * , BoldItalicFeatures = { FakeBold = 4 } , ] } } \bool_if:NT \g__projlib_language_enabled_tchinese_bool { \__minimclass_if_font_exist:nnn { NotoSerifCJKtc-Regular } { \setCJKfamilyfont { TCmain } { NotoSerifCJKtc } [ UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = *-ExtraLight, BoldItalicFont = *-SemiBold, ] } { \setCJKfamilyfont { TCmain } { FandolSong } [ Extension = .otf, UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = FandolKai-Regular , BoldItalicFont = FandolKai-Regular , BoldItalicFeatures = { FakeBold = 4 } , ] } \__minimclass_if_font_exist:nnn { NotoSansCJKtc-Regular } { \setCJKfamilyfont { TCsans } { NotoSansCJKtc } [ UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = *-Regular, BoldItalicFont = *-Bold, ] } { \setCJKfamilyfont { TCsans } { FandolHei } [ Extension = .otf, UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = *-Regular, BoldItalicFont = *-Bold, ] } \__minimclass_if_font_exist:nnn { NotoSansMonoCJKtc-Regular } { \setCJKfamilyfont { TCmono } { NotoSansMonoCJKtc } [ UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = *-Regular, BoldItalicFont = *-Bold, ] } { \setCJKfamilyfont { TCmono } { FandolFang-Regular.otf } [ BoldFont = * , BoldFeatures = { FakeBold = 4 } , ItalicFont = * , BoldItalicFont = * , BoldItalicFeatures = { FakeBold = 4 } , ] } } \bool_if:NT \g__projlib_language_enabled_japanese_bool { \__minimclass_if_font_exist:nnn { NotoSerifCJKjp-Regular } { \setCJKfamilyfont { JPmain } { NotoSerifCJKjp } [ UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = *-ExtraLight, BoldItalicFont = *-SemiBold, ] } { \setCJKfamilyfont { JPmain } { FandolSong } [ Extension = .otf, UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = FandolKai-Regular , BoldItalicFont = FandolKai-Regular , BoldItalicFeatures = { FakeBold = 4 } , ] } \__minimclass_if_font_exist:nnn { NotoSansCJKjp-Regular } { \setCJKfamilyfont { JPsans } { NotoSansCJKjp } [ UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = *-Regular, BoldItalicFont = *-Bold, ] } { \setCJKfamilyfont { JPsans } { FandolHei } [ Extension = .otf, UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = *-Regular, BoldItalicFont = *-Bold, ] } \__minimclass_if_font_exist:nnn { NotoSansMonoCJKjp-Regular } { \setCJKfamilyfont { JPmono } { NotoSansMonoCJKjp } [ UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = *-Regular, BoldItalicFont = *-Bold, ] } { \setCJKfamilyfont { JPmono } { FandolFang-Regular.otf } [ BoldFont = * , BoldFeatures = { FakeBold = 4 } , ItalicFont = * , BoldItalicFont = * , BoldItalicFeatures = { FakeBold = 4 } , ] } } \cs_new:Nn \minimclass_cjk_sffamily: {} \cs_new:Nn \minimclass_cjk_ttfamily: {} \hook_gput_code:nnn { cmd/sffamily/after } { minimclass } { \minimclass_cjk_sffamily: } \hook_gput_code:nnn { cmd/ttfamily/after } { minimclass } { \minimclass_cjk_ttfamily: } \AddLanguageSetting [schinese] { \cs_set:Nn \minimclass_cjk_sffamily: { \CJKfamily { SCsans } } \cs_set:Nn \minimclass_cjk_ttfamily: { \CJKfamily { SCmono } } \CJKfamily { SCmain } \hook_gput_code:nnn { normalfont } { minimclass } { \CJKfamily{SCmain} } } \AddLanguageSetting [tchinese] { \cs_set:Nn \minimclass_cjk_sffamily: { \CJKfamily { TCsans } } \cs_set:Nn \minimclass_cjk_ttfamily: { \CJKfamily { TCmono } } \CJKfamily { TCmain } \hook_gput_code:nnn { normalfont } { minimclass } { \CJKfamily{TCmain} } } \AddLanguageSetting [japanese] { \cs_set:Nn \minimclass_cjk_sffamily: { \CJKfamily { JPsans } } \cs_set:Nn \minimclass_cjk_ttfamily: { \CJKfamily { JPmono } } \CJKfamily { JPmain } \hook_gput_code:nnn { normalfont } { minimclass } { \CJKfamily{JPmain} } } % \tl_gset:Nn \g_minimalist_title_font_common_tl { \minimclass_cjk_sffamily: } } \__minimclass_load_file_or_config:Nnn \l__minimclass_load_custom_font_file_math_bool { \l__minimclass_custom_font_file_math_str } { \bool_if:NF \g_projlib_font_already_set_bool { \RequirePackage { amssymb } \bool_if:NF \l__minimclass_fast_bool { \PassOptionsToPackage { warnings-off = { mathtools-colon, mathtools-overbracket } } { unicode-math } \RequirePackage { unicode-math } \unimathsetup { math-style = ISO, partial = upright, nabla = upright } \setmathfont { KpMath-Regular.otf } \setmathfont { KpMath-Regular.otf } [ range = \amalg , Scale = 0.84625 ] \setmathfont { KpMath-Sans.otf } [ range = { \sum } ] \setmathfont { latinmodern-math.otf } [ range = { frak, bffrak, \mitvarpi, \mupvarpi, \ast } , Scale = 1.10 ] \setmathfont { texgyrepagella-math.otf } [ range = { `(, `), `/, \setminus } , Scale = 1.10 ] \setmathfont { texgyrepagella-math.otf } [ range = { \mathcomma, \mathsemicolon } , ] \setmathfont { texgyrepagella-math.otf } [ range = { it / { Latin, latin }, bfit / { Latin, latin }, up / num, bfup / num } ] \setmathfont { KpMath-Regular.otf } [ range = { cal, bfcal }, RawFeature=+ss01 ] % \setmathfont { KpMath-Regular.otf } [ range = {} ] % https://tex.stackexchange.com/a/646715 \sys_if_engine_luatex:T { \mathitalicsmode=1 } \hook_gput_code:nnn { begindocument } { minimclass } { \cs_gset_eq:NN \overline \wideoverbar \cs_gset_eq:NN \square \mdwhtsquare % https://tex.stackexchange.com/a/678611 \newcommand{\limstrut}{\vrule depth0.2ex width 0pt} \renewcommand{\varprojlim}{\mathop{\underleftarrow{{\lim}\limstrut}}} \renewcommand{\varinjlim}{\mathop{\underrightarrow{{\lim}\limstrut}}} \let\setminus@old\setminus \renewcommand*{\setminus}{\!\setminus@old\!} } % https://tex.stackexchange.com/a/647789 \hook_gput_code:nnn { begindocument } { minimclass } { \NewCommandCopy\unicodevdots\vdots \RenewDocumentCommand{\vdots}{}{\mathrel{\loweredvdots}} } \newcommand{\loweredvdots}{\mathpalette\loweredvdots@\relax} \newcommand{\loweredvdots@}[2]{% \begingroup \sbox\z@{$\m@th#1\unicodevdots$}% \vrule width \z@ height 2.25\ht\z@ depth 0.012\ht\z@ \raisebox{0.25\height}{\usebox\z@}% \endgroup } % https://tex.stackexchange.com/a/678998 \hook_gput_code:nnn { begindocument } { minimclass } { \NewCommandCopy\standarddashv\dashv \NewCommandCopy\standardvdash\vdash \RenewDocumentCommand{\dashv}{}{\mathrel{\mathpalette\raisesymbol\standarddashv}} \RenewDocumentCommand{\vdash}{}{\mathrel{\mathpalette\raisesymbol\standardvdash}} } \newcommand{\raisesymbol}[2]{% \begingroup \sbox\z@{$\m@th#1A$}% \sbox\tw@{$\m@th#1#2$}% \raisebox{\dimexpr(\ht\z@-\ht\tw@)/2}{\usebox{\tw@}}% \endgroup } \RequirePackage { tikz-cd } \tikzcdset { arrow~style = tikz, diagrams = { >={Stealth[round,length=3.4pt,width=6.15pt,inset=2.25pt]} } } \box_new:N \l__minimclass_xarrows_above_box \box_new:N \l__minimclass_xarrows_below_box \dim_new:N \l__minimclass_xarrows_length_dim \cs_new_protected:Nn \minimclass_xarrows_generic:nnnn % #3 = option of \tikz % #4 = edge of \draw { \hbox_set:Nn \l__minimclass_xarrows_below_box { \ensuremath { \scriptstyle #1 } } \hbox_set:Nn \l__minimclass_xarrows_above_box { \ensuremath { \scriptstyle #2 } } \dim_set:Nn \l__minimclass_xarrows_length_dim { \dim_eval:n { \dim_max:nn { \box_wd:N \l__minimclass_xarrows_below_box } { \box_wd:N \l__minimclass_xarrows_above_box } + 1em } } \mathrel { \tikz [ #3, line~width = .6pt, baseline = -.5ex, every~node/.style = { inner~sep = 0pt }, >={Stealth[round,length=3.4pt,width=6.15pt,inset=2.25pt]} ] \draw (0,0) #4 node [ below = 3pt ] { \box_use:N \l__minimclass_xarrows_below_box } node [ above = 2pt ] { \box_use:N \l__minimclass_xarrows_above_box } ( \l__minimclass_xarrows_length_dim ,0) ; } } \RenewDocumentCommand \xrightarrow { O{} m } { \minimclass_xarrows_generic:nnnn { #1 } { #2 } { -> } { -- } } \RenewDocumentCommand \xleftarrow { O{} m } { \minimclass_xarrows_generic:nnnn { #1 } { #2 } { <- } { -- } } \RenewDocumentCommand \xleftrightarrow { O{} m } { \minimclass_xarrows_generic:nnnn { #1 } { #2 } { <-> } { -- } } \RenewDocumentCommand \xhookrightarrow { O{} m } { \minimclass_xarrows_generic:nnnn { #1 } { #2 } {} { edge [ commutative~diagrams/hookrightarrow ] } } \RenewDocumentCommand \xhookleftarrow { O{} m } { \minimclass_xarrows_generic:nnnn { #1 } { #2 } {} { edge [ commutative~diagrams/hookleftarrow ] } } \RenewDocumentCommand \xmapsto { O{} m } { \minimclass_xarrows_generic:nnnn { #1 } { #2 } {} { edge [ commutative~diagrams/mapsto ] } } \NewDocumentCommand \xlongequal { O{} m } { \minimclass_xarrows_generic:nnnn { #1 } { #2 } {} { edge [ commutative~diagrams/equal ] } } \NewDocumentCommand \xtwoheadrightarrow { O{} m } { \minimclass_xarrows_generic:nnnn { #1 } { #2 } {} { edge [ commutative~diagrams/twoheadrightarrow ] } } \NewDocumentCommand \xtwoheadleftarrow { O{} m } { \minimclass_xarrows_generic:nnnn { #1 } { #2 } {} { edge [ commutative~diagrams/twoheadleftarrow ] } } \cs_new_protected:Nn \minimclass_xarrows_double_generic:nnnnnn % #3 = option of \tikz % #4 = edge 1 of \draw % #5 = edge 2 of \draw % #6 = sep/2 { \hbox_set:Nn \l__minimclass_xarrows_below_box { \ensuremath { \scriptstyle #1 } } \hbox_set:Nn \l__minimclass_xarrows_above_box { \ensuremath { \scriptstyle #2 } } \dim_set:Nn \l__minimclass_xarrows_length_dim { \dim_eval:n { \dim_max:nn { \box_wd:N \l__minimclass_xarrows_below_box } { \box_wd:N \l__minimclass_xarrows_above_box } + 1em } } \mathrel { \tikz [ #3, line~width = .6pt, baseline = -.5ex, every~node/.style = { inner~sep = 0pt }, >={Stealth[round,length=3.4pt,width=6.15pt,inset=2.25pt]} ] { \draw (0,#6) #4 node [ below = 4pt+#6 ] { \box_use:N \l__minimclass_xarrows_below_box } ( \l__minimclass_xarrows_length_dim ,#6) ; \draw (0,-#6) #5 node [ above = 3pt+#6 ] { \box_use:N \l__minimclass_xarrows_above_box } ( \l__minimclass_xarrows_length_dim ,-#6) ; } } } \NewDocumentCommand \xrightrightarrows { O{} m } { \minimclass_xarrows_double_generic:nnnnnn { #1 } { #2 } {} { edge [ commutative~diagrams/rightarrow ] } { edge [ commutative~diagrams/rightarrow ] } { .2em } } \NewDocumentCommand \xleftleftarrows { O{} m } { \minimclass_xarrows_double_generic:nnnnnn { #1 } { #2 } {} { edge [ commutative~diagrams/leftarrow ] } { edge [ commutative~diagrams/leftarrow ] } { .2em } } \hook_gput_code:nnn { begindocument/end } { minimclass } { \RenewDocumentCommand \twoheadrightarrow {} { \minimclass_xarrows_generic:nnnn { \mathchoice { \,\, } { \, } { } { } } {} {} { edge [ commutative~diagrams/twoheadrightarrow ] } } \RenewDocumentCommand \twoheadleftarrow {} { \minimclass_xarrows_generic:nnnn { \mathchoice { \,\, } { \, } { } { } } {} {} { edge [ commutative~diagrams/twoheadleftarrow ] } } } } } } } \char_set_catcode_active:n { `\· } \cs_new_protected:Npn · { \ensuremath\cdot } %%================================ %% Graphics %%================================ \RequirePackage { graphicx } \graphicspath { { images/ } } \RequirePackage { wrapfig2 } \RequirePackage { float } \RequirePackage { caption } \captionsetup { font = small } %%================================ %% Icing on the cake %%================================ \bool_if:NT \l__minimclass_fast_bool { \endinput } \sys_if_engine_luatex:TF { \RequirePackage { lua-widow-control } \lwcsetup { balanced } } { \PassOptionsToPackage { all } { nowidow } \RequirePackage { nowidow } } \sys_if_engine_xetex:T { \RequirePackage { regexpatch } \skip_new:N \g_minimclass_parfillskip_skip \xpatchcmd{\@trivlist}{\@flushglue}{\g_minimclass_parfillskip_skip}{}{} \hook_gput_code:nnn { begindocument } { minimclass } { \skip_gset:Nn \g_minimclass_parfillskip_skip { 0pt plus \dim_eval:n { \linewidth - 3em } } \skip_gset_eq:NN \parfillskip \g_minimclass_parfillskip_skip } } \endinput %% %% End of file `einfart/einfart.cls'. ```
NewerZeus commented 4 months ago

Sorry, it takes me too much time to read all these English articles. I did as what you say in overleaf, but it seems still can't work. The new log file is here. I also changed the class of your demo-cn to einfart and it can't compile. Is there still something wrong with the font? The log.txt 屏幕截图 2024-03-05 225411

Jinwen-XU commented 4 months ago

Sorry, perhaps I didn't write very clearly. You should still use jwjournal as the document class. Internally, it shall then import einfart as the base class, so simply placing the modified file einfart.cls in the directory (as you already did) would allow the changes to take effect. And in this case I believe that you could also remove the .ttc file, as it shall now (hopefully) use the Noto CJK fonts already installed in Overleaf's system.

If you feel more comfortable writing/reading in Chinese, we could do so. For me as well, I am certainly more fluent with Chinese than with English or French ;-)

Jinwen-XU commented 4 months ago

By the way, if you change to XeLaTeX, the compilation speed would be faster. For me, the same document that requires 7.5s to compile with LuaLaTeX would require only about 4.5s for XeLaTeX. Of course, to obtain better result, I would suggest that you compile the final version of your document locally with LuaLaTeX, which usually behaves better with word/line/page-breaking (but for Chinese document I think this matters less).

NewerZeus commented 4 months ago

那我说中文啦 ;-) 我用jwjournal的类型也试过了,还是不太行的样子。很奇怪的是,我在本地用Tex studio是可以编译成功的。overleaf却不太行,还是第一次遇见这种事情。 屏幕截图 2024-03-05 233155

Jinwen-XU commented 4 months ago

从日志文件来看,似乎没有遇到什么错误,只是单纯地超时了。在这种情况下我建议切换到 XeLaTeX 试一下,或许可以把时间控制在 20s 之内。如果还是不行的话,就麻烦你再把新的日志文件发给我看看吧。

另外,我认为 indentfirst 大概起不到什么效果。如果我没记错,日记文档里的默认设置是 \parindent = 0,也就是说即便使用了 indentfirst 也不会看到空两格的效果。出于各种页面元素位置相互协调的考虑,这个设置目前没有提供可供改动的选项,如果需要的话,在接下来的更新中我或许可以提供这么一个选项来设置段首缩进(其实这个选项已经存在了,只不过目前在 jwjournal.cls 里面被刻意禁用了)。

NewerZeus commented 4 months ago

是的,我编译的时候已经发现indentfirst不起作用了,正在想如何缩进来着,谢谢你的提醒。 我现在对overleaf已经不报什么期望了,感觉会比较麻烦,我准备把tex文件放在云盘上写,效果是一样的。真的很谢谢你的耐心回答。

Jinwen-XU commented 4 months ago

如果你十分希望使用缩进,可以在 jwjournal.cls 靠近开头的部分把两行 \PassOptionsToClass { use indent = false } { minimart } 删掉,另外在文档里指定 \documentclass 的时候不要使用 use style = classical 而是选择其他一些样式,或者直接删掉这个选项使用默认样式(这里所谓的“样式”并不会十分影响日记的设计,只是在指定标题或者数学定理等等不常出现在日记文档中的普通数学文档元素的样式)。

等之后有更多空闲时间的时候我会测试一下在 Overleaf 上的效果。这类模版编译速度慢一直是一个被诟病的问题,也是时候认真处理一下了。我会暂时保留这个 Issue,直到确保在 Overleaf 上能够正常使用为止。

NewerZeus commented 4 months ago

我按照你说的做了,将jwjournal.cls里的\PassOptionsToClass { use indent = false } { minimart }删除,并且删除了tex文档里的use style = classical,但仍然没有缩进。无论我加不加上\usepackage{indentfirst}都是这样。另外,提一个小建议,如图所示,日期所在的黄色横线和下面一行文字的左右两边没有对齐,因为我稍微有点强迫症的缘故,看起来有点难受,不知道能否调整。 屏幕截图 2024-03-06 131629 1709702860702

Jinwen-XU commented 4 months ago

需要删除的一共有两个位置,特别是对于中文文档,第二行才是真正起作用的部分(不好意思,昨天我以为这两行是一样的,没注意到最后一个单词的区别)。

image

关于标题栏,实际上对齐的部分是所有的文字,所以你会看到日期和下面文字的左端是对齐的;至于旁边的竖线(以及color entry 模式下的彩色块)只是为了起到强调效果,类似于看书时使用的书签或者贴纸。我认为如果把彩色块整体右移,把竖线和下方的文字对齐,远远地看过去就会感觉日期那一行的文字在所有的文字内容里显得有些参差不齐的。

image

(实际上所有元素的设计都是以文字对齐为基准的)

如果你依然希望修改这种显示效果的话,你应该可以在代码里找到一行 enlarge~left~by=-3.5mm, width=\textwidth+3.5mm,,把这里的 3.5mm 都改成 0mm 应该就可以了。不过你大概也需要相应地修改其他一些元素的设计——对此我其实是不太推荐的。

Jinwen-XU commented 4 months ago

另外,我不确定你怎么理解 indentfirst 的作用。实际上你应该很少有机会使用它,在我看来相应的调整应该是交给文档类的作者的。在传统的英文文档中,标题后面紧跟的那个自然段的段首是不进行缩进的,因此才会有 indentfirst,也就是标题后面紧跟的“第一个”自然段要缩进——这是中文文档的习惯。从另一个角度讲,在不使用 \section 这类标题指令的时候,这个宏包是不会有任何肉眼可见的效果的(普通的自然段本来也是会有段首缩进的,无论你是否使用这个宏包)。具体到当前日记的文档类,在 use indent = true 的情况下(也就是当你删除了那两行,并且没有使用 classical 样式的情况下),indentfirst 已经被默认载入了(因为即便在英文文档里我也更习惯所有段落都统一缩进),因此你大概是不必操心这个问题的。

NewerZeus commented 4 months ago

按照你的说法,我已经成功做到段落首行缩进了!!我认真去了解了indentfirst的作用,现在也能明白你所说的这些了。作为一个没用多久latex的新手,真的很感谢你的耐心指导。我目前就在使用这个模板写日记,我也非常期待这个模板之后的更新。