Benjamin Buchmuller schrieb am 07.05.2020 um 19:41:
Hi Wolfang,
Thank you for your reply. I have indeed not explained my intended result very clearly.
1.
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
\def\mpm#1#2{ \ifsecondargument \digits{#1}\,±\,\digits{#2}% \else \digits{#1}% \fi }
Is there something missing in here because the \ifsecondargument check here makes non sense because the second argument is mandatory and not optional. Is this what you want? \define[2]\mpm {\digits{#1}% \doifsomething{#2}{\,±\,\digits{#2}}}
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 …
You can align number on the decimal point (comma) but this works only when you have only one number in a cell. \starttext \startxtable[aligncharacter=yes,alignmentcharacter=±] \startxrow \startxcell \digits {14.0} ± \digits {1.5} \stopxcell \stopxrow \startxrow \startxcell \digits {0.034} ± \digits {0.013} \stopxcell \stopxrow \stopxtable \stoptext
2. + 3.
Absolutely right, this is my bad. I have badly mixed from Hans’ solution to a similar problem,
https://www.mail-archive.com/ntg-context@ntg.nl/msg00724.html
which was actually \def\zeroamount{-} and the example in the source, I didn’t read properly. Just skip that part. :)
The message is from 2003!
4.
Indeed,
\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 .
Can you write another mail with a request for this. Wolfgang