[NTG-context] mkiv digits/units zero padding not working

Benjamin Buchmuller benjamin.buchmuller at gmail.com
Thu May 7 19:41:20 CEST 2020

Hi Wolfang,

Thank you for your reply. I have indeed not explained my intended result very clearly. 


Primarily, I need to get the two values aligned at the digit separator of the first and second number respectively and overall at the ± sign. I’m working in an xtable, where I have entries such as

\startxcell \mpm{14.0==}{_1.5==} \stopxcell
\startxcell \mpm{_0.034}{_0.013} \stopxcell

and defined 


Since I was hoping that I could exploit the zeropadding of \digits to get the format right. Indeed, it would save a lot of typing, if I wouldn’t have to specify the padding manually and I vaguely recall that there is somewhere a ConTeXt solution that can make such alignments, but I simply can’t find it any more …

2. + 3.

Absolutely right, this is my bad. I have badly mixed from Hans’ solution to a similar problem, 


which was actually \def\zeroamount{-} and the example in the source, I didn’t read properly. Just skip that part. :)



\startxcell \mpm{14.==}{_1.5=} \stopxcell
\startxcell \mpm{_0.03}{_0.01} \stopxcell

aligns properly. But sometimes, I have the first digit specified, but not the second and unfortunately this doesn’t work

\startxcell \mpm{14.5=}{_1.5=} \stopxcell
\startxcell \mpm{_0.03}{_0.01} \stopxcell

because = is not immediately preceded by .

> On 7 May 2020, at 18:21, Wolfgang Schuster <wolfgang.schuster.lists at gmail.com> wrote:
> Benjamin Buchmuller schrieb am 07.05.2020 um 17:31:
>> Hi,
>> I’m trying to get
>> \digits{15.0=}±\digits{1.00}
>> \digits{_8.12}±\digits{0.34}
>> horizontally aligned as
>> 15.0 ±1.00
>>  8.12±0.34
>> But I get
>> 15.0±1.00
>>  8.12±0.34
>> instead.
>> From the source (phys-dim.mkiv), I can see that “=“ should expand to \hphantom{0}. (I think \zeropoint in the table is outdated, since \def\zeropoint\hphantom{0} does not solve the problem either.)
> 1. Which table?
> 2. This is not how \def works.
> 3. When you redefine \zeropoint (which isn't a macro) you're going to break everything.
>> I can’t use tabulate or alignment in math mode for this problem unfortunately.
> I looked at the code and the problem is = can only be used to insert space for two digits (e.g. 100.==).
> Wolfgang

More information about the ntg-context mailing list