Skip to content

Instantly share code, notes, and snippets.

@zr-tex8r
Created October 28, 2020 15:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zr-tex8r/53915d587773f17da10cfecdf7e47f23 to your computer and use it in GitHub Desktop.
Save zr-tex8r/53915d587773f17da10cfecdf7e47f23 to your computer and use it in GitHub Desktop.
LaTeX: To combine ul-lua and LuaTeX-ja
% LuaLaTeX document
\documentclass[a6paper]{ltjsarticle}%for Japanese
\usepackage{lua-ul}
\begin{document}% mix of Japanese and English phrases
色は匂へど、
\underLine{散りぬるを(alas)、
「我が世」誰ぞ、“常”ならむ?
有為の奥山今日越えて(go on!)、
浅き夢見じwow yeah}酔ひもせず……。
\end{document}
@zr-tex8r
Copy link
Author

lua-ul-japanese-1

Got:

lua-ul-japanese-1-1

Expected:

lua-ul-japanese-1-2

@zr-tex8r
Copy link
Author

The document class ltjsarticle loads the package luatexja for proper typesetting of the Japanese language, which involves the insertion of glues between characters. I’m afraid luatexja is huge and highly complicated, but the issue can be as simple as the matter of execution order of callbacks.

@zauguin
Copy link

zauguin commented Oct 28, 2020

The document class ltjsarticle loads the package luatexja for proper typesetting of the Japanese language, which involves the insertion of glues between characters. I’m afraid luatexja is huge and highly complicated, but the issue can be as simple as the matter of execution order of callbacks.

The callbacks are executed in the right order, but luatexja sets the new glue attributes to the attributes active at the end of the paragraph and not at the point of the insertion. (That also means that if the \par is in the \underLine argument, you get the reverse issue: The glue is underlined even if it shouldn't be.)

That's straight-forward to fix, but it has to happen in luatexja. I'll prepare a patch for them.

@cereda
Copy link

cereda commented Oct 29, 2020

ooh a fix 🦆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment