KTUGFaq

KTUG FAQ

α:
йȣ:
Let not the sands of time get in your lunch.
DVIPDFMx&value=DHUcs/FrontPage占쏙옙타占쏙옙&value=畸TrueType昉청&value=위키홈페이지WinEdtTip/�������&value=XEmTeX › 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 Դϴ.
{\uccode1=i \uccode2=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} {\uccode1=i \uccode2=f \uppercase{\gdef\if@12{} }} % if is required
ϴ 츮 "@", "\expandafter", "\csname \endcsname" ̷ ϴ δϴ. ^^ ׷ ׵ ־ о ҽϴ. ׷ ź ذ, "̷ ϴ°ű" ϰ ҽϴ. ϳ ֽϴ. ٷ .
{\uccode1=i \uccode2=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, 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 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 ҽϴ.  װ ְ, κ 𸣰ڽϴ. θ ٽ Ϸµ, Ϸ ȵdz׿. ^^

\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 ó ִ Ŷ ְ?
» ޱ | Ʈ

^
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2006-08-29 22:32:07
Processing time 5.7326 sec