skyhorse--- via ntg-context schrieb am 18.12.2021 um 10:52:
I have a need to use a logo graphics file several times in a document. I somethings need to update to a newer graphics file. I only want to make one change to the original variable value definition.
I've tried using \define.. but it's not working for me. Here is my MWE:
%%%%%%%%
\define[]\logofile{an_image_file.png} % Here defining the variable with the filename to use.
\definelayer[stillimage] \setlayer[stillimage]{\externalfigure[\logofile]} % Here trying to use the \logofile macro. \setupbackgrounds[page][background=stillimage]
\starttext \input knuth \stoptext
What's the accepted way to do this or are macro arguments not allowable?
To fix your example you have to use the \defineexpandable command to create the command. Another method which was already suggested by Willi is to use the \useexternalfigure command to create a reference to your graphic. A alternative to \defineexpandable is the \setvariables command. \setupexternalfigures [location=default] \defineexpandable\MillFigure{mill.png} \useexternalfigure[CowFigure][cow.pdf] \setvariables[figures][hacker=hacker.jpg] \starttext \externalfigure[\MillFigure] \externalfigure[CowFigure] \externalfigure[\getvariable{figures}{hacker}] \stoptext Wolfgang