[NTG-context] Placing a figure with a command for the file in mkiv

Wolfgang Schuster schuster.wolfgang at gmail.com
Sat Jan 27 12:39:09 CET 2018


> Otared Kavian <mailto:otared at gmail.com>
> 27. Januar 2018 um 12:31
>
>
> Hi Wolfgang,
>
> Thanks again! Indeed
>
> \defineexpandable\authorpicture{hacker.jpg}
>
> solves the problem in the simplified case I was reporting.
> However in the real case, the file « hacker.jpg » is in fact a file 
> which depends on other variables, and when I include \defineexpandable 
> in the \getvariable environment then it does not work anymore: saying
>
> \defineexpandable\authorpicture{\getvariable{talk}{picture}}
> or
> \defineexpandable\authorpicture{\expanded{\getvariable{talk}{picture}}}
> or
> \defineexpandable\authorpicture{\expandafter\getvariable{talk}{picture}}
> does not solve the problem.
>
> Below is a minimal example showing the issue (with what you taught me 
> last week…).
>
> Best regards: OK
>
> \starttext
> \startbuffer[pagetalk]
> \starttabulate[|f{\bi}l|p|][before=]%
> \NC Speaker \EQ \getvariable{talk}{speakerfirstname} {\sc 
> \getvariable{talk}{speakername}}
> \NC\NR
> \NC Title \EQ \getvariable{talk}{title} \NC\NR
> \stoptabulate
> \defineexpandable\authorpicture{\getvariable{talk}{picture}}
> \placefigure[here][]{}
> {\externalfigure[\authorpicture]}

You can put the \getvariable command in \externalfigure.

\startplacefigure[location=here]
   \externalfigure[\getvariable{talk}{picture}]
\stopplacefigure

> \page
> \stopbuffer
>
> \setvariable{talk}{set}{\getbuffer[pagetalk]}
>
> \setvariables[talk]%
> [speakername={Hacker},
> title={Up to date hacking},
> picture=hacker.jpg
> ]
You’re missing a coma after “picture=hacker.jpg” which results in “jpeg ”
(which a space at the end) as file extension for the image.

Wolfgang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20180127/a1f31b58/attachment.html>


More information about the ntg-context mailing list