Access ConTeXt dimensions in Lua
![](https://secure.gravatar.com/avatar/e5aa6984b53b8925e405ebbdbc051ad9.jpg?s=120&d=mm&r=g)
Hi all, I’m trying to write some dimensions to a file, e.g. \startluacode io.savedata("settings.txt", context("\\textwidth")) \stopluacode But that context() construct is nil. There’s probably a simple solution... ;) Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net https://www.cacert.org (I'm an assurer) GPG Key ID 1C9B22FD
![](https://secure.gravatar.com/avatar/e5aa6984b53b8925e405ebbdbc051ad9.jpg?s=120&d=mm&r=g)
\startluacode io.savedata("settings.txt", context("\\textwidth")) \stopluacode
Found it myself: number.todimen(tex.dimen.textwidth) Sorry for the noise. But now I need the current font name, even better the current values for rm, ss and tt fonts. I found p.123 of cld-mkiv.pdf, but don’t know how to address these values. Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net https://www.cacert.org (I'm an assurer) GPG Key ID 1C9B22FD
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
On 10/8/2016 10:41 PM, Henning Hraban Ramm wrote:
Hi all,
I’m trying to write some dimensions to a file, e.g.
\startluacode io.savedata("settings.txt", context("\\textwidth")) \stopluacode
But that context() construct is nil. There’s probably a simple solution... ;)
\starttext \startluacode io.savedata("settings.txt", number.topoints(tex.dimen.textwidth)) \stopluacode \typefile{settings.txt} \stoptext ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
participants (2)
-
Hans Hagen
-
Henning Hraban Ramm