ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* getting number from context.figurewidth
@ 2021-10-26 16:31 Pablo Rodriguez via ntg-context
  2021-10-27 19:20 ` Pablo Rodriguez via ntg-context
  0 siblings, 1 reply; 5+ messages in thread
From: Pablo Rodriguez via ntg-context @ 2021-10-26 16:31 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Pablo Rodriguez

Dear list,

I have the following sample:

  \starttext
  \startluacode
    document.sample = "xml-mkiv.pdf"
    context.getfiguredimensions({ document.sample })
    context(context.figureheight)
    context.par()
    context(tex.dimen.paperheight)
  \stopluacode
  \stoptext

Is there a way that I can get a number from context.figureheight, such
as I get it from tex.dimen.paperheight?

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: getting number from context.figurewidth
  2021-10-26 16:31 getting number from context.figurewidth Pablo Rodriguez via ntg-context
@ 2021-10-27 19:20 ` Pablo Rodriguez via ntg-context
  2021-10-27 19:41   ` Jairo A. del Rio via ntg-context
  2021-10-27 20:06   ` Hans Hagen via ntg-context
  0 siblings, 2 replies; 5+ messages in thread
From: Pablo Rodriguez via ntg-context @ 2021-10-27 19:20 UTC (permalink / raw)
  To: Pablo Rodriguez via ntg-context; +Cc: Pablo Rodriguez

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: getting number from context.figurewidth
  2021-10-27 19:20 ` Pablo Rodriguez via ntg-context
@ 2021-10-27 19:41   ` Jairo A. del Rio via ntg-context
  2021-10-27 20:06   ` Hans Hagen via ntg-context
  1 sibling, 0 replies; 5+ messages in thread
From: Jairo A. del Rio via ntg-context @ 2021-10-27 19:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Jairo A. del Rio, Pablo Rodriguez


[-- Attachment #1.1: Type: text/plain, Size: 1864 bytes --]

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
>
> ___________________________________________________________________________________
>

[-- Attachment #1.2: Type: text/html, Size: 2938 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: getting number from context.figurewidth
  2021-10-27 19:20 ` Pablo Rodriguez via ntg-context
  2021-10-27 19:41   ` Jairo A. del Rio via ntg-context
@ 2021-10-27 20:06   ` Hans Hagen via ntg-context
  2021-10-28 17:15     ` Pablo Rodriguez via ntg-context
  1 sibling, 1 reply; 5+ messages in thread
From: Hans Hagen via ntg-context @ 2021-10-27 20:06 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Hans Hagen, Pablo Rodriguez

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: getting number from context.figurewidth
  2021-10-27 20:06   ` Hans Hagen via ntg-context
@ 2021-10-28 17:15     ` Pablo Rodriguez via ntg-context
  0 siblings, 0 replies; 5+ messages in thread
From: Pablo Rodriguez via ntg-context @ 2021-10-28 17:15 UTC (permalink / raw)
  To: Hans Hagen via ntg-context; +Cc: Pablo Rodriguez

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-10-28 17:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26 16:31 getting number from context.figurewidth Pablo Rodriguez via ntg-context
2021-10-27 19:20 ` Pablo Rodriguez via ntg-context
2021-10-27 19:41   ` Jairo A. del Rio via ntg-context
2021-10-27 20:06   ` Hans Hagen via ntg-context
2021-10-28 17:15     ` Pablo Rodriguez via ntg-context

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).