[luatex] getting previous glyphs

Ulrike Fischer luatex at nililand.de
Thu Dec 4 10:40:06 CET 2014

Am Thu, 4 Dec 2014 11:25:58 +0900 schrieb Norbert Preining:

> Hi everyone,
> I am trying to write some macros to convert Aozora (Japanese literature
> site) formatted text to something I can feed through luatex.
> In the Aozora format, ruby-annotations (the reading of Kanji written
> on top of the Kanji) are written *after* the word, like in
> 	nnnKKK<uuuuu>
> where 
> 	nnn
> 		are some *non* Kanji (Hiragana, Roman, etc)
> 	KKK
> 		are Kanji
> 	< >
> 		are Japanese angle brakets
> 	uuuu
> 		reading in Hiragana
> TO make things worse, if there is the need to separate some Kanjis
> from each other, then a | (in Jpanaese version) is added:
> 	KK|KKK<uuuu>
> in this example all the K's are Kanji, but the ruby should only
> be applied to the group of three K after the |
> Now, luatexja, in particalur luatexja-ruby, provides a handy
> \ruby{KKK}{uuuu} macro, but for getting the KKK I have to read
> backwards somehow.
> As we are already in luatex, do you have any idea how to achieve
> this easily?

Couldn't you simply surround every KKK-Block by some command
\checkforruby{KKK} and define this command so that it looks for an
optional argument in <..>-braces? This should be easy with xparse.

Ulrike Fischer 

More information about the luatex mailing list