[MkIV] How to get the local size of a column
Hello, Is it possible to get the current width of a column from a paragraph into Lua ? Pierre-François. -- Bonnefoi Pierre-Francois | E-mail : bonnefoi@unilim.fr http://libpfb.so/ Universite de Limoges, Laboratoire XLIM | Tel : 06 28 18 03 38 123 av Albert Thomas | Mrs. Peel, we're needed... 87060 Limoges CEDEX - FRANCE | The Avengers.
On 5/18/2015 8:00 PM, Pierre-François Bonnefoi wrote:
Hello,
Is it possible to get the current width of a column from a paragraph into Lua ?
it all depends on where and how you access that but normally the width of a hlist will do
Pierre-François.
-- Bonnefoi Pierre-Francois | E-mail : bonnefoi@unilim.fr mailto:bonnefoi@unilim.fr http://libpfb.so/ Universite de Limoges, Laboratoire XLIM | Tel : 06 28 18 03 38 123 av Albert Thomas | Mrs. Peel, we're needed... 87060 Limoges CEDEX - FRANCE | The Avengers.
___________________________________________________________________________________ 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 ___________________________________________________________________________________
-- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Hello Hans, I try to get the equivalent of \the\hsize in Lua, in order to render some verbatim text to the current width of the column. Thank you for your help, Pierre-François.
On 19 May 2015, at 12:16, Hans Hagen
wrote: On 5/18/2015 8:00 PM, Pierre-François Bonnefoi wrote:
Hello,
Is it possible to get the current width of a column from a paragraph into Lua ?
it all depends on where and how you access that but normally the width of a hlist will do
Pierre-François.
-- Bonnefoi Pierre-Francois | E-mail : bonnefoi@unilim.fr mailto:bonnefoi@unilim.fr http://libpfb.so/ Universite de Limoges, Laboratoire XLIM | Tel : 06 28 18 03 38 123 av Albert Thomas | Mrs. Peel, we're needed... 87060 Limoges CEDEX - FRANCE | The Avengers.
___________________________________________________________________________________ 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 ___________________________________________________________________________________
--
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
-- Bonnefoi Pierre-Francois | E-mail : bonnefoi@unilim.fr http://libpfb.so/ Universite de Limoges, Laboratoire XLIM | Tel : 06 28 18 03 38 123 av Albert Thomas | Mrs. Peel, we're needed... 87060 Limoges CEDEX - FRANCE | The Avengers.
Am 19.05.2015 um 12:31 schrieb Pierre-François Bonnefoi
: Hello Hans,
I try to get the equivalent of \the\hsize in Lua, in order to render some verbatim text to the current width of the column.
Both dimensions are in scaled points. \starttext \cldcontext{tex.hsize} \cldcontext{tex.dimen["textwidth"]} \stoptext Wolfgang
Thank you ! tex.hzize / 2^16 gives me the expected value ! This is a lot to learn :)
On 19 May 2015, at 13:04, Wolfgang Schuster
wrote: contex
-- Bonnefoi Pierre-Francois | E-mail : bonnefoi@unilim.fr http://libpfb.so/ Universite de Limoges, Laboratoire XLIM | Tel : 06 28 18 03 38 123 av Albert Thomas | Mrs. Peel, we're needed... 87060 Limoges CEDEX - FRANCE | The Avengers.
Am 19.05.2015 um 14:25 schrieb Pierre-François Bonnefoi
: Thank you !
tex.hzize / 2^16 gives me the expected value !
This is a lot to learn :)
Take a look into util-dim.la and search for the number.todimen function which can be used to convert scaled points into points. \starttext \startluacode context(tex.hsize) context.par() context(number.topoints(tex.hsize)) context.par() context(number.topoints(tex.hsize,"%0.5f")) \stopluacode \stoptext Wolfgang
I've found a workaround by passing the value as an argument to the lua code : \def\stopzonetexte {\ctxlua{userdata.traiterbuffer(buffers.getcontent('zonetexte'),[==[\the\hsize]==])} Now, I try to figure how to get em size in points.
On 19 May 2015, at 12:31, Pierre-François Bonnefoi
wrote: Hello Hans,
I try to get the equivalent of \the\hsize in Lua, in order to render some verbatim text to the current width of the column.
Thank you for your help, Pierre-François.
On 19 May 2015, at 12:16, Hans Hagen
mailto:pragma@wxs.nl> wrote: On 5/18/2015 8:00 PM, Pierre-François Bonnefoi wrote:
Hello,
Is it possible to get the current width of a column from a paragraph into Lua ?
it all depends on where and how you access that but normally the width of a hlist will do
-- Bonnefoi Pierre-Francois | E-mail : bonnefoi@unilim.fr http://libpfb.so/ Universite de Limoges, Laboratoire XLIM | Tel : 06 28 18 03 38 123 av Albert Thomas | Mrs. Peel, we're needed... 87060 Limoges CEDEX - FRANCE | The Avengers.
participants (3)
-
Hans Hagen
-
Pierre-François Bonnefoi
-
Wolfgang Schuster