You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently working on an automatically generated document using LuaLaTeX. I've encountered an issue where there isn't an automatic space between CJK and Latin script characters, which affects the readability of mixed-language texts. For example:
中文
…français
The ellipsis (…) directly follows the Chinese characters without any space. I would like to have an automatic space inserted between CJK and Latin characters whenever a line break occurs between them.
Is there a known method or a recommended practice within LuaLaTeX environment to handle this spacing automatically? Any guidance or workaround to ensure proper spacing between these character sets would be greatly appreciated.
Thank you in advance for your help!
MWE:
\documentclass{article}
\RequirePackage[french]{babel}
\RequirePackage{ctex}
\babelprovide[import=zh-Hans]{cmn}
\setCJKfamilyfont{cmn}{AR PL UKai CN}
\setmainfont{EB Garamond}
\RenewDocumentCommand\CJKrmdefault {} {cmn}
\babelfont[french]{rm}{EB Garamond}
\NewDocumentCommand\scriptcjk {} {\ltjsetparameter{jacharrange={-1, +2, +3, -4, -5, +6, +7, -8, +9}}}
\NewDocumentCommand\scriptlatin {} {\ltjsetparameter{jacharrange={-1, -2, -3, -4, -5, +6, +7, -8, -9}}}
\NewDocumentCommand\tfra { m } {\foreignlanguage{french}{\scriptlatin#1}}
\NewDocumentCommand\tcmn { m } {\foreignlanguage{cmn}{\scriptcjk#1}}
\frenchsetup{og=«, fg=», AutoSpacePunctuation=true} % Can be turned off if necessary.\begin{document}
\scriptlatin\selectlanguage{french}
中文 …français % Reference.
中文…français % Expected.
中文
…français % Not wanted.
中文\
…français % Workaround, but I try to find better.
---------
% It should also work with commands around.\tcmn{中文} \tfra{…français}
\tcmn{中文}\tfra{…français}
\tcmn{中文}
\tfra{…français}
\tcmn{中文}\\tfra{…français}
---------
% Without punctuation.\tcmn{中文} \tfra{français}
\tcmn{中文}\tfra{français}
\tcmn{中文}
\tfra{français}
\tcmn{中文}\\tfra{français}
---------
% Various behaviours depending on punctuation?
中文
\tfra{«français}
中文\ \tfra{«français}
中文
\tfra{"français}
中文\ \tfra{"français}
中文
\tfra{(français}
中文\ \tfra{(français}
中文
\tfra{[français}
中文\ \tfra{[français}
中文
\tfra{-français}
中文\ \tfra{-français}
中文
\tfra{–français}
中文\ \tfra{–français}
中文
\tfra{—français}
中文\ \tfra{—français}
\end{document}
Screenshot:
My workaround of manually inserting spaces (\ ) is not ideal. I am looking for a more elegant solution that would automatically handle these spaces, particularly after a line break.
In addition to the main issue of spacing after line breaks, I've also noticed that the behavior changes depending on the punctuation used. Is it the intended behaviour? Is it possible to customize it?
Thank you very much.
The text was updated successfully, but these errors were encountered:
(Sorry for using English!)
Hello,
I'm currently working on an automatically generated document using LuaLaTeX. I've encountered an issue where there isn't an automatic space between CJK and Latin script characters, which affects the readability of mixed-language texts. For example:
The ellipsis (…) directly follows the Chinese characters without any space. I would like to have an automatic space inserted between CJK and Latin characters whenever a line break occurs between them.
Is there a known method or a recommended practice within LuaLaTeX environment to handle this spacing automatically? Any guidance or workaround to ensure proper spacing between these character sets would be greatly appreciated.
Thank you in advance for your help!
MWE:
Screenshot:
My workaround of manually inserting spaces (
\
) is not ideal. I am looking for a more elegant solution that would automatically handle these spaces, particularly after a line break.In addition to the main issue of spacing after line breaks, I've also noticed that the behavior changes depending on the punctuation used. Is it the intended behaviour? Is it possible to customize it?
Thank you very much.
The text was updated successfully, but these errors were encountered: