KTUGFaq
KTUG FAQ
FrontPage › RubyPackage
ÀϺ»¾î µî¿¡¼ µ¶À½ ´Þ ¼ö ÀÖµµ·Ï µµ¿ÍÁÖ´Â ½ºÅ¸ÀÏ ÆÄÀÏ
[ÆíÁý]
»ç¿ë¿¹ ¶
\documentclass[12pt]{article} \usepackage{hangul} \usepackage{ruby} \linespread{1.6} \renewcommand\rubysize{.5} \renewcommand\rubysep{-1.6ex} \begin{document} ÀÌ°ÍÀº ·çºñ ½ÃÇèÀÔ´Ï´Ù. ÇÑÀÚ \ruby{ùÓ}{ÇÑ}\ruby{í®}{ÀÚ} HanJa \ruby{ÇÑ}{han}\ruby{ÀÚ}{ja} Kanji \ruby{ùÓ}{kan}\ruby{í®}{ji} \end{document}
[ÆíÁý]
°£´ÜÇÑ Python Utility ¶
- ÀϺ»¾î¸¦ »ç¿ëÇÏ´Ù°¡ ruby ¸¦ ¾²±â À§Çؼ´Â ¿µ¹®ÀÚÆÇÀ¸·Î ¹Ù²Ù°í ´Ù½Ã ÀϺ»¾î·Î µ¹¾Æ¿À´Â °ÍÀÌ ±ÍÂú´Ù. ´ÙÀ½ÀÇ python ½ºÅ©¸³Æ®´Â '¡¢' ¹®ÀÚ¸¦ ÀÌ¿ëÇؼ ruby ·Î º¯È¯µÉ ºÎºÐÀ» Á¤ÀÇÇÏ°í, ±×°ÍÀ» ÀÚµ¿À¸·Î ruby{}{} ·Î ¹Ù²Ù¾îÁÖ´Â ½ºÅ©¸³Æ®ÀÌ´Ù.
# -*- coding: utf-8 -*- import string import codecs import re f = codecs.open("texSource.tex",'r','utf-8','strict') lines = map(lambda x: string.rstrip(x), f.readlines()) for line in lines: patt = re.compile(u'¡¢([^¡¢]+)¡¢¡¢([^¡¢]+)¡¢', re.UNICODE) print patt.sub(r'\\ruby{\1}{\2}', line)
- FROM : ¡¢ÛÜ¡¢¡¢ª·ªí¡¢
- TO : \ruby{ÛÜ}{ª·ªí}
# -*- coding: utf-8 -*- import string import codecs import re f = codecs.open("colors.tex",'r','utf-8','strict') lines = map(lambda x: string.rstrip(x), f.readlines()) for line in lines: if len(line) == 0 or line.startswith("\\") or line.startswith("%"): continue string1 = re.sub(ur'\\ruby{([^}]+)}{[^}]+}', r'\1', line) string2 = re.sub(ur'\\ruby{[^}]+}{([^}]+)}', r'\1', line) print "%s\n%s\n" % (string1, string2)