![](https://secure.gravatar.com/avatar/46562c7d27388490d62e8d7a5bc960dd.jpg?s=120&d=mm&r=g)
On 10/8/2018 11:36 PM, moi@gilleswaeber.ch wrote:
Hi, I'm trying to setup the path for images using environment variables but calling context.setupexternalfigures does not work for me. I am using the latest version 2018.10.08 17:44 on Windows.
\directlua{ % This one works fine %context("\\setupexternalfigures[directory={images, " .. os.getenv('IMG_PATH'):gsub('\\', '/') .. "}]") % Those do not (state: unknown) context.setupexternalfigures({directory = {{'images', os.getenv('IMG_PATH'):gsub('\\', '/')}}}) context.setupexternalfigures {directory = {{'images', os.getenv('IMG_PATH'):gsub('\\', '/')}}} context.setupexternalfigures({'images', os.getenv('TEX_PATH'):gsub('\\', '/')}) } \starttext \externalfigure[cow] \stoptext
Called with $env:IMG_PATH = 'D:\Applications\Context\tex\texmf-context\tex\context\sample\common'; context test.tex
Additionally, using a path with non-ascii symbols in environment variables does not seem to work at all but this is not a big issue for me.
How should I call context.setupexternalfigures? \directlua{ context.setupexternalfigures { % directory = { 'images', (string.gsub(os.getenv('IMG_PATH'),'\\', '/')) } % directory = { 'images', resolvers.cleanpath(os.getenv('IMG_PATH')) } directory = { 'images', resolvers.expandpath('IMG_PATH') } } }
(or pass the path on the command line, say --imagepath=... and get it with document.arguments.imagepath) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------