ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Getting the width of an expression inside lua
@ 2009-11-02 11:43 Matthijs Kooijman
  2009-11-02 11:52 ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Matthijs Kooijman @ 2009-11-02 11:43 UTC (permalink / raw)
  To: Mailing list for ConTeXt users


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

Hi all,

I'm wondering if there is any way to get the width of some TeX (or rather,
ConTeXt) expression inside lua, to do some math with it and output it again.

I've found the tex macro \setwidthof, which served me well at first, but I
need to do some more complex things with this widths (like taking the maximum
value of a bunch of widths and using that again in some other places).

Doing this in TeX would be my fallback option, but that would be a lot more
complex (I'd be generating the TeX code for it, but still...).

So, I'm looking for a function that accepts a string (and possible catcodes)
and returns the dimensions of that string as if it would be rendered directly
with tex.sprint & friends.

I've looked around the LuaTex manual a bit, and found the node.dimensions
function. However, that function requires a node object, which I have no clue
how to get at. 

Perhaps I could use \setwidthof and get at the value it assigned?

Any suggestions?

Gr.

Matthijs

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

[-- Attachment #2: Type: text/plain, Size: 486 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2009-11-05 17:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-02 11:43 Getting the width of an expression inside lua Matthijs Kooijman
2009-11-02 11:52 ` Hans Hagen
2009-11-02 12:06   ` Matthijs Kooijman
2009-11-02 12:31     ` Hans Hagen
2009-11-05 14:38       ` Matthijs Kooijman
2009-11-05 14:40         ` Wolfgang Schuster
2009-11-05 17:25         ` Hans Hagen

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).