········· > > I noticed something unexpected with the following code: > > \enabletrackers[metapost.showlog] > > \startuseMPgraphic{heading:ThemeTitleStyle} > show "HEADING:THEMETITLESTYLE"; > show \MPstring{heading:title}; > > draw textext( \MPstring{heading:title} ) rotated 5 > withcolor blue; > \stopuseMPgraphic > > \defineframed[ThemeTitleStyle][ > background=\useMPgraphic{ThemeTitleStyle}, > ] > > \def\processword#1{% > \setMPtext{heading:title}{#1}% > \useMPgraphic{heading:ThemeTitleStyle} > } > > \define[1]\ThemeChapterTitle{\applytosplitstringword\processword{#1}} > \setuphead[chapter][deeptextcommand={\ThemeChapterTitle}] > > \starttext > \startchapter[title=Why Is heading:ThemeTitleStyle Called Twice?] > \input knuth > \stopchapter > \stoptext > > It appears as though heading:ThemeTitleStyle is being called twice: > > metapost > info: > >> "HEADING:THEMETITLESTYLE" > >> "Why" > metapost > info: > >> "HEADING:THEMETITLESTYLE" > >> "Why" > > I am trying to produce a random number that is not equal to the > previous random number. However, if the code is called twice, then I'd > have to add code to ignore one of the calls. > > Any ideas why the code seems to be called twice and what can be done > to ensure that it is only called once? Don’t use text ;-) That’s a known issue: as soon as your Metapost code contains text, it will be processed twice. E.g.: \starttext \setMPtext{heading:title}{foo} \startMPcode show "This gets printed twice."; draw textext( \MPstring{heading:title} ); \stopMPcode \stoptext Same for labels, {b,e}tex. See also this thread: http://www.ntg.nl/pipermail/ntg-context/2011/056047.html Best regards, Philipp