[NTG-context] Re: error with _ in header?

Hans Hagen pragma at wxs.nl
Thu Aug 19 10:49:00 CEST 2004

Patrick Gundlach wrote:

>Hello,
>
>
>
>>>--------------------------------------------------
>>>\setupoutput[pdftex]
>>>
>>>\usetypescript[postscript][texnansi]
>>>\setupbodyfont[postscript,ss,13pt]
>>>
>>>
>>>\starttext
>>>\dorecurse{10}{\input tufte \par}
>>>
>>>\externalfigure[cow][scale=1424]
>>>
>>>\externalfigure[cow][scale=1424]
>>>
>>>\stoptext
>>>--------------------------------------------------
>>>
>>>
>>>
>>This file processes ok here; also, your bug is not so much related to
>>headers but more to some kind of \_ expansion In what path are your
>>graphics?
>>
>>
>
>it breaks on 2004.8.14 as well on live.contextgarden.net
>
>Graphics (cow.pdf) is in /opt/local/texmf/tex/context/sample
>
>If the two graphics are not on the same page, the error dissapears.
>The reproduction of the error is very sensitive to layout changes.
>
>
the problem occurs in the output routine (when the page is built); some tracing all learns that while flushing the fig box takes place, the meaning of textunderscore is changed; so we need to restore this before hand; actually this problem should be solved differently, i.e. no redefinition at all; the problem is that findinf good solutions is not that easy because of "moments of expansion"

fix (in core-fig.tex:)

\def\dodoplaceexternalfigure[#1][#2][#3][#4][#5][#6]%
{\doifsomething{#3}% catches \defineexternalfigure dummies
{\bgroup
\pushmacro\textunderscore
\edef\textunderscore{\string_}% brrr, temp hack, still needed?
\calculateexternalfigure[#1][#2][#3][#4][#5][#6]%
\calculateexternalscreenfigure[#1][#2][#3][#4][#5][#6]%
\popmacro\textunderscore
\box\foundexternalfigure
\egroup}}

-----------------------------------------------------------------