Texinfo 的 @value 宏是否可以在 @xref 和朋友的文件名参数中发挥作用?

Texinfo 的 @value 宏是否可以在 @xref 和朋友的文件名参数中发挥作用?

给定一个文件xref-and-value.texi,其内容为:

\input texinfo @c -*- TeX-PDF-mode: t; -*-
@setfilename xref-and-value.info
@settitle @code{@@xref} and @code{@@value} in \pdftex

@set fngccint gccint-4.6
@xref{Top,,Introduction, @value{fngccint}, GNU Compiler Collection (GCC) Internals}.
@bye

我得到这个输出pdfTeX

This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian) (format=pdftex 2012.2.28)  5 MAR 2012 17:13
entering extended mode
 %&-line parsing enabled.
**\input xref-and-value.texi
(./xref-and-value.texi (/usr/share/texmf/tex/texinfo/texinfo.tex
Loading texinfo [version 2008-04-18.10]:

...

 formatting,
\defaultparindent=\dimen46
 and turning on texinfo input format.)
(./xref-and-value.aux)
\openout1 = `xref-and-value.aux'.

@cpindfile=@write2
@fnindfile=@write3
@vrindfile=@write4
@tpindfile=@write5
@kyindfile=@write6
@pgindfile=@write7

! TeX capacity exceeded, sorry [input stack size=5000].
@makevalueexpandable ->@let @value
                                   = @expandablevalue @catcode `@-=@other @c...

@value ->@begingroup @makevalueexpandable
                                          @valuexxx
@makevalueexpandable ->@let @value
                                   = @expandablevalue @catcode `@-=@other @c...

@value ->@begingroup @makevalueexpandable
                                          @valuexxx
@makevalueexpandable ->@let @value
                                   = @expandablevalue @catcode `@-=@other @c...

@value ->@begingroup @makevalueexpandable
                                          @valuexxx
...
l.6 ...}, GNU Compiler Collection (GCC) Internals}
                                                  .
If you really absolutely need more capacity,
you can ask a wizard to enlarge me.

!  ==> Fatal error occurred, no output PDF file produced!

这是 的已知限制texinfo.tex

因此,看起来第 4 个参数是@xref在仅扩展上下文中使用,但它@value并不(有用地)可扩展。

是否可以重新实施该设施@set@value以便@value 可以扩展吗?


更新

为了回应 Bruno 的评论@expandablevalue,我尝试了这个:

\errorcontextlines 100 \input texinfo @c -*- TeX-PDF-mode: t; -*-

@setfilename xref-and-value.info
@settitle @code{@@xref} and @code{@@value} in \pdftex

@set fngccint gccint-4.6
@xref{Top,,Introduction, @expandablevalue{fngccint}, GNU Compiler Collection (GCC) Internals}.
@bye

这至少可以进行排版,但仍然会产生错误:

! Argument of @expandablevalue has an extra }.
<inserted text>
                @par
<to be read again>
                   }
@addtokens ...f @addtoks {@noexpand #1={@the #1#2}
                                                  }@addtoks
@skipspaces ...@else @addtokens {@filename }{@PP }
                                                  @advance @filenamelength b...
<argument>  @expandablevalue
                             {fngccint}
@getfilename ...ngth =0@expandafter @skipspaces #1
                                                  |@relax
@xrefX ...nofonts @turnoffactive @getfilename {#4}
                                                  {@activebackslashdouble @x...
l.7 ...}, GNU Compiler Collection (GCC) Internals}
                                                  .
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.

Runaway argument?
! Paragraph ended before @expandablevalue was complete.
<to be read again>
                   @par
<to be read again>
                   }
@addtokens ...f @addtoks {@noexpand #1={@the #1#2}
                                                  }@addtoks
@skipspaces ...@else @addtokens {@filename }{@PP }
                                                  @advance @filenamelength b...
<argument>  @expandablevalue
                             {fngccint}
@getfilename ...ngth =0@expandafter @skipspaces #1
                                                  |@relax
@xrefX ...nofonts @turnoffactive @getfilename {#4}
                                                  {@activebackslashdouble @x...
l.7 ...}, GNU Compiler Collection (GCC) Internals}
                                                  .
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.

答案1

的第四个参数@xref被解析为文件名@getfilename(要查看,请#4在 的日志输出中查找@show@xref)。此函数一次读取一个宏参数,并独立扩展这些参数。当收到 时@expandablevalue{fngccint},它将首先读取@expandablevalue并尝试扩展它(在 内@edef),但会失败,因为{fngccint}不在该 内@edef

一种解决方案是在 : 周围加上括号@expandablevalue{fngccint},然后将其作为一个宏参数抓取,然后扩展就可以起作用了。

\errorcontextlines 100 \input texinfo @c -*- TeX-PDF-mode: t; -*-

@setfilename xref-and-value.info
@settitle @code{@@xref} and @code{@@value} in \pdftex

@set fngccint gccint-4.6
@xref{Top,,Introduction, {@expandablevalue{fngccint}}, GNU Compiler Collection (GCC) Internals}.
@bye

答案2

顺便说一句,如果以后有人遇到这个问题,已修复texinfo.tex,因此您可以直接获取最新版本texinfo.tex并使用它。(这实际上是上游建议的每个人texinfo.tex做;只需搜索Texinfo 网页

相关内容