Re: [NTG-context] pinyin in context
post the result you want to have here so context developers can help you. 2009/3/11 Bill Long : > I input pinyin above Chinese character in bellow way: > --- > \documentclass{article} > \usepackage[overlap, CJK]{ruby} > \usepackage{pinyin} > \usepackage{CJK} > \begin{CJK*}{UTF8}{song} > \begin{document} >\renewcommand{\rubysep}{.3ex} >\renewcommand{\rubysize}{.5} > > \ruby{静}{\jing4} \ruby{夜}{\ye4}\ruby{思}{\si1} > > \end{CJK*} > \end{document} > > > but it has poor line break, > > Does contex support pinyin ? and how to implement? > > Thanks. > > -- > 卷829_3 【怀香炉峰道人】贯休 > > 常思峰顶叟,石窟土为床。日日先见日,烟霞多异香。 > 冥心同槁木,扫雪带微阳。终必相寻去,斯人不可忘。 > > > > ___ > If your question is of interest to others as well, please add an entry to the > Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://tex.aanhet.net > archive : https://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net > ___ > ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] pinyin in context
> \documentclass{article} You're not using ConTeXt at all. This is LaTeX code. Which is fine, but then this list is really not the place to ask your question :-) There are hyphenation patterns for pinyin that could be added to ConTeXt; it wouldn't be too much work, but you would need to specify how you would like ConTeXt to behave exactly. For that matter, the LaTeX syntax for pinyin (\ni2\hao3!) is not supported at the moment. Arthur ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] pinyin in context
thanks. I upload the target I wanna got in http://rhce4u.googlepages.com/yourpage%27stitle. On Wed, Mar 11, 2009 at 01:08:05PM +0800, Yue Wang wrote: > post the result you want to have here so context developers can help you. > > 2009/3/11 Bill Long : > > I input pinyin above Chinese character in bellow way: > > --- > > \documentclass{article} > > \usepackage[overlap, CJK]{ruby} > > \usepackage{pinyin} > > \usepackage{CJK} > > \begin{CJK*}{UTF8}{song} > > \begin{document} > >\renewcommand{\rubysep}{.3ex} > >\renewcommand{\rubysize}{.5} > > > > \ruby{静}{\jing4} \ruby{夜}{\ye4}\ruby{思}{\si1} > > > > \end{CJK*} > > \end{document} > > > > > > but it has poor line break, > > > > Does contex support pinyin ? and how to implement? > > > > Thanks. > > > > > > 常思峰顶叟,石窟土为床。日日先见日,烟霞多异香。 > > 冥心同槁木,扫雪带微阳。终必相寻去,斯人不可忘。 > > > > > > > > ___ > > If your question is of interest to others as well, please add an entry to > > the Wiki! > > > > maillist : ntg-context@ntg.nl / > > http://www.ntg.nl/mailman/listinfo/ntg-context > > webpage : http://www.pragma-ade.nl / http://tex.aanhet.net > > archive : https://foundry.supelec.fr/projects/contextrev/ > > wiki : http://contextgarden.net > > ___ > > > ___ > If your question is of interest to others as well, please add an entry to the > Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://tex.aanhet.net > archive : https://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net > ___ -- 卷146_2 【燕歌行】陶翰 请君留楚调,听我吟燕歌。家在辽水头,边风意气多。 出身为汉将,正值戎未和。雪中凌天山,冰上渡交河。 大小百馀战,封侯竟蹉跎。归来灞陵下,故旧无相过。 雄剑委尘匣,空门垂雀罗。玉簪还赵女,宝瑟付齐娥。 昔日不为乐,时哉今奈何。 ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] pinyin in context
On Wed, Mar 11, 2009 at 04:26:21PM +0100, Arthur Reutenauer wrote: > > \documentclass{article} > > You're not using ConTeXt at all. This is LaTeX code. Which is fine, > but then this list is really not the place to ask your question :-) Yes, just as I say the latex+cjk behave poor on line break, so I ask if context can do it, and do it better. > > There are hyphenation patterns for pinyin that could be added to > ConTeXt; it wouldn't be too much work, but you would need to specify how > you would like ConTeXt to behave exactly. For that matter, the LaTeX > syntax for pinyin (\ni2\hao3!) is not supported at the moment. > > Arthur Got it, then now I should try to manually do line break with latex+cjk. Thanks > ___ > If your question is of interest to others as well, please add an entry to the > Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://tex.aanhet.net > archive : https://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net > ___ -- 卷676_55 【野步】郑谷 翠岚迎步兴何长,笑领渔翁入醉乡。 日暮渚田微雨后,鹭鹚闲暇稻花香。 ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] pinyin in context
Dear Hans, Can you help check if you can implement a new feature of "pinyin" input in context? I upload the effect I wanna get in bellow link ( what I provide last time seemed doesn't work), Please check. http://picasaweb.google.com/lh/sredir?uname=weilai.long&target=ALBUM&id=5313243080349643217&authkey=Gv1sRgCJLO9v__gOPr_gE&feat=email Thanks in advance. On Wed, Mar 11, 2009 at 12:44:49PM +0800, Bill Long wrote: > I input pinyin above Chinese character in bellow way: > --- > \documentclass{article} > \usepackage[overlap, CJK]{ruby} > \usepackage{pinyin} > \usepackage{CJK} > \begin{CJK*}{UTF8}{song} > \begin{document} > \renewcommand{\rubysep}{.3ex} > \renewcommand{\rubysize}{.5} > > \ruby{静}{\jing4} \ruby{夜}{\ye4}\ruby{思}{\si1} > > \end{CJK*} > \end{document} > > > but it has poor line break, > > Does contex support pinyin ? and how to implement? > > Thanks. > -- 卷206_55 【送王牧往吉州谒王使君叔】李嘉祐 细草绿汀洲,王孙耐薄游。年华初冠带,文体旧弓裘。 野渡花争发,春塘水乱流。使君怜小阮,应念倚门愁。 ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] pinyin in context
Bill Long wrote: so http://picasaweb.google.com/lh/sredir?uname=weilai.long&target=ALBUM&id=5313243080349643217&authkey=Gv1sRgCJLO9v__gOPr_gE&feat=email is the result of \ruby{静}{\jing4} \ruby{夜}{\ye4}\ruby{思}{\si1} i.e. you want transliterations on top? is that \jing4 a convention or something specific for tex packages Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] pinyin in context
Am 15.03.2009 um 04:23 schrieb Bill Long: Dear Hans, Can you help check if you can implement a new feature of "pinyin" input in context? Is a lua based method a option for you? Here is a primitive converter, not perfect and could fail but it gives you a first impression, the missing 'ǎ' in the output is a font problem. \startluacode function commands.convertpinyin(text,number) local replaced local number = tonumber(number) if string.find(text,"a") or string.find(text,"e") then if number==1 then text = string.gsub(text,"a","ā") text = string.gsub(text,"e","ē") elseif number==2 then text = string.gsub(text,"a","á") text = string.gsub(text,"e","é") elseif number==3 then text = string.gsub(text,"a","ǎ") text = string.gsub(text,"e","ě") elseif number==4 then text = string.gsub(text,"a","à") text = string.gsub(text,"e","è") end replaced = false else replaced = true end while replaced do if number==1 then text = string.gsub(text,"i","ī") text = string.gsub(text,"o","ō") if string.find(text,"o") then else text = string.gsub(text,"u","ū") end text = string.gsub(text,"v","ǖ") elseif number==2 then text = string.gsub(text,"i","í") text = string.gsub(text,"o","ó") if string.find(text,"o") then else text = string.gsub(text,"u","ú") end text = string.gsub(text,"v","ǘ") elseif number==3 then text = string.gsub(text,"o","ǒ") text = string.gsub(text,"i","ǐ") if string.find(text,"o") then else text = string.gsub(text,"u","ǔ") end text = string.gsub(text,"u","ǔ") text = string.gsub(text,"v","ǚ") elseif number==4 then text = string.gsub(text,"o","ò") text = string.gsub(text,"i","ì") if string.find(text,"o") then else text = string.gsub(text,"u","ù") end text = string.gsub(text,"v","ǜ") end replaced = false end tex.sprint(tex.ctxcatcodes,text) end local letter = lpeg.R("az") local number = lpeg.R("09") local pinyin = lpeg.C(letter^1) * lpeg.C(number^0) / commands.convertpinyin local parser = (pinyin)^0 function commands.pinyin(str) parser:match(str) end \stopluacode \def\pinyin#1{\ctxlua{commands.pinyin([[#1]])}} \starttext \pinyin{ni2hao3} \pinyin{huai4} \stoptext Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] pinyin in context
The pinyin has 5 kind of tone for one pronunciation. As it's hard to input, and in CJK 1,2,3,4 are use to represent the tone, (the fifth is no special tone mark). In the book for children, the pinyin always show above the Chinese like the picture I upload. To make it show correctly is an good start, but if there are some tools to automatic add PinYin , it will be more attractive. In Chinese they do have the character which have multi pronunciation, but most of them only has single pronunciation, I can try to find out some dict to translate Chinese Character into PinYin if anyone can help integrate this convert tool into context. On Sun, Mar 15, 2009 at 06:20:34PM +0100, Wolfgang Schuster wrote: > > Am 15.03.2009 um 04:23 schrieb Bill Long: > >> Dear Hans, >> >> Can you help check if you can implement a new feature of "pinyin" >> input in context? > > > Is a lua based method a option for you? > > Here is a primitive converter, not perfect and could fail but it gives > you a first impression, the missing 'ǎ' in the output is a font problem. > > \startluacode > > function commands.convertpinyin(text,number) > local replaced > local number = tonumber(number) > if string.find(text,"a") or string.find(text,"e") then > if number==1 then > text = string.gsub(text,"a","ā") > text = string.gsub(text,"e","ē") > elseif number==2 then > text = string.gsub(text,"a","á") > text = string.gsub(text,"e","é") > elseif number==3 then > text = string.gsub(text,"a","ǎ") > text = string.gsub(text,"e","ě") > elseif number==4 then > text = string.gsub(text,"a","à") > text = string.gsub(text,"e","è") > end > replaced = false > else > replaced = true > end > while replaced do > if number==1 then > text = string.gsub(text,"i","ī") > text = string.gsub(text,"o","ō") > if string.find(text,"o") then else text = > string.gsub(text,"u","ū") end > text = string.gsub(text,"v","ǖ") > elseif number==2 then > text = string.gsub(text,"i","í") > text = string.gsub(text,"o","ó") > if string.find(text,"o") then else text = > string.gsub(text,"u","ú") end > text = string.gsub(text,"v","ǘ") > elseif number==3 then > text = string.gsub(text,"o","ǒ") > text = string.gsub(text,"i","ǐ") > if string.find(text,"o") then else text = > string.gsub(text,"u","ǔ") end > text = string.gsub(text,"u","ǔ") > text = string.gsub(text,"v","ǚ") > elseif number==4 then > text = string.gsub(text,"o","ò") > text = string.gsub(text,"i","ì") > if string.find(text,"o") then else text = > string.gsub(text,"u","ù") end > text = string.gsub(text,"v","ǜ") > end > replaced = false > end > tex.sprint(tex.ctxcatcodes,text) > end > > local letter = lpeg.R("az") > local number = lpeg.R("09") > > local pinyin = lpeg.C(letter^1) * lpeg.C(number^0) / > commands.convertpinyin > > local parser = (pinyin)^0 > > function commands.pinyin(str) > parser:match(str) > end > > \stopluacode > > \def\pinyin#1{\ctxlua{commands.pinyin([[#1]])}} > > \starttext > > \pinyin{ni2hao3} > \pinyin{huai4} > > \stoptext > > Wolfgang > > ___ > If your question is of interest to others as well, please add an entry to the > Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://tex.aanhet.net > archive : https://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net > ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] pinyin in context
> To make it show correctly is an good start, but if there are some > tools to automatic add PinYin , it will be more attractive. It is definitely possible to do that in Lua, given the appropriate data. The Unihan database could be a start. We also need to find a way to report if a character has several possible pronounciations, and let the user input the correct one in the given context. Arthur ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] pinyin in context
Am 16.03.2009 um 17:17 schrieb Bill Long: The pinyin has 5 kind of tone for one pronunciation. As it's hard to input, and in CJK 1,2,3,4 are use to represent the tone, (the fifth is no special tone mark). In the book for children, the pinyin always show above the Chinese like the picture I upload. A solution like can be easy integrated in a ruby command because you need only a command parameter for the ruby text, e.g. \setupruby[command=\pinyin] but you're looking for something like the translate module. To make it show correctly is an good start, but if there are some tools to automatic add PinYin , it will be more attractive. In Chinese they do have the character which have multi pronunciation, but most of them only has single pronunciation, I can try to find out some dict to translate Chinese Character into PinYin if anyone can help integrate this convert tool into context. If you can provide such a list Hans can add the information to char- def.lua, for the moment you have to rely on my \pinyin command, I have now written a new version on a word macro I found. Wolfgang \startluacode function commands.pinyin(str) str = string.gsub(str,"r1","1r") str = string.gsub(str,"r2","2r") str = string.gsub(str,"r3","3r") str = string.gsub(str,"r4","4r") str = string.gsub(str,"r5","5r") str = string.gsub(str,"ng1","1ng") str = string.gsub(str,"ng2","2ng") str = string.gsub(str,"ng3","3ng") str = string.gsub(str,"ng4","4ng") str = string.gsub(str,"ng5","5ng") str = string.gsub(str,"n1","1n") str = string.gsub(str,"n2","2n") str = string.gsub(str,"n3","3n") str = string.gsub(str,"n4","4n") str = string.gsub(str,"n1","5n") str = string.gsub(str,"ai1","a1i") str = string.gsub(str,"ai2","a2i") str = string.gsub(str,"ai3","a3i") str = string.gsub(str,"ai4","a4i") str = string.gsub(str,"ai5","a5i") str = string.gsub(str,"ei1","e1i") str = string.gsub(str,"ei2","e2i") str = string.gsub(str,"ei3","e3i") str = string.gsub(str,"ei4","e4i") str = string.gsub(str,"ei5","e5i") str = string.gsub(str,"ao1","a1o") str = string.gsub(str,"ao2","a2o") str = string.gsub(str,"ao3","a3o") str = string.gsub(str,"ao4","a4o") str = string.gsub(str,"ao5","a5o") str = string.gsub(str,"ou1","o1u") str = string.gsub(str,"ou2","o2u") str = string.gsub(str,"ou3","o3u") str = string.gsub(str,"ou4","o4u") str = string.gsub(str,"ou5","o5u") str = string.gsub(str,"uu1","v1") str = string.gsub(str,"uu2","v2") str = string.gsub(str,"uu3","v3") str = string.gsub(str,"uu4","v4") str = string.gsub(str,"uu","ü") -- is this correct? str = string.gsub(str,"o1","ō") str = string.gsub(str,"o2","ó") str = string.gsub(str,"o3","ǒ") str = string.gsub(str,"o4","ò") str = string.gsub(str,"e1","ē") str = string.gsub(str,"e2","é") str = string.gsub(str,"e3","ě") str = string.gsub(str,"e4","è") str = string.gsub(str,"i1","ī") str = string.gsub(str,"i2","í") str = string.gsub(str,"i3","ǐ") str = string.gsub(str,"i4","ì") str = string.gsub(str,"u1","ū") str = string.gsub(str,"u2","ú") str = string.gsub(str,"u3","ǔ") str = string.gsub(str,"u4","ù") str = string.gsub(str,"v1","ǖ") str = string.gsub(str,"v2","ǘ") str = string.gsub(str,"v3","ǚ") str = string.gsub(str,"v4","ǜ") str = string.gsub(str,"a1","ā") str = string.gsub(str,"a2","á") str = string.gsub(str,"a3","ǎ") str = string.gsub(str,"a4","à") tex.sprint(tex.ctxcatcodes,str) end \stopluacode \def\pinyin#1{\ctxlua{commands.pinyin([[#1]])}} \starttext \definedfont[name:arialunicodems*default] \pinyin{ni2hao3} \pinyin{huai4} \stoptext ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] pinyin in context
> If you can provide such a list Hans can add the information to > char-def.lua, As I mentioned, the Unihan database has a very comprehensive list (probably too comprehensive). I made it into a Lua list, but need to polish it (sorry, 500+ Kb, not attaching). It can be downloaded from http://github.com/reutenauer/luapinyin then tools/pinyins.lua We will need the \pinyin command anyway, for the cases where there is an ambiguity. Arthur ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] pinyin in context
On Mon, Mar 16, 2009 at 09:23:50PM +0100, Wolfgang Schuster wrote: > > Am 16.03.2009 um 17:17 schrieb Bill Long: > >> The pinyin has 5 kind of tone for one pronunciation. As it's hard to >> input, and in CJK 1,2,3,4 are use to represent the tone, (the fifth >> is no special tone mark). >> >> In the book for children, the pinyin always show above the Chinese >> like the picture I upload. > > A solution like can be easy integrated in a ruby command because > you need only a command parameter for the ruby text, > e.g. \setupruby[command=\pinyin] but you're looking for something > like the translate module. In fact, 2 features I need, 1. the easy way to support PinYin, both input and the format, As I mentioned, I hope the pinyin can be placed over the Chinese character it represented automatically with some environment or so. 2. automatic convert/add pinyin to Chinese Character , now I use sed to make, but I still hope there are some more easy way. > >> To make it show correctly is an good start, but if there are some >> tools to automatic add PinYin , it will be more attractive. In Chinese >> they do have the character which have multi pronunciation, but most of >> them only has single pronunciation, I can try to find out some dict to >> translate Chinese Character into PinYin if anyone can help integrate >> this convert tool into context. > > If you can provide such a list Hans can add the information to char- > def.lua, > for the moment you have to rely on my \pinyin command, I have now > written > a new version on a word macro I found. > > Wolfgang > > \startluacode > > function commands.pinyin(str) > str = string.gsub(str,"r1","1r") > str = string.gsub(str,"r2","2r") > str = string.gsub(str,"r3","3r") > str = string.gsub(str,"r4","4r") > str = string.gsub(str,"r5","5r") > str = string.gsub(str,"ng1","1ng") > str = string.gsub(str,"ng2","2ng") > str = string.gsub(str,"ng3","3ng") > str = string.gsub(str,"ng4","4ng") > str = string.gsub(str,"ng5","5ng") > str = string.gsub(str,"n1","1n") > str = string.gsub(str,"n2","2n") > str = string.gsub(str,"n3","3n") > str = string.gsub(str,"n4","4n") > str = string.gsub(str,"n1","5n") > str = string.gsub(str,"ai1","a1i") > str = string.gsub(str,"ai2","a2i") > str = string.gsub(str,"ai3","a3i") > str = string.gsub(str,"ai4","a4i") > str = string.gsub(str,"ai5","a5i") > str = string.gsub(str,"ei1","e1i") > str = string.gsub(str,"ei2","e2i") > str = string.gsub(str,"ei3","e3i") > str = string.gsub(str,"ei4","e4i") > str = string.gsub(str,"ei5","e5i") > str = string.gsub(str,"ao1","a1o") > str = string.gsub(str,"ao2","a2o") > str = string.gsub(str,"ao3","a3o") > str = string.gsub(str,"ao4","a4o") > str = string.gsub(str,"ao5","a5o") > str = string.gsub(str,"ou1","o1u") > str = string.gsub(str,"ou2","o2u") > str = string.gsub(str,"ou3","o3u") > str = string.gsub(str,"ou4","o4u") > str = string.gsub(str,"ou5","o5u") > str = string.gsub(str,"uu1","v1") > str = string.gsub(str,"uu2","v2") > str = string.gsub(str,"uu3","v3") > str = string.gsub(str,"uu4","v4") > str = string.gsub(str,"uu","ü") -- is this correct? it's correct, although this character maybe rarely/never been used with this tone. > str = string.gsub(str,"o1","ō") > str = string.gsub(str,"o2","ó") > str = string.gsub(str,"o3","ǒ") > str = string.gsub(str,"o4","ò") > str = string.gsub(str,"e1","ē") > str = string.gsub(str,"e2","é") > str = string.gsub(str,"e3","ě") > str = string.gsub(str,"e4","è") > str = string.gsub(str,"i1","ī") > str = string.gsub(str,"i2","í") > str = string.gsub(str,"i3","ǐ") > str = string.gsub(str,"i4","ì") > str = string.gsub(str,"u1","ū") > str = string.gsub(str,"u2","ú") > str = string.gsub(str,"u3","ǔ") > str = string.gsub(str,"u4","ù") > str = string.gsub(str,"v1","ǖ") > str = string.gsub(str,"v2","ǘ") > str = string.gsub(str,"v3","ǚ") > str = string.gsub(str,"v4","ǜ") > str = string.gsub(str,"a1","ā") > str = string.gsub(str,"a2","á") > str = string.gsub(str,"a3","ǎ") > str = string.gsub(str,"a4","à") > tex.sprint(tex.ctxcatcodes,str) > end > > \stopluacode > > \def\pinyin#1{\ctxlua{commands.pinyin([[#1]])}} > > \starttext > > \definedfont[name:arialunicodems*default] > > \pinyin{ni2hao3} > \pinyin{huai4} > > \stoptext > > ___ > If your question is of interest to others as well, please add an entry to the > Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://tex.aanhet.net > archive : https://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net >
Re: [NTG-context] pinyin in context
wolf-newjap.tex Description: Binary data wolf-jap.tex Description: Binary data js-ruby.tex Description: Binary data Am 17.03.2009 um 22:22 schrieb Bill Long: In fact, 2 features I need, 1. the easy way to support PinYin, both input and the format, As I mentioned, I hope the pinyin can be placed over the Chinese character it represented automatically with some environment or so. I attached a few old files I used to simple ruby texts but none of them is a perfect solution, if you get a proper macro it should support complex and simple ruby. 2. automatic convert/add pinyin to Chinese Character , now I use sed to make, but I still hope there are some more easy way. Arthur list can be used for this but you still ned markup to show which characters need reading and then you could also use a ruby command. Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___