Re: [NTG-context] getting number from context.figurewidth
On 10/27/21 10:06 PM, Hans Hagen via ntg-context wrote: > On 10/27/2021 9:20 PM, Pablo Rodriguez via ntg-context wrote: >> On 10/26/21 6:31 PM, Pablo Rodriguez via ntg-context wrote: >>> [...] >>loader_times:write('.box placeholder width=' .. context.figurewidth >> .. ' height=' .. context.figureheight) >> >> I cannot concatenate string and function (and I need the number, not the >> unit). >> >> Is there no way of doing it? > i'm pretty sure this has been asked before > > \ctxlua{local f = figures.getinfo("cow.pdf") print(f and f.used and > f.used.width)} > > so .. time to wikify it Many thanks for your reply, Hans. Already wikified at https://wiki.contextgarden.net/Image_Placement#Measures_in_Lua. Many thanks again for your help, Pablo -- http://www.ousia.tk ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] getting number from context.figurewidth
On 10/27/2021 9:20 PM, Pablo Rodriguez via ntg-context wrote: On 10/26/21 6:31 PM, Pablo Rodriguez via ntg-context wrote: [...] Is there a way that I can get a number from context.figureheight, such as I get it from tex.dimen.paperheight? Sorry for insisting, I need it for a Lua script that in the relevant line reads: loader_times:write('.box placeholder width=' .. context.figurewidth .. ' height=' .. context.figureheight) I cannot concatenate string and function (and I need the number, not the unit). Is there no way of doing it? i'm pretty sure this has been asked before \ctxlua{local f = figures.getinfo("cow.pdf") print(f and f.used and f.used.width)} so .. time to wikify it 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 - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] getting number from context.figurewidth
Hi, Pablo. I have no idea of what you need to do, but in grph-inc.lua you find the following (line 709): implement { name = "figurestatus", actions = { get, context }, arguments = { "'status'", "string", "string" } } So that \figureheight calls this function via \clf_figurestatus and, in turn, it calls figures.get. If I'm right, figures.get('status','height','0') -- or '"status"' ? would have to return the value you're asking for (at the TeX end, "sp" units are added). A MWE wouldn't hurt. I hope this helps or, at least, it leads you through the right direction. Cordially, Jairo El mié, 27 de oct. de 2021 a la(s) 14:20, Pablo Rodriguez via ntg-context ( ntg-context@ntg.nl) escribió: > On 10/26/21 6:31 PM, Pablo Rodriguez via ntg-context wrote: > > [...] > > Is there a way that I can get a number from context.figureheight, such > > as I get it from tex.dimen.paperheight? > > Sorry for insisting, I need it for a Lua script that in the relevant > line reads: > > loader_times:write('.box placeholder width=' .. context.figurewidth > .. ' height=' .. context.figureheight) > > I cannot concatenate string and function (and I need the number, not the > unit). > > Is there no way of doing it? > > Many thanks for your help, > > Pablo > -- > http://www.ousia.tk > > ___ > If your question is of interest to others as well, please add an entry to > the Wiki! > > maillist : ntg-context@ntg.nl / > http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > > ___ > ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] getting number from context.figurewidth
On 10/26/21 6:31 PM, Pablo Rodriguez via ntg-context wrote: > [...] > Is there a way that I can get a number from context.figureheight, such > as I get it from tex.dimen.paperheight? Sorry for insisting, I need it for a Lua script that in the relevant line reads: loader_times:write('.box placeholder width=' .. context.figurewidth .. ' height=' .. context.figureheight) I cannot concatenate string and function (and I need the number, not the unit). Is there no way of doing it? Many thanks for your help, Pablo -- http://www.ousia.tk ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___