KTUGFaq

KTUG FAQ

·Î±×ÀÎ:
ºñ¹Ð¹øÈ£:
°¡ÀÔ
Lend money to a bad debtor and he will hate you.
yfonts&value=MixedMapPCTeX&value=EPS±×¸²ÆíÁýCygWin-teTeXKC2006/óÀ½»ç¿ëÀÚKarnes/2008-12&value=¸í·ÉÇà › LittleTree/ReadingTeXbook/2006-08
Aug 29, 2006
The @ convention
Submitted by ÀÛÀº³ª¹« @ 08-29 [10:32 pm]
TeXbyTopic¿¡ ¾²¿©Á® Àֱ⸦,

Anyone who has ever browsed through either the plain format or the LaTeX format will have noticed that a lot of control sequences contain an 'at' sign: @. These are control sequences that are meant to be inaccessible to the ordinary user.

Near the beginning of the format files the instruction
\catcode¡®@=11
occurs, making the at sign into a letter, meaning that it can be used in control sequences. Somewhere near the end of the format definition the at sign is made 'other' again:
\catcode¡®@=12
Now why is it that users cannot call a control sequence with an at sign directly, although they can call macros that contain lots of those 'at-definitions'? The reason is that the control sequences containing an @ are internalized by TeX at definition time, after which they are a token, not a string of characters. Macro expansion then just inserts such tokens, and at that time the category codes of the constituent characters do not matter any more.

TeXbookÀÌ ¸»Çϱ⸦,

\uppercaseÀÇ Áø½Ç
Submitted by ÀÛÀº³ª¹« @ 08-29 [11:16 am]
ÅØÀÌ »ç¿ëÇÏ´Â 256°³ÀÇ ¹®ÀÚµé °¢°¢Àº \uccode, \lccode¶ó ºÒ¸®´Â µÎ°³ÀÇ °ªÀ» °¡Áö°í ÀÖ½À´Ï´Ù. ±×¸®°í ±× µÎ°³ÀÇ °ªÀº \catcode¿¡ ÀÇÇؼ­ ±× ¹®ÀÚÀÇ catcode°¡ ¹Ù²î´Â °Íó·³ \uppercase ȤÀº \lowercase¿¡ ÀÇÇؼ­ \uccode, \lccodeÀÇ °ªÀ» º¯°æ½Ãų ¼ö ÀÖ½À´Ï´Ù.

¹®ÀÚ´Â (¹®ÀÚÄÚµå, Ä«Å×°í¸®ÄÚµå)ÀÇ ½ÖÀ¸·Î ÀÌ·ç¾îÁ® ÀÖ´Ù°í ÇÕ´Ï´Ù. ¿¹¸¦µé¾î ¼Ò¹®ÀÚ ¾ËÆĺª "b"ÀÇ ¹®ÀÚÄÚµå 98ÀÌ°í Ä«Å×°í¸®ÄÚµå´Â 11ÀÔ´Ï´Ù. b=(98,11). ±×¸®°í INITEXÀÌ ½ÃÀÛÇÒ¶§, ¾ËÆĺª ´ë¼Ò¹®ÀÚ 52ÀÚ¸¦ Á¦¿ÜÇÏ°í´Â \uccode ¿Í \lccodeÀÇ °ªÀº ¸ðµÎ 0ÀÔ´Ï´Ù. a~z¿Í A~ZÀÇ \uccode´Â A~ZÀÌ°í, \lccode´Â a~zÀÔ´Ï´Ù.

\uppercase°¡ ÇÏ´Â ÀÏÀº ÁÖ¾îÁø ¹®ÀÚÅäÅ«ÀÇ ¹®ÀÚÄڵ带 ±× ¹®ÀÚÄÚµåÀÇ \uccode °ªÀ¸·Î ¹Ù²Ù´Â ÀÏÀ» ÇÕ´Ï´Ù. ¿¹¸¦µé¸é, ¼Ò¹®ÀÚ b=(¹®ÀÚÄÚµå, Ä«Å×°í¸®ÄÚµå)=(98, 11)ÀÔ´Ï´Ù. ±×·±µ¥ \uppercase{b} Çϸé bÀÇ ¹®ÀÚÄڵ尡 bÀÇ \uccodeÀÎ B·Î ¹Ù²î¹Ç·Î (66,11)ÀÌ µÇ°í µû¶ó¼­ ´ë¹®ÀÚ B·Î º¸ÀÌ°Ô µË´Ï´Ù.

¿©±â¼­ ´«¿©°Ü ºÁ¾ß ÇÒ °ÍÀº \uppercase¿¡ ÀÇÇؼ­ ¹®ÀÚÀÇ ¹®ÀÚÄڵ常 ¹Ù²î¾úÁö, Ä«Å×°í¸®ÄÚµå´Â ¹Ù²îÁö ¾Ê´Â´Ù´Â °ÍÀ» ¾Ë ¼ö ÀÖ½À´Ï´Ù. ÀÌ·¯ÇÑ Æ¯¼ºÀ» ÀÌ¿ëÇÏ¸é ´ë´ÜÈ÷ Àç¹ÌÀÖ´Â °ÍÀ» ÇÒ ¼ö ÀÖ½À´Ï´Ù.
\uccode`1=`b \uppercase{1}
À§¿¡¼­ "1"ÀÇ \uccode¸¦ "b"·Î Çß½À´Ï´Ù. µû¶ó¼­ \uppercase{1} Çϸé "b"°¡ µÇ´Âµ¥, Àç¹ÌÀÖ´Â °ÍÀº À§ °úÁ¤À» ÅëÇؼ­ ¸¸µé¾îÁø, ¿ì¸® ´«¿¡ º¸ÀÌ´Â ¼Ò¹®ÀÚ "b"ÀÇ Ä«Å×°í¸®ÄÚµå´Â 11ÀÌ ¾Æ´Ñ, ¿ø·¡ "1"ÀÇ ±×°ÍÀÎ 12¶ó´Â Á¡ÀÔ´Ï´Ù.
{\uccode¡®1=¡®i \uccode¡®2=¡®f \uppercase{\gdef\if@12{} }} % ¡®if¡¯ is required
À§ °úÁ¤À» ÅëÇؼ­ ¿ì¸®´«¿¡ º¸ÀÌ´Â \if@if ¿¡¼­ µÚÀÇ "if"ÀÇ Ä«Å×°í¸®ÄÚµå´Â 12°¡ µË´Ï´Ù. ¿Ö³ÄÇÏ¸é ¼ýÀÚ 1°ú 2ÀÇ Ä«Å×°í¸®Äڵ尡 12À̱⠶§¹®ÀÔ´Ï´Ù. ±×·¸´Ù¸é À§¿¡¼­ Á¤ÀÇÇÑ \if@ ¸ÅÅ©·Î°¡ ÇÏ´Â ÀÏÀº Ä«Å×°í¸®ÄÚµå 12ÀÎ ¹®ÀÚ "if"¸¦ Àâ¾Æ¸Ô´Â ÀÏÀ» ÇÕ´Ï´Ù. ±×·¸´Ù¸é, ÀÌÁ¦´Â ¸ðµç °ÍÀÌ ¸íÈ®ÇØ Á³½À´Ï´Ù.
\def\@if#1#2{\csname\expandafter\if@\string#1#2\endcsname}
À§¿¡¼­ #1À» \iffoo, #2¸¦ true¶ó°í ÇսôÙ. ±×·¯¸é \string\iffoo¿¡ ÀÇÇؼ­ \,i,f,f,o,oÀÇ Ä«Å×°í¸®Äڵ尡 ¸ðµÎ 12°¡ µÇ°í, ´õ±¸³ª \newif ¸ÅÅ©·ÎÀÇ Ã¹ºÎºÐ¿¡ \escapechar=-1¿¡ ÀÇÇؼ­ "\"´Â Ãâ·ÂµÇÁö ¾Ê½À´Ï´Ù. µû¶ó¼­ "\@if \iffoo true"´Â "\csname footrue \endcsname"ÀÌ µÇ´Â °ÍÀÔ´Ï´Ù. \if@ °¡ \ °¡ ºüÁø iffoo¿¡¼­ ¾ÕÀÇ if¸¦ ¸Ô¾î¹ö·È½À´Ï´Ù. ±×·¡¼­ footrue¸¸ ³²¾Ò½À´Ï´Ù. ±×¸®°í "\csname footrue \endcsname"´Â \footrue¿Í ¶È°°Àº °ÍÀÌÁö¿ä. ÀÌÁ¦ \newif ¸ÅÅ©·Î¸¦ ´Ù½Ã Çѹø »ìÆ캸¼¼¿ä. ^^

ÀÌ»óÀÇ ³»¿ëÀº TeXbyTopicÀÇ 13.6Àý¿¡¼­ ÇÑ ¼ö ¹è¿î ³»¿ëÀÔ´Ï´Ù. ÅغϿ¡¼­ ¸·È÷´Â °ÍÀº ÅعÙÀÌÅäÇÈÀÌ ³Ê¹«µµ ¸íÈ®ÇÏ°í °£°áÇÏ°Ô ÇØ°áÇØÁÝ´Ï´Ù. Á¤¸» ¸ÚÁø Ã¥ÀÌ ¾Æ´Ò ¼ö ¾ø½À´Ï´Ù. ÈǸ¢ÇÑ Ã¥ ´öºÐ¿¡ ±Ã±ÝÁõÀ» ³Ê¹« ½±°Ô ÇØ°áÇÑ °Í °°¾Æ¼­ Á» ¾Æ½±±â´Â ÇÕ´Ï´Ù.

ÀÌÇØ ¸øÇØ, ÀÌÇØ ¸øÇØ~~~
Submitted by ÀÛÀº³ª¹« @ 08-29 [09:42 am]
348ÂÊ: ¿ì¸®°¡ ÀڽŸ¸ÀÇ Á¶°Ç¹®À» ¸¸µé±â À§Çؼ­ »ç¿ëÇÏ´Â \newif ¶ó´Â ¸í·É¾î°¡ ÀÖ½À´Ï´Ù. ÀÌ ³ðÀº ƯÀÌÇÏ°Ôµµ ÇÑ Å¥¿¡ ¼¼°³ÀÇ ¸í·É¾î(?)¸¦ ¸¸µé¾î ÁÝ´Ï´Ù. ¿¹¸¦ µé¾î "\newif\iffoo" ¶ó°í Çϸé,
   \footrue, \foofalse, \iffoo
À§¿Í °°Àº °ÍµéÀÌ ¸¸µé¾îÁý´Ï´Ù. °¢°¢ÀÌ ¹¹ ÇÏ´Â ³ðµéÀÎÁö´Â À̸§À» º¸¸é ´ëÃæ ¾Ë°Ú½À´Ï´Ù.

±×·¡¼­ \newif ¶ó´Â ³ðÀÌ ½Å±âÇØ º¸¿©¼­ ¾î¶»°Ô Á¤ÀǵǾî Àֱ淡 ±×·±°¡ ÇÏ°í, ¸ÅÅ©·Î Á¤ÀǸ¦ ã¾Æº¸¾Ò½À´Ï´Ù.
\outer\def\newif#1{\count@=\escapechar \escapechar=-1 \expandafter\expandafter\expandafter \def\@if#1{true}{\let#1=\iftrue}% \expandafter\expandafter\expandafter \def\@if#1{false}{\let#1=\iffalse}% \@if#1{false}\escapechar=\count@} % the condition starts out false \def\@if#1#2{\csname\expandafter\if@\string#1#2\endcsname} {\uccode¡®1=¡®i \uccode¡®2=¡®f \uppercase{\gdef\if@12{} }} % ¡®if¡¯ is required
ÀÏ´Ü ¿ì¸®´Â "@", "\expandafter", "\csname \endcsname" ÀÌ·±°Å ³ª¿À¸é ÀÏ´Ü ÂδϴÙ. ^^ ±×·¡µµ ±×µ¿¾È °øºÎÇØ µÐ °ÍÀÌ À־ Â÷±ÙÂ÷±Ù ÀÐ¾î º¸¾Ò½À´Ï´Ù. ±×·°Àú·° °¨Åºµµ ÇØ°¡¸ç, "ÀÌ·¸°Ô Çϴ°ű¸³ª" ÇÏ°í °ÅÀÇ °¨À» Àâ¾Ò½À´Ï´Ù. ÇÏÁö¸¸ µµÀúÈ÷ ÀÌÇØ ¸øÇÒ °ÍÀÌ Çϳª ÀÖ½À´Ï´Ù. ¹Ù·Î ¸Ç ¸¶Áö¸· ÁÙ.
{\uccode¡®1=¡®i \uccode¡®2=¡®f \uppercase{\gdef\if@12{} }} % ¡®if¡¯ is required
µµ´ëü ¿Ö "\uccode"¶ó´Â °ÍÀ» ÀÌ¿ëÇؼ­ ¾î·Æ°Ô "\if@if"¶ó´Â ¸ÅÅ©·Î¸¦ Á¤ÀÇ Çß´ÂÁö´Â µµ¹«Áö ÀÌÇØ ¸øÇÏ°Ú½À´Ï´Ù. ±×³É
\def\if@if{}
¶ó°í ÇÏ¸é ¾ÈµÇ´Â °ÍÀÎÁö. ¹«½¼ ÀÌÀ¯·Î ±×·ìÀ» Çϳª ¸¸µé°í, ±× ±×·ì¾È¿¡¼­ \uccode¸¦ º¯°æÇÏ°í \uppercase¸¦ ÅëÇؼ­ ±×°É ¿øÇϴ´ë·Î µ¹·Á³õ°í, ±×·ì¾È¿¡¼­ Á¤ÀÇÇ߱⶧¹®¿¡ \gdef¸¦ »ç¿ëÇÏ°í... ºÐ¸í ¹«½¼ ÀÌÀ¯°¡ ÀÖÀ»ÅÙµ¥...ÂÁ

ÀÌÇØÇÒ ³¯À» ±â´ëÇϸç, ¿À´Ãµµ ÅØ °øºÎ¸¦ ÇÕ´Ï´Ù. ^^

Aug 29, 2006
¿ì¸®ÀÇ Áö½ÄÀÌ Âزû ºÎÁ·Çؼ­ º¹ÀâÇØ º¸ÀÏ »ÓÀÔ´Ï´Ù.
Submitted by ÀÛÀº³ª¹« @ 08-29 [12:36 am]
375ÂÊ: º¸±â¿¡ º¹ÀâÇÏ°í ¾î·Æ°Ô º¸Àδٰí, Áö·¹ °Ì¸ÔÀ» ÇÊ¿ä°¡ ¾ø½À´Ï´Ù. ¾Ë°í º¸¸é º°°Å ¾Æ´Ñ°Ô ¸¹½À´Ï´Ù. ¿ì¸®¿¡°Ô »ý¼ÒÇÏ°Ô º¸ÀÌ´Â°Ô ¸¹¾Æ¼­ ¾î·Á¿ö º¸ÀÏÁöµµ ¸ð¸£°Ú½À´Ï´Ù. ÇÏÁö¸¸, °øºÎ¸¦ ÅëÇؼ­ »ý¼ÒÇÏ°Ô º¸ÀÌ´ø °ÍÀÌ Àͼ÷ÇØÁö¸é, ±× ¾î·Æ°Ô¸¸ ´À²¸Áö´ø °ÍµéÀÌ ¾ÆÁÖ ½±°Ô º¸ÀÔ´Ï´Ù. (´ç¿¬ÇÑ ¾ê±âÁö¸¸.) °øºÎÇÏ´Â Àç¹Ì°¡ ¹Ù·Î ±×·±°Ô ¾Æ´Ñ°¡ ÇÕ´Ï´Ù.

\t´Â ÅäÅ« ¸®½ºÆ® ·¹Áö½ºÅÍÀε¥, ¾à°£ÀÇ ÅؽºÆ®·Î ÀÌ·ç¾îÁ® ÀÖ´Ù°í ÇսôÙ. (ÅØ¿¡¼­ ÅäÅ«ÀÌ ¹ºÁö, ·¹Áö½ºÅÍ°¡ ¹ºÁö ¸ð¸£½Ã´Â ºÐÀº °øºÎÇÏ¼Å¾ß ÇÕ´Ï´Ù. ^^ ) ¿¹¸¦ µé¸é ´ÙÀ½°ú °°Àº °ÍÀÌÁö¿ä.
\newtoks\t \t={Once upon a time there lived ...}
À̶§, \t¸¦ ÀÌ·ç°í ÀÖ´Â ±× ÅؽºÆ®¿¡ Àû¾îµµ ÇϳªÀÇ º°Ç¥(*)°¡ ÀÖ´ÂÁö È®ÀÎÇÏ´Â ¹æ¹ýÀÌ ¿©·¯°¡Áö°¡ ÀÖ°ÚÁö¸¸, ±× ÁßÇϳª´Â ´ÙÀ½°ú °°½À´Ï´Ù.
\newif\ifresult % for the result of a computed test \def\atest#1{\expandafter\a\the#1*\atest\a} \long\def\a#1*#2#3\a{\ifx\atest#2\resultfalse\else\resulttrue\fi}
À§¿Í °°ÀÌ ¸ÅÅ©·Î¸¦ Á¤ÀÇÇÏ°í "\atest\t"¶ó°í Çϸé \t ¿¡ º°Ç¥°¡ ÀÖ´ÂÁö¿¡ ¿©ºÎ¿¡ µû¶ó \ifresultÀÇ °ªÀÌ °áÁ¤ÀÌ µË´Ï´Ù. µ¿ÀÛÇÏ´Â ¿ø¸®¸¦ ¾Ë¾Æº¸½Ã°Ú½À´Ï±î? ¿¹Àü¿¡ ÀÛÀº³ª¹«°¡ ¿­½ÉÈ÷ ¿Ã·È´ø \expandafter¿Í ±× ¹ÛÀÇ Ã³À½º¸´Â ¸í·É¾îµéÀ» °øºÎÇϽøé, ¾Æ¹«°Íµµ ¾Æ´Ï¶ó´Â °ÍÀ» ¾Æ½Ã°Ô µÉ°ÍÀÔ´Ï´Ù. ÆÄÀÏÀÇ ¸Ç óÀ½¿¡ \tracingmacros=2¿Í \tracingcommands=2 ¶ó°í ÇØ ³õÀ¸½Ã¸é, À§ ¸ÅÅ©·ÎµéÀÇ µ¿ÀÛ ¿ø¸®¸¦ ´õ¿í ½±°Ô ÆÄ¾Ç ÇÒ ¼ö ÀÖÀ» °ÍÀÔ´Ï´Ù.

´ÙÀ½°ú °°Àº Á» ´õ ¿¤·¹°­½ºÇÑ ¹æ¹ýµµ ÀÖ½À´Ï´Ù.
\def\btest#1{\expandafter\b\the#1*\bb} \long\def\b#1*{\futurelet\next\bb} \long\def\bb#1\bb{\ifx\bb\next\resultfalse\else\resulttrue\fi}
À§ µÎ°¡Áö ÇØ°áÃ¥ ¸ðµÎ \t¿¡ ¹®ÀÚ ÅäÅ«ÀÌ ¾Æ´Ñ ¸í·É¾î ÅäÅ«(control sequence token)µéÀÌ À־ µ¿ÀÛÇÕ´Ï´Ù. ´Ü, \atest, \a, \bb ¸¸ »©°í.

Aug 28, 2006
"¿ÞÂÊ °ýÈ£¸¦ ±¸ºÐÀÚ·Î »ç¿ëÇϱâ"
Submitted by ÀÛÀº³ª¹« @ 08-28 [12:25 am]
204ÂÊ: ÅØ¿¡¼­ ¸ÅÅ©·Î¸¦ Á¤ÀÇÇÏ´Â ¹æ½ÄÀº ´ÙÀ½°ú °°½À´Ï´Ù.
\def<¸í·É¾î><ÆĶó¹ÌÅÍ ÅؽºÆ®>{<ġȯ ÅؽºÆ®>}
<ÆĶó¹ÌÅÍ ÅؽºÆ®>ÀÇ ¸Ç ¸¶Áö¸· ¹®ÀÚ°¡ "#"°¡ ¿Ã ¼ö Àִµ¥, Áï, # ´ÙÀ½¿¡ ¿ÞÂÊ °ýÈ£ "{"°¡ °ð¹Ù·Î ¿À´Â °æ¿ìÀε¥, À̶§ ÅØÀº ¸¶Ä¡ <ÆĶó¹ÌÅÍ ÅؽºÆ®>¿Í <ġȯ ÅؽºÆ®> ¿À¸¥ÂÊ ¸Ç³¡¿¡ "{"°¡ ÀÖ´Â °Íó·³ ÇൿÀ» ÇÕ´Ï´Ù. ÀÌ·¸°Ô ÇÔÀ¸·Î½á ¸ÅÅ©·Î°¡ È®ÀåµÉ ¶§, °¢ ÆĶó¹ÌÅÍÀÇ ±¸ºÐÀÚ·Î »ç¿ëµÈ ¹®ÀÚµéÀ» ¾ø¾îÁö´Âµ¥ "#{" ¿¡¼­ "{"´Â ¾ø¾îÁöÁö ¾Ê½À´Ï´Ù. ¿¹¸¦µé¾î, ´ÙÀ½°ú °°Àº ¸ÅÅ©·Î Á¤ÀÇ°¡ ÀÖ´Ù°í ÇսôÙ.
\def\foo #1:#2{[#1] #2}
À§ÀÇ Á¤ÀÇ¿¡¼­ ±¸ºÐÀÚ ":"´Â \foo ¸ÅÅ©·ÎÀÇ µÎ °³ÀÇ ÆĶó¹ÌÅ͸¦ ±¸ºÐÇϱâ À§Çؼ­ »ç¿ëµÇ´Â °ÍÀ¸·Î <ġȯ Å×½ºÆ®>¿¡¼­´Â »ç¿ëµÇÁö ¾Ê½À´Ï´Ù. Áï <ġȯ ÅؽºÆ®>¿¡¼­ ":"¸¦ ¸í½ÃÀûÀ¸·Î »ç¿ëÇÏÁö ¾Ê´Â ÀÌ»ó, ±¸ºÐÀÚ·Î »ç¿ëµÈ ":"´Â ¾ø¾îÁý´Ï´Ù. Á¤¸®Çϸé "#{"¸¦ ÀÌ¿ëÇϸé "{"¸¦ ÆĶó¹ÌÅÍ ÅؽºÆ®¿¡¼­ »ç¿ëÇÒ ¼ö ÀÖ°í, ÆĶó¹ÌÅÍÀÇ ±¸ºÐÀÚ(delimiter)·Î »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù. ±×·³ "#{"°¡ »ç¿ëµÇ´Â ¿¹¸¦ µé¾î º¾½Ã´Ù.
\def\a#1#{\hbox to #1}
À§ ó·³ Á¤ÀÇµÈ ¸ÅÅ©·Î \a°¡ "\a3pt{x}"¶ó°í »ç¿ëµÇ¸é ÀÌ °ÍÀº "\hbox to 3pt{x}"·Î Àü°³µË´Ï´Ù. À§ÀÇ Á¤ÀÇ¿¡¼­ <ÆĶó¹ÌÅÍ ÅؽºÆ®>ÀÇ ¸Ç¸¶Áö¸·¿¡ "#"°¡ »ç¿ëµÇ¾úÀ¸¹Ç·Î \aÀÇ Ã¹¹ø° ÆĶó¹ÌÅÍ #1Àº \a ¿Í { »çÀÌ¿¡ ÀÖ´Â "3pt"°¡ µË´Ï´Ù. ±×·¡¼­ "\hbox to 3pt{x}"·Î Àü°³µÇ´Â °ÍÀÔ´Ï´Ù. ¶Ç ´Ù¸¥ ¿¹·Î, ¸ÅÅ©·Î \a ¸¦ Á¤ÀÇÇϴµ¥, \a{...}¸¦ Àü°³Çϸé \b{...} °¡ µÇ°Ô²ûÇÏ°í ½Í½À´Ï´Ù ¾î¶»°Ô ÇÏ¸é µÉ±î¿ä? ¸ÅÅ©·Î \a¸¦ ´ÙÀ½°ú °°ÀÌ Á¤ÀÇÇÏ¸é µË´Ï´Ù.
\def\a#{\b}
¸¶Áö¸·À¸·Î Àç¹ÌÀÖ´Â ¿¹¸¦ µé¾îº¸°Ú½À´Ï´Ù. Ç÷¹ÀÎ ÅØ¿¡´Â \bf ¶ó´Â ¸í·É¾î°¡ Àִµ¥, ÀÌ´Â
{\bf ¾î¼±¸ Àú¼±¸...}
ó·³ »ç¿ëµÇ¸ç, "¾î¼±¸ Àú¼±¸..."¸¦ ±½Àº±Û²Ã(boldface)·Î ¹Ù²ß´Ï´Ù. ±×·±µ¥ À§ ó·³ {\bf ...}·Î »ç¿ëÇÏ´Â°Ô ¾Æ´Ï¶ó \bold{...}·Î »ç¿ëÇÏ°í ½Í½À´Ï´Ù. ¾î¶»°Ô ÇÏ¸é µÉ±î¿ä? ¿©·¯°¡Áö ¹æ¹ýÀÌ ÀÖÀ» ¼ö ÀÖ½À´Ï´Ù. ³­À̵µ ¼øÀ¸·Î »ìÆ캸¸é ´ÙÀ½°ú °°Àº ¹æ¹ýÀÌ ÀÖ´Ù°í ÇÕ´Ï´Ù.
  1. \def\bold#1{{\bf #1}}
  2. \long\def\bold#1{{\bf #1}}
  3. \def\beginbold{\bgroup\bf} \def\endbold{\egroup}
  4. \def\bold{\bgroup\bf\let\next=}
  5. \def\bold#{\bgroup\bf\let\next= }
4, 5¹øÀ» ¸¶Áö¸·À» À¯½ÉÈ÷ »ìÆ캸¼¼¿ä. Âü ±â¹ßÇÑ ¹æ¹ýÀÔ´Ï´Ù. "\let\next=" ¸¦ ÀÌ¿ëÇؼ­ { ¸¦ ¾ø¾Ö´Â ¹æ¹ýÀº ÀÍÇô µÑ ¸¸ÇÕ´Ï´Ù. »ç½Ç ÀÌ ¹æ¹ýÀº \aftergroupÀ» À̾߱âÇÒ ¶§¿¡µµ ³ª¿Ô´ø ¹æ¹ýÀÔ´Ï´Ù.

Aug 26, 2006
\aftergroup
Submitted by ÀÛÀº³ª¹« @ 08-26 [11:08 pm]
279ÂÊ: \aftergroup´Â ±×´ÙÁö Àͼ÷ÇÑ ¸í·É¾î´Â ¾Æ´Õ´Ï´Ù. ±×·¡¼­ ±× »ç¿ë ºóµµ ¶ÇÇÑ ¸Å¿ì ³·½À´Ï´Ù. \aftergroupÀº \afterassignment¿Í ºñ½ÁÇÑ Çü½ÄÀ» °¡Áö°í ÀÖ½À´Ï´Ù.
\aftergroup<ÅäÅ«>
\aftergroupÀº ±× ´ÙÀ½¿¡ ³ª¿À´Â <ÅäÅ«>À» ÀÏ´Ü ÀúÀåÇØ µÎ¾ú´Ù°¡ ÇöÀç »ç¿ëµÇ°í ÀÖ´Â ±×·ìÀÌ ³¡³­ ´ÙÀ½¿¡ <ÅäÅ«>ÀÌ »ç¿ëµË´Ï´Ù. ¿¹¸¦ µé¸é,
\def\abc{\catcode... \xyz}
\def\xyz#1{...}
...
\abc{argument}
À§ÀÇ ¿¹¿¡¼­ ¾Ë ¼ö ÀÖµíÀÌ argument´Â \catcode¿¡ ÀÇÇؼ­ ¾î¶² catcodeµéÀÌ º¯°æ µÈ ´ÙÀ½¿¡ \xyzÀÇ ÀÎÀÚ·Î »ç¿ëµË´Ï´Ù. À§ÀÇ ¿¹´Â \aftergroupÀ» »ç¿ëÇÏ¸é ´ÙÀ½°ú °°ÀÌ µË´Ï´Ù.
\def\abc{\catcode... \bgroup\aftergroup\xyz\let\dummy=}
...
\abc{...}
\bgroupÀ¸·Î ÀÏ´Ü ±×·ìÀÌ ½ÃÀ۵ǰí, \aftergroup¿¡ ÀÇÇؼ­ \xyz°¡ ÀúÀåµË´Ï´Ù. ±×¸®°í \bgroup¿¡ ÀÇÇؼ­ ½ÃÀÛµÈ ±×·ìÀÌ ³¡³­ ´ÙÀ½¿¡ \xyz°¡ »ç¿ëµË´Ï´Ù. Àß »ìÆ캼 °ÍÀº \let¿¡ ÀÇÇؼ­ \abcÀÇ ¿ÞÂÊ °ýÈ£ "{"°¡ Èí¼öµÈ´Ù´Â °ÍÀÔ´Ï´Ù. µû¶ó¼­ \abc°¡ ÇÏ´Â ÀÏÀº ¸ÕÀú catcodeµéÀ» º¯°æ ½ÃÅ°°í, ±×·ìÀ» ½ÃÀÛÇÏ°í, \xyz¸¦ ÀúÀåÇÏ°í "{"¸¦ Èí¼öÇÏ°í ÀÎÀÚµéÀ» ÀÐ¾î µéÀÌ°í ¸¶Áö¸·À¸·Î ±×·ìÀ» ´Ý½À´Ï´Ù. ±×¸®°í ³ª¼­ ¸ÅÅ©·Î \xyz°¡ Àü°³µÇ´Â °ÍÀÔ´Ï´Ù.

\afterassignment
Submitted by ÀÛÀº³ª¹« @ 08-26 [11:00 am]
279ÂÊ: \afterassignment¸¦ °°ÀÌ °øºÎÇØ º¸°Ú½À´Ï´Ù. \afterassignment´Â ´ÙÀ½°ú °°Àº ÇüÅ·Π»ç¿ëµË´Ï´Ù.
\afterassignment <ÅäÅ«> <assignment¹®>
À§¿¡¼­ <assignment¹®>Àº "ÇÒ´ç¹®" ȤÀº "´ëÀÔ¹®" À̶ó°í ¹ø¿ªµÈ °ÍÀ» º¸¾Ò´Âµ¥, ¿¹¸¦µé¸é ´ÙÀ½°ú °°Àº °ÍµéÀÔ´Ï´Ù.
\baselineskip=12pt
\parskip=0pt plus 1pt
\abc=10
...
À§¿¡¼­ "=" Àº »ý·« ÇÒ ¼ö ÀÖ½À´Ï´Ù.

\afterassignment´Â ÀÌ·¸½À´Ï´Ù. ¿ì¼± ¹Ù·Î µÚ¿¡ ³ª¿À´Â <ÅäÅ«>À» Àß ÀúÀåÇØ µÎ¾ú´Ù°¡, <ÅäÅ«>µÚ¿¡ ³ª¿À´Â <assignment¹®>À» ½ÇÇàÇÑ ÈÄ¿¡ ÀúÀåÇØ µÎ¾ú´ø <ÅäÅ«>À» µÚÀÌ¾î ³ª¿Ã ÀԷ¿¡ Ãß°¡ÇÏ´Â °ÍÀÔ´Ï´Ù. ¸»¸¸ µé¾î¼­´Â ¹»ÇÏ´Â ³ðÀÎÁö Àß ¸ð¸£°Ú½À´Ï´Ù. ¿¹¸¦µé¾î, ´ÙÀ½°ú °°Àº ¸ÅÅ©·Î¸¦ »ý°¢ÇØ º¸°Ú½À´Ï´Ù.
\def\abc#1{\leftskip=#1 \rightskip=#1}
ÀÌ ¸ÅÅ©·Î´Â ¹®´ÜÀÇ ¸ð¾çÀ» Á¤ÇÏ´Â ¸ÅÅ©·Î ÀÏÅÙµ¥, ´ÙÀ½°ú °°ÀÌ »ç¿ëÇØ¾ß ÇÕ´Ï´Ù.
\abc{4pt plus 5pt minus 4pt}
Å« ¹®Á¦´Â ¾ø½À´Ï´Ù¸¸, º¸±â¿¡ ¾à°£ ¾î»öÇÕ´Ï´Ù. ¿Ö³ÄÇϸé À§¿¡¼­ ¿¹¸¦µé¾úÁö¸¸, ´ÙÀ½°ú °°Àº ½ÄÀ¸·Î »ç¿ëÀ» ÇÏÁö,
\parskip 0pt plus 1pt
¾Æ·¡¿Í °°Àº ½Ä·Î »ç¿ëÇÏÁö ¾Ê±â¶§¹®ÀÔ´Ï´Ù.
\parskip{0pt plus 1pt}
À§¿¡¼­ Á¤ÀÇÇÑ ¸ÅÅ©·Î¸¦ \abc 4pt plus 5pt minus 4pt ó·³ »ç¿ëÇÏ¸é ¿øÇÏ´Â ¹Ù¸¦ ¾òÀ» ¼ö ¾ø´Â ÀÌÀ¯¸¦ Çѹø »ý°¢ÇØ º¸½Ã±â ¹Ù¶ø´Ï´Ù.

¹Ù·Î À§ÀÇ ¿¹¿Í °°Àº °æ¿ì¿¡ \afterassignment¸¦ »ç¿ëÇؼ­ ÇØ°á ÇÒ ¼ö ÀÖ½À´Ï´Ù.
\def\abc{\afterassignment\aux \skip0=} \def\aux{\leftskip=\skip0 \rightskip=\skip0}
À§ÀÇ \abc°¡ Àü°³µÉ¶§, ¸ÕÀú ÁÖ¾îÁø ÀԷ¿¡¼­ \skip0¿¡ ÇÒ´çÇÒ ¼ö ÀÖ´Â ÃÖ´ë ±æÀÌÀÇ ÀÔ·Â ½ºÆ®¸µÀ» ¹Þ¾Æµé¿©¼­ \skip0¿¡ ÇÒ´çÇÕ´Ï´Ù. ±×¸®°í ³ª¼­ \aux°¡ Àü°³µÇ¹Ç·Î ¾Æ¹«·± ¹®Á¦°¡ ¾ø½À´Ï´Ù. »ç½Ç ¿ì¸®°¡ Àß ¾Ë°í ÀÖ´Â ¸ÅÅ©·Î, \hglue, \vglue, \openup, \magnification °°Àº ¸ÅÅ©·Î°¡ \afterassignment¸¦ ÀÌ¿ëÇؼ­ Á¤ÀǵǾú´Ù°í ÇÕ´Ï´Ù.

¼ýÀÚ¿¡ ÄÞ¸¶ ³Ö±â
Submitted by ÀÛÀº³ª¹« @ 08-26 [09:28 am]
ÀÛÀº³ª¹«°¡ Áñ°Ü »ç¿ëÇÏ´Â ¸ÅÆ®·Î \fifo ... \ofif¸¦ ÀÌ¿ëÇؼ­ ÁÖ¾îÁø ¼ýÀÚ¿¡ ÄÞ¸¶(,) ³Ö´Â ¸ÅÅ©·Î \insertcommas¸¦ ¸¸µé¾î º¸¾Ò½À´Ï´Ù. ¾îµð¿¡ ¾î¶² ¹ö±×°¡ ¼û¾îÀÖ°í, ¾µµ¥¾ø´Â ºÎºÐÀÌ ÀÖÀ»Áöµµ ¸ð¸£°Ú½À´Ï´Ù. ½½½½ ÅØ °øºÎ¸¦ ´Ù½Ã ½ÃÀÛÇÏ·Á´Âµ¥, ¿À·£¸¸¿¡ ÇÏ·Á´Ï Àß ¾ÈµÇ³×¿ä. ^^

\def\fifo#1{\ifx\ofif#1\ofif\fi \process#1\fifo} \def\ofif#1\fifo{\fi} \newcount\n \newcount\m \def\insertcommas#1{\n=0 \def\process##1{\advance\n1 }\fifo#1\ofif \m=\n \divide\n3 \advance\n1 \multiply\n3 \advance\n by-\m \ifnum\n=3 \n=0 \fi \advance\n-1 \def\process##1{\advance\n1 \ifnum\n=3 {,}\n=0 \fi ##1} \fifo#1\ofif}

´ÙÀ½°ú °°ÀÌ ÀÔ·ÂÇϸé,
\insertcommas{1}
\insertcommas{12}
\insertcommas{123}
\insertcommas{1234}
\insertcommas{12345}
\insertcommas{123456}
\insertcommas{1234567}
...

¾Æ·¡¿Í °°Àº °á°ú¸¦ ¾òÀ» ¼ö ÀÖ½À´Ï´Ù.



Aug 23, 2006
INITEX
Submitted by ÀÛÀº³ª¹« @ 08-23 [12:08 pm]
39ÂÊ: TeX ¿¡´Â INITEX À̶ó ºÒ¸®´Â ÇÁ·Î±×·¥ÀÌ Àִµ¥, ÀÌ ³à¼®Àº TeX ¼³Ä¡ÇÒ ¶§ »ç¿ëµÇ´Â ³ðÀ̶ó³×¿ä. ±×°Íµµ ¾ÆÁÖ ¹Ø¹Ù´Ú ºÎÅÍ. ¾Æ¸¶µµ TeXÀ» ¸¸µå´Â ÇÁ·Î±×·¥Àΰ¡ º¾´Ï´Ù. TeXÀ» ¸¸µå´Â TeXÀ̶ó À̸§ÀÌ INITEX ÀÎ°Í °°°í, ÀÌ ³ðÀº ¿ì¸®¿¡°Ô Ä£¼÷ÇÑ TeX º¸´Ù ¸î °¡Áö ÀÏÀ» ´õ ÇÏ´Â °ÍÀ» »©°í´Â ±×´ÙÁö Ưº°ÇÑ ÇÁ·Î±×·¥Àº ¾Æ´Ï¶ø´Ï´Ù. ±× ´õÇÏ´Â ¸î °¡Áö ÀÏÀ̶õ,
  • ÇÏÀÌÇÁ³×ÀÌ¼Ç ÆÐÅÏÀ» ¾ÐÃàµÈ ÇüÅ·ΠTeXÀÇ Æ¯¼ö ¿ëµµ Å×ÀÌºí¿¡ Àß º¸°üÇÏ´Â ÀÏ. ±×·¸°ÔÇÔÀ¸·Î½á ¿ì¸®°¡ ½ÇÁ¦·Î TeXÀ» »ç¿ëÇؼ­ Á¶ÆÇÀ» ÇÒ¶§´Â ÇÏÀÌÇÁÅ×À̼ÇÀ» Á» ´õ »¡¸® ¼öÇàÇÒ ¼ö ÀÖµµ·Ï ÇØÁشٳ׿ä.
  • plain TeXÀÎ °æ¿ì, plain.tex À¸·Î ºÎÅÍ Æ÷¸ä ÆÄÀÏÀÎ plain.fmt À» ¸¸µç´Ù°í ÀÏ.
ÀÌó·³ TeXÀÌ ÇÏ´Â ÀϺ¸´Ù ¸î°¡Áö ´õ ÀÏÀ» Çϴϱî, ÀÏÇÒ ¶§ ¸Þ¸ð¸®°¡ ´õ ÇÊ¿äÇÏ°ÚÁö¿ä. ±×·¡¼­ ÀÌ ¿ëµµ·Î ¸Þ¸ð¸®¸¦ ´õ »ç¿ëÇϱ⠶§¹®¿¡, Á¶ÆÇÀ» À§ÇÑ ¸Þ¸ð¸®´Â ±×¸¸Å­ ÁÙ¾îµç´Ù°í Çϳ׿ä. (±×·±µ¥ INITEXÀ¸·Î Á¶ÆÇÀ» ÇÒ ÀÏÀÌ ÀÖ±â´Â ÀÖ³ª¿ä? ^^)

´ç¿¬ÇÑ ¾ê±â°ÚÁö¸¸, INITEXÀº ±× À̸§¿¡¼­µµ ÃßÃøÇÒ ¼ö ÀÖµíÀÌ, ÅØ¿¡ ´ëÇؼ­ ¾Æ¹«°Íµµ ¸ð¸£°í ¿À·ÎÁö ÅØÀÇ ÇÁ¸®¹ÌƼºê ¹Û¿¡ ¸ð¸¥´Ù°í ÇÕ´Ï´Ù. ±×·¡¼­ ¸ðµç ¹®ÀÚÀÇ Ä«Å×°í¸®µµ Á¤ÇØÁÖ¾î¾ß ÇÏ°í, ¿©·¯°¡Áö ÇÊ¿äÇÑ °ÍµéÀ» ¸¸µé°í Á¤ÇØÁÖ¾î¾ß ÇѴٳ׿ä. ±×·¯ÇÑ ÀϵéÀ» plain ÅØ¿¡¼­´Â plain.tex°¡ ÇÏÁö¿ä. ±×·¸´Ù¸é ´Ù¸¥ ¸ðµç ÅØ¿¡µµ, ¿¹¸¦µé¸é, ·¹ÀÌÅصµ ¾Ë°í º¸¸é INITEX ¿¡°Ô ·¹ÀÌÅØÀ» ·¹ÀÌÅØ Ã³·³ ¸¸µé°Ô ÇØÁÖ´Â ¹«½¼ ÆÄÀÏÀÌ ÀÖÀ»°Å¶ó°í ÃßÃøÇÒ ¼ö ÀÖ°ÚÁö¿ä?