名前: kreson 日時: 2006-06-21 17:35:35 IPアドレス: 58.188.44.*
>>43500 \hogeuse{hoge1} をコメントアウトするか, \def\hogeuse#1{\@nameuse{hoge \ref@csname{#1}}} のように \@nameuse の中で hoge と \ref@csname を離すと エラーはでませんでした. そこで \tracingmacros=1 \hogeuse{hoge1} \tracingmacros=0 としてログを見てみました. \@macro の #2 に document が入るような 呼び出し方をされてるようなのですが, どういう仕組みで \@macro が呼び出されるのか よくわかりませんでした. 長くなりますがログを添付します. これでわかるでしょうか? --- \hogeuse #1->\@nameuse {hoge\ref@csname {#1}} #1<-hoge1 \@nameuse #1->\csname #1\endcsname #1<-hoge\ref@csname {hoge1} \ref@csname #1->\expandafter \@setref@csname \csname r@#1\endcsname \@firstoftw o {#1} #1<-hoge1 \@setref@csname #1#2#3->\ifx #1\relax \afterfi {\afterendcsname {\protect \G@re fundefinedtrue \@latex@warning {Reference `#3' on page \thepage \space undefine d}}}\else \expandafter #2#1\fi #1<-\r@hoge1 #2<-\@firstoftwo #3<-hoge1 \afterfi #1#2\fi ->\fi #1 #1<-\afterendcsname {\protect \G@refundefinedtrue \@latex@warning {Reference `h oge1' on page \thepage \space undefined}} #2<-\else \expandafter \@firstoftwo \r@hoge1 \afterendcsname #1#2\endcsname ->#2\endcsname #1 #1<-\protect \G@refundefinedtrue \@latex@warning {Reference `hoge1' on page \th epage \space undefined} #2<- \hoge #1->\refstepcounter {hoge}\label {hoge:#1}\macro #1<-\protect \refstepcounter #1->\stepcounter {#1}\protected@edef \@currentlabel {\csname p@ #1\endcsname \csname the#1\endcsname } #1<-hoge \stepcounter #1->\addtocounter {#1}\@ne \begingroup \let \@elt \@stpelt \csname cl@#1\endcsname \endgroup #1<-hoge \addtocounter #1#2->\@ifundefined {c@#1}{\@nocounterr {#1}}{\global \advance \c sname c@#1\endcsname #2\relax } #1<-hoge #2<-\@ne \@ifundefined #1->\expandafter \ifx \csname #1\endcsname \relax \expandafter \@ firstoftwo \else \expandafter \@secondoftwo \fi #1<-c@hoge \@secondoftwo #1#2->#2 #1<-\@nocounterr {hoge} #2<-\global \advance \csname c@hoge\endcsname \@ne \relax \cl@hoge -> \protected@edef ->\let \@@protect \protect \let \protect \@unexpandable@protect \afterassignment \restore@protect \edef \p@hoge -> \thehoge ->\@arabic \c@hoge \@arabic #1->\number #1 #1<-\c@hoge \restore@protect ->\let \protect \@@protect \label #1->\@bsphack \protected@write \@auxout {}{\string \newlabel {#1}{{\@cur rentlabel }{\thepage }}}\@esphack #1<-hoge:\protect \@bsphack ->\relax \ifhmode \@savsk \lastskip \@savsf \spacefactor \fi \protected@write #1#2#3->\begingroup \let \thepage \relax #2\let \protect \@une xpandable@protect \edef \reserved@a {\write #1{#3}}\reserved@a \endgroup \if@no break \ifvmode \nobreak \fi \fi #1<-\@auxout #2<- #3<-\string \newlabel {hoge:\protect }{{\@currentlabel }{\thepage }} \protect ->\noexpand \protect \noexpand \@currentlabel ->2 \reserved@a ->\write \@auxout {\newlabel{hoge:\protect }{{2}{\thepage }}} \@esphack ->\relax \ifhmode \spacefactor \@savsf \ifdim \@savsk >\z@ \ignorespa ces \fi \fi \macro ->\def \contents {}\@macro \@macro #1\end #2->\expandafter \def \expandafter \contents \expandafter {\cont ents #1}\def \tempa {#2}\ifx \tempa \hogestring \end {hoge}\else \expandafter \ def \expandafter \contents \expandafter {\contents \end {#2}}\expandafter \@mac ro \fi #1<-\G@refundefinedtrue \@latex@warning {Reference `hoge1' on page \thepage \sp ace undefined} \tracingmacros =0 #2<-document \contents -> \contents ->\G@refundefinedtrue \@latex@warning {Reference `hoge1' on page \the page \space undefined} \tracingmacros =0 \@macro #1\end #2->\expandafter \def \expandafter \contents \expandafter {\cont ents #1}\def \tempa {#2}\ifx \tempa \hogestring \end {hoge}\else \expandafter \ def \expandafter \contents \expandafter {\contents \end {#2}}\expandafter \@mac ro \fi ) Runaway argument? \par ! File ended while scanning use of \@macro. <inserted text> \par <*> test.tex ? x
この書き込みへの返事: