Re: [NTG-context] (again) index sorting of accented characters

2017-04-27 Thread Thomas A. Schmitz

On 04/27/2017 10:26 PM, Pablo Rodriguez wrote:

Could you please confirm the issue?

Many thanks for your help,



Two remarks:

1. I'm not sure what you're looking for. Do you really want an index 
that sorts every form of every word as an entry? So that ἐμήν and ἐμοῖς 
are different words and not occurrences of the same entry? If that's 
really what you're looking for, you may want to look into a very handy 
luatex function: characters.shaped() returns the unaccented characters 
of a unicode string, see chapter 11.2 of cld-mkiv.pdf. Define your own 
command that uses this lua function to index the unaccented word; that's 
not too hard.


2. If, on the other hand, you want to build a real index that will sort 
morphological forms under their head words, you will have to give the 
sort term explicitly, and then you don't have to rely on ConTeXt's 
abilities to sort accented Greek because you will have something like 
ἐμήν\index{εμοσ} in your text. For the time being, there's no software 
that can reliably parse ancient Greek, I'm afraid.


Thomas
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] (again) index sorting of accented characters

2017-04-27 Thread Pablo Rodriguez
On 04/27/2017 08:51 PM, Thomas A. Schmitz wrote:
> On 04/27/2017 07:21 PM, Pablo Rodriguez wrote:
>> I mean, if this is the way, I have other two patches for other two
>> languages in which I have indices.
>>
>> And if I’m wrong, I would like to know how to get right word sorting in
>> registers.
> 
> Have you played with the different "methods" defined in sort-ini.lua, 
> lines 96-103?

Many thanks for your reply, Thomas.

The right values seem to be {zm, zc}. This works fine with Spanish and
French, but ancient Greek is more problematic.

I have a source file, http://www.ousia.tk/grc-index.tex. Standard
sorting gives the following results
http://www.ousia.tk/grc-index-standard.pdf#page=3.

When I add replacements (http://www.ousia.tk/grc-replacements.diff) to
sort-lan.lua, sorting order is right
(http://www.ousia.tk/grc-index-modified.pdf#page=3).

Could you please confirm the issue?

Many thanks for your help,

Pablo
-- 
http://www.ousia.tk
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] (again) index sorting of accented characters

2017-04-27 Thread Thomas A. Schmitz

On 04/27/2017 07:21 PM, Pablo Rodriguez wrote:

I mean, if this is the way, I have other two patches for other two
languages in which I have indices.

And if I’m wrong, I would like to know how to get right word sorting in
registers.


Have you played with the different "methods" defined in sort-ini.lua, 
lines 96-103?


Thomas
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Index with distinguishable entries -- again

2017-04-27 Thread Rik Kabel

On 2017-04-27 07:14, Florian Grammel wrote:

Thank you very much for your example -- it really helps a lot!

That’s one smart trick for the endnotes. It will do fine for my 
current project, but obviously it will not work for footnotes directly 
on the pages.
I had somehow hoped that there would be something like „if within some 
environment/command" to the processors. With this also the formating 
of the items within the captions could be done automatically.


A real problem though is that adding
\setupregister [index] [compress=yes]
will wrongly compress e.g. "aaa 1, 2, 1n“ to "aaa 1–1n“. I’ll need to 
use compressed ranges and would be happy with a result, where 
formatted numbers a subsumed under the regular ones.

You don’t happen to know how to make this work correctly, do you?


I do not think that it is wrong in the way it reports compressed page 
numbers. The aaa entry is indeed on those consecutive pages. Add some 
blank pages (or pages without the indexed items) and look at the result.


You can use the same method I showed with indexed terms in footnotes. 
Just create another processor and use it in within the indexing command 
in the footnote, or create a new command to wrap it, as


   \defineprocessor[Footnote][style=bold,color=blue]
   \define[1]\fnindex{\index[Footnote->]{#1}}

of course, if you use the optional indexunder component already ( 
\index[as if it were spelled this way]{displayed as} ) then you will 
have to create a more complex command. (I leave that as an exercise for 
those who need it and do not want to fall back to the \index command.) So:


   \defineprocessor [backpart] [style=slanted,right=n]
   \defineprocessor [Figure] [style=\tf,color=red,left=f]
   \defineprocessor [Footnote] [style=bold,color=blue]
   \define[1]\fnindex{\index[Footnote->]{#1}}
   \define[1]\fiindex{\index[Figure->]{#1}}
   \defineconversionset [backpart:pagenumber][][backpart->o]
   \setupuserpagenumber[way=byblock]
   \setuppagenumbering [location=none]
   \setupheadertexts[{\convertedcounter[userpage][numberconversionset=number]}]
   \setupregister[index][compress=yes]
   %\setupnote[footnote][location=none]
   \useMPlibrary[dum]
   \starttext
   \startbodymatter
   \startchapter[title=A chapter]
  \index{aaa}This is in the main body.\footnote{\fnindex{bbb}This
   is a footnote.}
   \stopchapter
   \startchapter[title={Another chapter}]
  \index{aaa}This is in the main body.\footnote{\fnindex{bbb}This
   is a footnote.}
  \startplacefigure[location=default,
  title={Body illustration\fiindex{ccc}}]
\externalfigure[dummy][]
  \stopplacefigure
   \stopchapter
   \startchapter[title=A third chapter]
  This is in the main body.\footnote{This is a footnote.}
   \stopchapter
   \startchapter[title=A fourth chapter]
  This is in the main body.
   \stopchapter
   \startchapter[title={Another chapter}]
  \index{aaa}This is in the main body.\footnote{\fnindex{bbb}This
   is a footnote.}
  \startplacefigure[location=default,
  title={Body illustration\fiindex{ccc}}]
\externalfigure[dummy][]
  \stopplacefigure
   \stopchapter
   \stopbodymatter
   \page
   \startbackmatter
   \startchapter[title=An appendix]
  This is in the backmatter.\index{aaa}\footnote{\index{bbb}This is
   a footnote.}
  \startplacefigure[location=default,
  title={Appendix illustration\index[Figure->]{ddd}}]
\externalfigure[dummy][]
  \stopplacefigure
   \stopchapter
   \startchapter[title=Notes]
  \placenotes[footnote]
   \stopchapter
   \startchapter[title=Index]
  \placeregister[index]
   \stopchapter
   \stopbackmatter
   \stoptext

Of course, there may be conflicts. You may index the same term twice on 
one page, once in the text, once in a footnote. Context will not choke, 
and there is a fifty-fifty chance it will default to what you want.


--
Rik
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

[NTG-context] (again) index sorting of accented characters

2017-04-27 Thread Pablo Rodriguez
Dear list,

sorry for bothering again with this issue, but I need to have indices in
my documents.

I have the following sample:

\mainlanguage[es]
\setupregister[method=default]
\starttext
\startTEXpage[offset=1em]
\index{ámame}\index{arisco}\index{ándrago}
\index{antonia}\index{antón}
\placeindex
\stopTEXpage
\stoptext

Word sorting is the following:

antonia
antón
arisco
ámame
ándrago

Right word order is:

ámame
ándrago
antón
antonia
arisco

In Spanish, as in other languages, an accented letter has no different
sorting that its unaccented counterpart.

I got the right word order adding these replacements in sort-lan.lua:

replacements = {
{ "á", "a" }, { "é", "i"}, { "í", "i" }, { "ó", "o"},
{ "ú", "u" }, { "ü", "u" },
},

Could anyone explain me whether this is the right way of doing it?

I mean, if this is the way, I have other two patches for other two
languages in which I have indices.

And if I’m wrong, I would like to know how to get right word sorting in
registers.

Many thanks for your help,

Pablo
-- 
http://www.ousia.tk
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] eqalignno failin

2017-04-27 Thread Meer, Hans van der

I had this code:

99 \placeformula\startformula
100 \eqalignno{
101 >>  H(I,J) &= H(I) + H(J|I)\qquad&\hbox{\ineq[eq:equivoc]}\cr
102 W(I,J) &= H(J) - H(J|I)\qquad&\hbox{\ineq[eq:wedinfo]}\cr
103 }
104 \stopformula

On 26 Apr 2017, at 16:38, Otared Kavian 
> wrote:

It is better to use the construction such as:

\placeformula
\startformula
\startalign
\NC H(I,J) \NC = H(I) + H(J|I) \NR[eq:equivoc]
\NC W(I,J) \NC = H(J) - H(J|I) \NR[eq:wedinfo]
\stopalign
\stopformula

Below I illustrate why this is not better, and I did not find a way how to 
remedy its effect.

This is the original produced by the \eqalignno. See the active links to 
previous equations in green, produced by my \ineq-macro.
The equation numbers here are from the 7th chapter, in the latter (shortened) 
examples the chapter number will be 1.
[cid:6BEAFFEE-7FE7-4CE4-AD45-DB0341A2EA25]

The suggested code gives:
[cid:CEBB66EC-83A5-4A10-A7E3-729FBBB24BD9]

Wrong because the numbers should refer to equations 1.21 and 1.28 instead of 
numbering forward.
Putting my \ineq-macro there
 \NC W(I,J) \NC H(J) - H(J|I)\NR\hbox{\ineq[eq:wedinfo]}
gives an equally unacceptable result:
[cid:ACE1072E-59D0-4310-8FC5-4E9E1FF3485C]



On 26 Apr 2017, at 16:38, Otared Kavian 
> also wrote:

Hi Hans,

Since a few weeks (or months?…) ago the use of \eqno and \eqalignno has been 
changed in mkiv.

A remark afterwards I really regret making. But I cannot understand why 
\eqalignno and friends have been changed from their original behaviour. It 
breaks older products of mine without warning. In fact I wouldn't have spotted 
this, had not a colleague drawn my attention to it. Is this the only math macro 
behaving differently, giving a TeX error? Are there others?

I cannot but ask most strongly not to let mkiv deviate in this manner from 
basic TeX's behaviour. I am doing a lot in ConTeXt but I mix it with parts of 
basic TeX. When I can no longer trust TeX doing like TeX I really don't know 
how to go further. Please return the original behaviour.

Thanks for looking into it.
Hans van der Meer




___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Index with distinguishable entries -- again

2017-04-27 Thread Florian Grammel
Thank you very much for your example -- it really helps a lot!

That’s one smart trick for the endnotes. It will do fine for my current 
project, but obviously it will not work for footnotes directly on the pages.
I had somehow hoped that there would be something like „if within some 
environment/command" to the processors. With this also the formating of the 
items within the captions could be done automatically.

A real problem though is that adding
\setupregister [index] [compress=yes]
will wrongly compress e.g. "aaa 1, 2, 1n“ to "aaa 1–1n“. I’ll need to use 
compressed ranges and would be happy with a result, where formatted numbers a 
subsumed under the regular ones.
You don’t happen to know how to make this work correctly, do you?

Best,
Florian.


> 
> On 2017-04-26 09:18, Florian Grammel wrote:
>> Back in april 2012 Robert Blackstone asked some questions about indexing
>> http://www.mail-archive.com/ntg-context@ntg.nl/msg63134.html 
>> 
>> i.a.:
>> 
>>> For a book in the area of musicology I would like to make one register with 
>>> entries of different kinds, distinguishable by their appearance in the  
>>> register (or index or whatever).
>>> The index entries will mostly be authors, including composers, musical 
>>> terms 
>>> and musical compositions. The titles of the compositions and the foreign 
>>> words 
>>> are set in italic characters throughout in the text of the book.
>>> What I would like is to be able to distinguish all entries according to 
>>> whether 
>>> they are treated in the text, are shown in a musical example, or are 
>>> mentioned 
>>> only in a foot- or endnote.
>>> 
>>> In many books page numbers indicating illustrations are set in italics. 
>>> Pagenumbers indicating foot- or endnotes often have a suffix "n".
>>> 
>> His other question were resolved, but this one remained unanswered, apart 
>> from that two other users also wanted to do exactly the same thing.
>> 
>> I would like to do something very similar and was wondering: Has this been 
>> addressed/solved since then?
>> 
>> 
> Perhaps the following can help. It has separate user page numbers for the 
> main matter and back matter, with a suffixed ‘n’ for the items indexed from 
> backmatter pages, but no suffix on the backmatter page numbers. The index 
> entries for figures are rubricated and have a leading ‘f’.
> 
> \defineprocessor [backpart] [style=slanted,right=n]
> \defineprocessor [Figure] [style=\tf,color=red,left=f]
> \defineconversionset [backpart:pagenumber][][backpart->o]
> \setupuserpagenumber[way=byblock]
> \setuppagenumbering [location=none]
> \setupheadertexts[{\convertedcounter[userpage][numberconversionset=number]}]
> \setupnote[footnote][location=none]
> \useMPlibrary[dum]
> \starttext
> \startbodymatter
> \startchapter[title=A chapter]
>   \index{aaa}This is in the main body.\footnote{\index{bbb}This is a 
> footnote.}
> \stopchapter
> \startchapter[title={Another chapter}]
>   \index{aaa}This is in the main body.\footnote{\index{bbb}This is a 
> footnote.}
>   \startplacefigure[location=default,
>   title={Body illustration\index[Figure->]{ccc}}]
> \externalfigure[dummy][]
>   \stopplacefigure
> \stopchapter
> \stopbodymatter
> \page
> \startbackmatter
> \startchapter[title=An appendix]
>   This is in the backmatter.\index{aaa}\footnote{\index{bbb}This is a 
> footnote.}
>   \startplacefigure[location=default,
>   title={Appendix illustration\index[Figure->]{ddd}}]
> \externalfigure[dummy][]
>   \stopplacefigure
> \stopchapter
> \startchapter[title=Notes]
>   \placenotes[footnote]
> \stopchapter
> \startchapter[title=Index]
>   \placeregister[index]
> \stopchapter
> \stopbackmatter
> \stoptext
> 
> -- 
> Rik
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___