Zsh Mailing List Archive
Messages sorted by:
Re: How to impose a numeric sort on negative numbers?
> On 02 July 2020 at 12:36 Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> Peter Stephenson wrote on Wed, 01 Jul 2020 20:42 +0100:
> > +++ b/Doc/Zsh/expn.yo
> > @@ -1097,6 +1097,11 @@ are sorted before those with fewer or none. Hence the array `tt(foo1 foo02
> > foo2 foo3 foo20 foo23)' is sorted into the order shown.
> > May be combined with `tt(i)' or `tt(O)'.
> > )
> > +item(tt(DASH()))(
> > +As tt(n), but a leading minus sign indicates a negative decimal
> > +integer. A solo `tt(DASH())' not followed by an integer does
> > +not trigger numeric sorting.
> > +)
> In the texinfo build DASH() will emit _two_ hyphens, which would be
> incorrect in this context. I think both instances of DASH() should be
> changed to use a literal minus sign.
> The macro is defined as «DEFINEMACRO(DASH)(0)(ifztexi(--)ifnztexi(-))».
Heh. This stuff's complicated. The two dashes correspond to an en-dash
in TeX. If you look where DASH() is actually used in the text it's
in places where it gets combined with another dash --- which would
make an em-dash in TeX. Info is aware of this, so turns -- back into
a single minus. So compare the output from a use of DASH()- (not
a typo, there's an extra hyphen)...
of the backreferences fail to match -- which happens if they are in
- a visible two dashes, the usual convention to show it's a dash, not a hyphen
backreferences fail to match --- which happens if they are in an alternate
- three dashes, converted by TeX into an em-dash in print.
So it's sort of doing the right thing at least from the point of what's visible
However(!), what we really want here is indeed an ASCII hyphen, because this
is what your're typing. (It's not even actually a minus sign because this
is an input code, not a mathematical expression. For what it's worth, which
is very little, this would be different in TeX, $-$, but no other format I
know of really cares.)
I have a vague memory we got into problems with such things in YODL once,
which is why I used the macro. But looking at the current doc source doesn't
suggest any trace of it, so I'll abandon that. There have been many improvements
in YODL since then.
Messages sorted by: