ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <j.hagen@xs4all.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: [NTG-context] new upload
Date: Tue, 15 Aug 2023 19:08:19 +0200	[thread overview]
Message-ID: <5c815076-7a4d-2e27-d10e-8694e5d928ba@xs4all.nl> (raw)

Hi,

I uploaded a new lmtx (some new - experimental - things will be 
explained after the ctx meeting), but there's one thing that is somewhat 
important.

In addition to the built in units we can now have so called user units. 
There is some more info about this in the lowlevel-registers manual. One 
of the predefined units is 'uu' with an associated \ununit (dimension) 
variable and it's is also interfaced to metafun. That means that when 
you use uu in metapost graphics you have to make sure that you save the 
meaning and/or numeric uu now.

The idea is that just as in mp one can say 20xx with xx being a (sort 
of) unit, one can do the same in tex. Think of

\newdimension \MyUnitA  \MyUnitA 1.23pt

\pushoverloadmode % just in case
     \newuserunit\MyUnitA ua % binds the unit to the variable
\popoverloadmode

x\hskip 10ua\relax x

The units starting with 'u' are considered user units but be carefulk 
with other combinations as we have (and will have more) built into 
context ones, like

pi : pi for Mikael
ft : foot for Alan
fs : (global body) font size
tw : (layout) text width
th : (layout) text height
hs : (current) hsize
vs : (current) vsize
cd : (when set) column distance
cw : (when set) column width
cx : combination cell width
uu : user unit (\METAFUN)

So Mikael can now have

   test \hskip 3pi\relax test

and Alan can have

   \setuplayout
     [width=1ft]

to be consistent with inches.

The reason why we have this mechanism is that it provides a level of 
abstraction. It might evolve over time but don't expect the 600+ units 
possible to show up because one needs sensible shortcuts. Already built 
in unit always win and you cna only bind to already defined quantities.

Here's one for those who want to go beyond the normal:

\newdimension \FooA   \FooA 1.23pt
\newdimen     \FooB   \FooB 12.3pt
\protected\def\FooC   {\the\dimexpr\FooA +\FooB\relax}

So you can now figure how 'cx' is defined in a dynamic way.


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 / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

             reply	other threads:[~2023-08-15 17:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-15 17:08 Hans Hagen [this message]
2023-08-15 19:27 ` [NTG-context] " Pablo Rodriguez
2023-08-15 20:16   ` Hans Hagen via ntg-context
2023-08-15 20:54     ` Pablo Rodriguez
2023-08-16  8:07       ` Hans Hagen via ntg-context
2023-08-16 17:46       ` Hans Hagen via ntg-context
2023-08-17 13:39         ` Pablo Rodriguez
  -- strict thread matches above, loose matches on Subject: below --
2024-06-18 20:15 [NTG-context] " Hans Hagen
2023-09-04 17:22 Hans Hagen
2023-07-18 20:12 Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5c815076-7a4d-2e27-d10e-8694e5d928ba@xs4all.nl \
    --to=j.hagen@xs4all.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).