A problem with autopunctuation
If I get it correctly, the following two formulae should render differently - and they don't. What is going on? \setupmathematics[autopunctuation=yes] \starttext $(2,5)$ versus $(2, 5)$ \stoptext Best, -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Adam Mickiewicz University
Am 03.11.2012 um 01:45 schrieb Marcin Borkowski
If I get it correctly, the following two formulae should render differently - and they don't. What is going on?
\setupmathematics[autopunctuation=yes]
\starttext
$(2,5)$ versus $(2, 5)$
\stoptext
Spaces in math mode are ignored because the spacing is controlled by different rules. \starttext \m{1.2}\par \m{1. 2}\par \m{1 .2}\par \m{1 . 2}\par \blank \m{1,2} \blank \setupmathematics[autopunctuation=yes]\m{1,2} \stoptext Wolfgang
On Sun, 4 Nov 2012, Wolfgang Schuster wrote:
Am 03.11.2012 um 01:45 schrieb Marcin Borkowski
: If I get it correctly, the following two formulae should render differently - and they don't. What is going on?
\setupmathematics[autopunctuation=yes]
\starttext
$(2,5)$ versus $(2, 5)$
\stoptext
Spaces in math mode are ignored because the spacing is controlled by different rules.
\starttext
\m{1.2}\par \m{1. 2}\par \m{1 .2}\par \m{1 . 2}\par
\blank
\m{1,2}
\blank
\setupmathematics[autopunctuation=yes]\m{1,2}
\stoptext
I always thought that autopunctuation was targetted towards the European tradition of using comma as a decimal separator. That behavior can be achieved by changing a comma to be an "ord" from a "punctuation". However, changing the comma to an "ord" has the drawback that you have to explicitly add spaces when comma is needed as a punctuation, for example in sets: \m{A = \{a,\, b,\, c\}} Autopunctuation is supposed to get around this: if comma is followed by a non-space, the comma should behave like an "ord"; if it is followed by a space, it should behave like a "punctuation". Clearly that is not happening. Aditya
Dnia 2012-11-04, o godz. 16:38:53
Aditya Mahajan
On Sun, 4 Nov 2012, Wolfgang Schuster wrote:
Am 03.11.2012 um 01:45 schrieb Marcin Borkowski
: If I get it correctly, the following two formulae should render differently - and they don't. What is going on?
\setupmathematics[autopunctuation=yes]
\starttext
$(2,5)$ versus $(2, 5)$
\stoptext
Spaces in math mode are ignored because the spacing is controlled by different rules.
\starttext
\m{1.2}\par \m{1. 2}\par \m{1 .2}\par \m{1 . 2}\par
\blank
\m{1,2}
\blank
\setupmathematics[autopunctuation=yes]\m{1,2}
\stoptext
I always thought that autopunctuation was targetted towards the European tradition of using comma as a decimal separator. That behavior can be achieved by changing a comma to be an "ord" from a "punctuation". However, changing the comma to an "ord" has the drawback that you have to explicitly add spaces when comma is needed as a punctuation, for example in sets:
\m{A = \{a,\, b,\, c\}}
Autopunctuation is supposed to get around this: if comma is followed by a non-space, the comma should behave like an "ord"; if it is followed by a space, it should behave like a "punctuation". Clearly that is not happening.
+1 This was exactly what I was expecting. (In LaTeX, there's even a package, called icomma AFAIR, which does more or less this.) As I often write mathematical texts in Polish, such a feature would be *very* useful for me. I could use \digits or \unit, but this has its drawbacks, too.
Aditya
Best, -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Adam Mickiewicz University
Reviving this thread, because MkIV's default behaviour is still improper. The current default of always adding a space after periods *and* commas is expected by nobody, I think. Revival prompted by a recent tex.se question: http://tex.stackexchange.com/questions/84911/number-kerning-in-context-math-... I've set out the behaviour below; A --> B means 'A displays as B'. MkIV should probably follow either MkII, or the behavior Aditya and Marcin proposed. (Actually, even if we choose MkII behavior, it would be nice to have the latter available, too. Maybe as an option autopunctuation=user? It would require someone to hack respace[math_char] in math-noa.lua, though.) Cheers, Sietse == This is MkIV's behaviour == Spaces are ignored. \setupmathematics[autopunctuation=no] (the default) 2,5 --> 2, 5 2.5 --> 2. 5 \setupmathematics[autopunctuation=yes] 2,5 --> 2,5 2.5 --> 2.5 Spaces are ignored. == This is MkII's behaviour == Spaces are ignored. Without \enablemathpunctuation (no \disablemathpunctuation): % default TeX behaviour 2.5 or 2. 5 --> 2.5 2,5 --> 2, 5 \enablemathpunctuation: 2.5 --> 2.5 2,5 --> 2,5 == This would be really nice == See Aditya and Marcin's mails, further up this thread. http://www.mail-archive.com/ntg-context@ntg.nl/msg66306.html http://www.mail-archive.com/ntg-context@ntg.nl/msg66307.html Spaces are significant. \setupmathematics[autopunctuation=no] % standard TeX behaviour 2,5 --> 2, 5 2, 5 --> 2, 5 2.5 --> 2.5 2. 5 --> 2.5 \setupmathematics[autopunctuation=yes] % user controls spacing without needing to type 2,\, 5 all the time % decimal-mark agnostic % but especially when the decimal mark is a comma 2,5 --> 2,5 2, 5 --> 2, 5 2.5 --> 2.5 2. 5 --> 2. 5
Forgot to add an MWE. %% Mkiv code \startTEXpage% \setupmathematics[autopunctuation=no]% $(2,5)$ versus $(2, 5)$ -- no \crlf $(2.5)$ versus $(2. 5)$ -- no \setupmathematics[autopunctuation=yes]% $(2,5)$ versus $(2, 5)$ -- yes \crlf $(2.5)$ versus $(2. 5)$ -- yes \stopTEXpage %% Mkii code \startTEXpage% $(2,5)$ versus $(2, 5)$ -- no \crlf $(2.5)$ versus $(2. 5)$ -- no \enablemathpunctuation $(2,5)$ versus $(2, 5)$ -- yes \crlf $(2.5)$ versus $(2. 5)$ -- yes \stopTEXpage
Hi, all, Hans has done some work on autopunctuation which made it into yesterday's beta (2012.12.03 11:33). This includes a 'set it like I type it' mode people have been asking for. There are now three options to \setupmathematics[autopunctuation=...]: * autopunctuation=no — default TeX behaviour. Commas get a thin space, periods get nothing. * autopunctuation=yes — manual control for commas. Commas followed by a space get a thin space; periods, and commas followed by something else, do not. * autopunctuation=all — like `yes`; and periods, too, get a thin space unless suppressed Example code below, example output attached, and the behaviour is documented at http://wiki.contextgarden.net/Command/setupmathematics Cheers, Sietse \defineparagraphs[asdf][n=3] \startTEXpage[offset=2mm] \startasdf \setupmathematics[autopunctuation=no] autopunctuation=no \starttabulate[||||] \NC input \NC desired \NC output \NC \NR \NC 2,5 \NC 2, 5 \NC $2,5$ \NC \NR \NC 2, 5 \NC 2, 5 \NC $2, 5$ \NC \NR \NC 2.5 \NC 2.5 \NC $2.5$ \NC \NR \NC 2. 5 \NC 2.5 \NC $2. 5$ \NC \NR \stoptabulate \asdf \setupmathematics[autopunctuation=yes] autopunctuation=yes \starttabulate[||||] \NC input \NC desired \NC output \NC \NR \NC 2,5 \NC 2,5 \NC $2,5$ \NC \NR \NC 2, 5 \NC 2, 5 \NC $2, 5$ \NC \NR \NC 2.5 \NC 2.5 \NC $2.5$ \NC \NR \NC 2. 5 \NC 2.5 \NC $2.5$ \NC \NR \stoptabulate \asdf \setupmathematics[autopunctuation=all] autopunctuation=all \starttabulate[||||] \NC input \NC desired \NC output \NC \NR \NC 2,5 \NC 2,5 \NC $2,5$ \NC \NR \NC 2, 5 \NC 2, 5 \NC $2, 5$ \NC \NR \NC 2.5 \NC 2.5 \NC $2.5$ \NC \NR \NC 2. 5 \NC 2. 5 \NC $2. 5$ \NC \NR \stoptabulate \stopasdf \stopTEXpage
participants (4)
-
Aditya Mahajan
-
Marcin Borkowski
-
Sietse Brouwer
-
Wolfgang Schuster