CTeX-org / ctex-kit

Macro Packages and Scripts for Chinese TeX users
965 stars 124 forks source link

Strange punctuation spacing for some styles. #664

Closed BenjaminGalliot closed 1 year ago

BenjaminGalliot commented 1 year ago

(Sorry to use English.)

My multilingual documents (all including Chinese in Kai style) had their spacing changed when I upgraded my Linux distribution (Ubuntu 22.04 to 23.04, so Texlive 2021 to Texlive 2022), which may have changed the versions of some Texlive dependencies...

More generally, now, the default spacing (quanming, I assume) usually pushes punctuation to the right, almost sometimes touching the next character, which was not the case (or much less) before my update. The other styles I've tested don't seem to have this problem...

Here are 2 examples compared:

Before: before 1

After: now 1

Before: before 2

After: now 2

Here is a minimal working example (my document is normally on 2 columns, by the way):

\documentclass{book}

\RequirePackage[paperwidth=184mm, paperheight=267mm, top=20mm, bottom=15mm, inner=15mm, outer=20mm]{geometry}
\RequirePackage{ctex}
\RequirePackage{multicol}
\setlength{\columnsep}{1.5cm}
\setCJKfamilyfont{cmn}{AR PL UKai CN}
\RenewDocumentCommand \CJKrmdefault {} {cmn}

\begin{document}

\begin{multicols}{3}
是矮小的树种,比人高不出多少。树干是灰色的,有好像快要脱落的树皮。当年开花,马上结果,果实成熟后是黑色的,好吃,很甜。果实里有又小又多的种子,是很嫩的,叶子小而多。山上山下都能生长。
是矮小的树种,比人高不出多少。树干是灰色的,有好像快要脱落的树皮。当年开花,马上结果,果实成熟后是黑色的,好吃,很甜。果实里有又小又多的种子,是很嫩的,叶子小而多。山上山下都能生长。
是矮小的树种,比人高不出多少。树干是灰色的,有好像快要脱落的树皮。当年开花,马上结果,果实成熟后是黑色的,好吃,很甜。果实里有又小又多的种子,是很嫩的,叶子小而多。山上山下都能生长。
是矮小的树种,比人高不出多少。树干是灰色的,有好像快要脱落的树皮。当年开花,马上结果,果实成熟后是黑色的,好吃,很甜。果实里有又小又多的种子,是很嫩的,叶子小而多。山上山下都能生长。
是矮小的树种,比人高不出多少。树干是灰色的,有好像快要脱落的树皮。当年开花,马上结果,果实成熟后是黑色的,好吃,很甜。果实里有又小又多的种子,是很嫩的,叶子小而多。山上山下都能生长。
\end{multicols}

\end{document}

MWE

I don't know what has changed in less than a year, but my code has stayed the same, and the current state of punctuation spacing for Kai style, at least in my way of doing things, looks significantly less aesthetically pleasing than it did before...

What should I correct to achieve a better result (more centered punctuation)? More generally, is there a way to adjust to center the punctuation, or shift it more to the right or left? What is considered the best style in Chinese?

Edit: I just manually installed Texlive 2021, and it confirms that there was an unfortunate change in Texlive 2022, still present in Texlive 2023, was it intended?

The punctuation in the 2021 version was not perfect (tight lines seem to cause more problems with centering...), and I was wondering if there was a simple way to always center the punctuation (in accordance with the font, of course) regardless of the space available.

Edit 2: It seems the problems is between Ctex 2.5.8 and 2.5.10…

Edit 3: I use LuaLaTeX.

RadioNoiseE commented 1 year ago

(First, my English is really poor)

For the unexpected change, I have actually no idea. You may need to provide some basic informations, for instance which engine you use to compile your document (LuaLaTeX, XeLaTeX or pdfLaTeX).

That’s because the macro packages used to support punctuation kerning is different, for LuaLaTeX it’s by default chinese-jfm by tanikihee.

Anyway, if you want to center the punctuations in your Traditional Chinese font under LuaLaTeX, then you may modify your preamble to

\documentclass{book}

\RequirePackage[paperwidth=184mm, paperheight=267mm, top=20mm, bottom=15mm, inner=15mm, outer=20mm]{geometry}
\RequirePackage[punct=eva/trad]{ctex}
\RequirePackage{multicol}
\setlength{\columnsep}{1.5cm}
\setCJKfamilyfont{cmn}{AR PL UKai CN}
\\RenewDocumentCommand \CJKrmdefault {} {cmn}

It works because we changed to a jfm which supports Traditional Chinese. Here I used Eva-jfm (it’s written by me and should be in the 2023 texlive/miktex but recommended to manually install it using tlmgr to get the latest one, it offers about ten more features BTW). Chinese-jfm by tanikihee also supports tc, by replacing the eva/trad with zh_TW/quanjiao.

Traditional Chinese and Simplified Chinese have punctuations very different positioned, so the default setting in your example works properly with simplified Chinese and should not be considered as a bug.

image (The result) image (The source code)

Remember to compile using LuaLaTeX

RadioNoiseE commented 1 year ago

Update 5/27

I was just aware of that luatexja automatically patches multicol, so it should be tested with the native two column instead:image I just now made a check and found out that luatexja does not((

BenjaminGalliot commented 1 year ago

Thanks for the reply!

I was indeed using LuaLaTeX.

I'm well aware that punctuation differs well between traditional and simplified Chinese, but the style (kai, in particular) and fonts seem to complicate all this... As you know, my example uses simplified Chinese, but the style of the font is kai and seems to force itself a certain type of punctuation (usually centered).

For example, if I haven't missed any particular settings, AR PL UKai fonts all center punctuation (TW, HK and CN!), while AR PL KaitiM fonts differentiate well (Big5: centered; GB: not centered, as expected).

Speaking of double-column mode, I notice that eva/trad prevents end-of-line punctuation from protruding slightly into the margin, unlike eva/smpl, interesting!

Thanks for the link to eva-JFM, nice work, I'll keep this and read it more carefully soon!

At least eva/trad solved my problem, it seems to take up a bit more space with punctuation (compared to version 2.5.8), but at least it's consistently well centered!

Thank you very much!

RadioNoiseE commented 1 year ago

At least eva/trad solved my problem, it seems to take up a bit more space with punctuation (compared to version 2.5.8), but at least it's consistently well centered!

You can also try zh_TW/quanjiao to see if it fits your needs. Eva-Jfm has some special glue-stretch-shrink priority settings.

BenjaminGalliot commented 1 year ago

Oh, thank you! zh_TW/quanjiao is closer to the original rendering I had. So I'll show both renderings to the author, since both are interesting!

RadioNoiseE commented 1 year ago

This issue may be closed now. Any further issues should be opened at the JFM's repo.

(要不谁来关一下?