ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* sorted phone directory
@ 2011-08-02  9:08 Johan Sandblom
  2011-08-02 10:44 ` Jaroslav Hajtmar
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Johan Sandblom @ 2011-08-02  9:08 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 847 bytes --]

I am maintaining a small vademecum for my workplace. One of the things
it contains is a list of handy phone numbers, which should be sorted.
Until now I have used the attached hack. It has worked reasonably well
until the directory outgrew the one page. Before I start to modify my
hack it occurred to me that ConTeXt most likely has a machinery for
this already. It is a sort of register, after all. I have looked in
the manual at registers and sorted lists but have not been able to
find what I want. The desired specifications are:

1. columns (to save space)
2. sorted (in a correct Swedish order)
3. spans several pages

Thanks for any pointers, Johan

-- 
Johan Sandblom, MD PhD
m +46735521477  Sweden
"What is wanted is not the will to believe, but the
will to find out, which is the exact opposite"
- Bertrand Russell

[-- Attachment #2: minimaltele.tex --]
[-- Type: application/x-tex, Size: 920 bytes --]

[-- Attachment #3: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: sorted phone directory
  2011-08-02  9:08 sorted phone directory Johan Sandblom
@ 2011-08-02 10:44 ` Jaroslav Hajtmar
  2011-08-02 11:15 ` Pontus Lurcock
  2011-08-02 11:33 ` Wolfgang Schuster
  2 siblings, 0 replies; 15+ messages in thread
From: Jaroslav Hajtmar @ 2011-08-02 10:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello Johan.
I wonder whether it would be better to have a list of telephone numbers 
in an external file (eg csv file) that can handle aplication such as 
Excel or Calc. The list is sorted by this instrument and ConTeXt would 
just typed data from external file. For practical reasons it would be 
better to have that list in an external file.
I do these things with my scancsv.lua tool. Now I finishing module for 
ConTeXt.
see 
http://public.hajtmar.com/?cesta=JRsVFQdsBhwIWyAGFFsAJkBJQURsAgsVByYcDREAKh0X

Jaroslav Hajtmar


Dne 2.8.2011 11:08, Johan Sandblom napsal(a):

> I am maintaining a small vademecum for my workplace. One of the things
> it contains is a list of handy phone numbers, which should be sorted.
> Until now I have used the attached hack. It has worked reasonably well
> until the directory outgrew the one page. Before I start to modify my
> hack it occurred to me that ConTeXt most likely has a machinery for
> this already. It is a sort of register, after all. I have looked in
> the manual at registers and sorted lists but have not been able to
> find what I want. The desired specifications are:
>
> 1. columns (to save space)
> 2. sorted (in a correct Swedish order)
> 3. spans several pages
>
> Thanks for any pointers, Johan
>
>    
>
>
> ___________________________________________________________________________________
> 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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: sorted phone directory
  2011-08-02  9:08 sorted phone directory Johan Sandblom
  2011-08-02 10:44 ` Jaroslav Hajtmar
@ 2011-08-02 11:15 ` Pontus Lurcock
  2011-08-02 11:33 ` Wolfgang Schuster
  2 siblings, 0 replies; 15+ messages in thread
From: Pontus Lurcock @ 2011-08-02 11:15 UTC (permalink / raw)
  To: ntg-context

On Tue 02 Aug 2011, Johan Sandblom wrote:

> I am maintaining a small vademecum for my workplace. One of the things
> it contains is a list of handy phone numbers, which should be sorted.
> Until now I have used the attached hack. It has worked reasonably well
> until the directory outgrew the one page.

So if I understand correctly, everything is fine except that your
current solution only works for a single page? If so, replacing
\bTABLE with \bTABLE[split=yes] should do the trick. (Sorry, don't
have time to test this now, but it is documented at
http://wiki.contextgarden.net/TABLE .)

Hope this helps,

Pont
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: sorted phone directory
  2011-08-02  9:08 sorted phone directory Johan Sandblom
  2011-08-02 10:44 ` Jaroslav Hajtmar
  2011-08-02 11:15 ` Pontus Lurcock
@ 2011-08-02 11:33 ` Wolfgang Schuster
  2011-08-02 14:08   ` Johan Sandblom
  2 siblings, 1 reply; 15+ messages in thread
From: Wolfgang Schuster @ 2011-08-02 11:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 02.08.2011 um 11:08 schrieb Johan Sandblom:

> I am maintaining a small vademecum for my workplace. One of the things
> it contains is a list of handy phone numbers, which should be sorted.
> Until now I have used the attached hack. It has worked reasonably well
> until the directory outgrew the one page. Before I start to modify my
> hack it occurred to me that ConTeXt most likely has a machinery for
> this already. It is a sort of register, after all. I have looked in
> the manual at registers and sorted lists but have not been able to
> find what I want. The desired specifications are:
> 
> 1. columns (to save space)
> 2. sorted (in a correct Swedish order)
> 3. spans several pages


Alternative solution with ConTeXt’s sorting mechanism:

\mainlanguage[swedish]

\definedescription
  [TelefonEntry]
  [width=2em]

\unexpanded\def\TelefonCommand#1#2#3%
  {\startTelefonEntry{#2}#3\stopTelefonEntry}

\definesorting[Telefon][Telefone]

\starttext

\Telefon[a]{78423}
\Telefon[b]{78264}
\Telefon[ö]{78264}
\Telefon[Ö]{23423}
\Telefon[å]{23402394}
\Telefon[åå]{23042}
\Telefon[ååå]{098234}

\startcolumns[n=3]
\placelistofsorts[Telefon][criterium=all,command=\TelefonCommand]
\stopcolumns

\stoptext

Wolfgang

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: sorted phone directory
  2011-08-02 11:33 ` Wolfgang Schuster
@ 2011-08-02 14:08   ` Johan Sandblom
  2011-08-02 14:23     ` Wolfgang Schuster
  2011-08-02 20:05     ` Thomas A. Schmitz
  0 siblings, 2 replies; 15+ messages in thread
From: Johan Sandblom @ 2011-08-02 14:08 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Thank you for your suggestions!

Jaroslav, having the numbers in a separate file and sorting there,
while possible, would increase overhead in managing the document and
make it impossible to enter phone numbers at other places in the text.

Pontus, splitting the table over pages would interact poorly with
columns since the first entry on the second page would be the one
after the last in the first column on the first page:
1  6 11
2  7 12
3  8 13

4  9 14
5 10 15

Wolfgang, this is what I was hoping for, but there are some problems:
- the numbers should be flush right
- in the real file entries are longer than in my example file, but
none so long as to require a line break.  Here many entries require a
line break and the next entry runs over the second line of the broken
entry. See a slightly more realistic example below.

Gratefully, Johan

\mainlanguage[swedish]

\definedescription
 [TelefonEntry]
 [width=2em]

\unexpanded\def\TelefonCommand#1#2#3%
 {\startTelefonEntry{#2}#3\stopTelefonEntry}

\definesorting[Telefon][Telefone]

\starttext

\Telefon[Eldallah Awdawebi]{78423}
\Telefon[Nada Pipidepaulou]{78264}
\Telefon[Aölaksd aölksd]{044578264}
\Telefon[Ö]{320399}
\Telefon[å]{23402394}
\Telefon[åå]{23042}
\Telefon[ååå]{098234}

\startcolumns[n=3]
\placelistofsorts[Telefon][criterium=all,command=\TelefonCommand]
\stopcolumns

\stoptext

2011/8/2 Wolfgang Schuster <schuster.wolfgang@googlemail.com>:
>
> Am 02.08.2011 um 11:08 schrieb Johan Sandblom:
>
>> I am maintaining a small vademecum for my workplace. One of the things
>> it contains is a list of handy phone numbers, which should be sorted.
>> Until now I have used the attached hack. It has worked reasonably well
>> until the directory outgrew the one page. Before I start to modify my
>> hack it occurred to me that ConTeXt most likely has a machinery for
>> this already. It is a sort of register, after all. I have looked in
>> the manual at registers and sorted lists but have not been able to
>> find what I want. The desired specifications are:
>>
>> 1. columns (to save space)
>> 2. sorted (in a correct Swedish order)
>> 3. spans several pages
>
>
> Alternative solution with ConTeXt’s sorting mechanism:
>
> \mainlanguage[swedish]
>
> \definedescription
>  [TelefonEntry]
>  [width=2em]
>
> \unexpanded\def\TelefonCommand#1#2#3%
>  {\startTelefonEntry{#2}#3\stopTelefonEntry}
>
> \definesorting[Telefon][Telefone]
>
> \starttext
>
> \Telefon[a]{78423}
> \Telefon[b]{78264}
> \Telefon[ö]{78264}
> \Telefon[Ö]{23423}
> \Telefon[å]{23402394}
> \Telefon[åå]{23042}
> \Telefon[ååå]{098234}
>
> \startcolumns[n=3]
> \placelistofsorts[Telefon][criterium=all,command=\TelefonCommand]
> \stopcolumns
>
> \stoptext
>
> Wolfgang
>
> ___________________________________________________________________________________
> 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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
>



-- 
Johan Sandblom, MD PhD
m +46735521477  Sweden
"What is wanted is not the will to believe, but the
will to find out, which is the exact opposite"
- Bertrand Russell
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: sorted phone directory
  2011-08-02 14:08   ` Johan Sandblom
@ 2011-08-02 14:23     ` Wolfgang Schuster
  2011-08-02 14:50       ` Johan Sandblom
  2011-08-02 20:05     ` Thomas A. Schmitz
  1 sibling, 1 reply; 15+ messages in thread
From: Wolfgang Schuster @ 2011-08-02 14:23 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 02.08.2011 um 16:08 schrieb Johan Sandblom:

> Wolfgang, this is what I was hoping for, but there are some problems:
> - the numbers should be flush right
> - in the real file entries are longer than in my example file, but
> none so long as to require a line break.  Here many entries require a
> line break and the next entry runs over the second line of the broken
> entry. See a slightly more realistic example below.
> 
> Gratefully, Johan
> 
> \unexpanded\def\TelefonCommand#1#2#3%
> {\startTelefonEntry{#2}#3\stopTelefonEntry}

\unexpanded\def\TelefonCommand#1#2#3%
  {\maxaligned{#2\hfil#3}\par}

Wolfgang

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: sorted phone directory
  2011-08-02 14:23     ` Wolfgang Schuster
@ 2011-08-02 14:50       ` Johan Sandblom
  2011-08-02 15:01         ` Wolfgang Schuster
  0 siblings, 1 reply; 15+ messages in thread
From: Johan Sandblom @ 2011-08-02 14:50 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Thank you. Unfortunately I get the following:

Running `LuaConTeXt' on `minimaltele2' with ``context minimaltele2.tex''

mtx-context     | run 1: luatex
--fmt="/home/johans/context/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/cont-en"
--lua="/home/johans/context/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/cont-en.lui"
--backend="pdf" "./minimaltele2.tex"
This is LuaTeX, Version beta-0.70.1-2011051923 (rev 4277)
 \write18 enabled.
(minimaltele2.tex

ConTeXt  ver: 2011.05.18 22:26 MKIV  fmt: 2011.6.25  int: english/english

system          > cont-new.mkiv loaded
(/home/johans/context/tex/texmf-context/tex/context/base/cont-new.mkiv
system          > beware: some patches loaded from cont-new.mkiv
)
system          > minimaltele2.top loaded
(minimaltele2.top)
fonts           > latin modern fonts are not preloaded
languages       > language en is active
{/home/johans/context/tex/texmf-context/fonts/map/pdftex/context/mkiv-base.map}fonts
          > preloading latin modern fonts (second stage)
(/home/johans/context/tex/texmf-context/tex/context/base/type-siz.mkiv)
(/home/johans/context/tex/texmf-context/tex/context/base/type-otf.mkiv){/home/johans/context/tex/texmf/fonts/map/dvips/lm/lm-math.map}{/home/johans/context/tex/texmf/fonts/map/dvips/lm/lm-rm.map}
fonts           > virtual math > unable to resolve name mapsfromchar
fonts           > fallback modern rm 12pt is loaded
system          > begin file minimaltele2.tex at line 14
! Undefined control sequence.

system          > tex > error on line 1 in file minimaltele2.tex:
Undefined control sequence ...

 1 >>  \mainlanguage[swedish]
 2
 3     \definedescription
 4      [TelefonEntry]
 5      [width=2em]
 6
 7     %%\unexpanded\def\TelefonCommand#1#2#3%
 8     %% {\startTelefonEntry{#2}#3\stopTelefonEntry}
 9     \unexpanded\def\TelefonCommand#1#2#3%
10       {\maxaligned{#2\hfil#3}\par}
11


\TelefonCommand #1#2#3->\maxaligned
                                    {#2\hfil #3}\par
l.1 ...tingentry{1}{Aölaksd aölksd}{044578264}{}

\doplacelistofsorts ...gparameter \c!method ", })}
                                                  \stoppacked \endgroup
l.25 ...on][criterium=all,command=\TelefonCommand]

?

2011/8/2 Wolfgang Schuster <schuster.wolfgang@googlemail.com>:
>
> Am 02.08.2011 um 16:08 schrieb Johan Sandblom:
>
>> Wolfgang, this is what I was hoping for, but there are some problems:
>> - the numbers should be flush right
>> - in the real file entries are longer than in my example file, but
>> none so long as to require a line break.  Here many entries require a
>> line break and the next entry runs over the second line of the broken
>> entry. See a slightly more realistic example below.
>>
>> Gratefully, Johan
>>
>> \unexpanded\def\TelefonCommand#1#2#3%
>> {\startTelefonEntry{#2}#3\stopTelefonEntry}
>
> \unexpanded\def\TelefonCommand#1#2#3%
>  {\maxaligned{#2\hfil#3}\par}
>
> Wolfgang
>
> ___________________________________________________________________________________
> 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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
>



-- 
Johan Sandblom, MD PhD
m +46735521477  Sweden
"What is wanted is not the will to believe, but the
will to find out, which is the exact opposite"
- Bertrand Russell
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: sorted phone directory
  2011-08-02 14:50       ` Johan Sandblom
@ 2011-08-02 15:01         ` Wolfgang Schuster
  2011-08-02 15:10           ` Johan Sandblom
  0 siblings, 1 reply; 15+ messages in thread
From: Wolfgang Schuster @ 2011-08-02 15:01 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 02.08.2011 um 16:50 schrieb Johan Sandblom:

> Thank you. Unfortunately I get the following:
> 
> ! Undefined control sequence.
> 
> \TelefonCommand #1#2#3->\maxaligned

You can replace “\maxaligned” with “\hbox to \hsize”.

The command is rather new and the ConTeXt version of \line (\hbox to \hsize) from plain TeX.

Wolfgang
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: sorted phone directory
  2011-08-02 15:01         ` Wolfgang Schuster
@ 2011-08-02 15:10           ` Johan Sandblom
  2011-08-02 15:15             ` Johan Sandblom
  2011-08-02 15:19             ` Wolfgang Schuster
  0 siblings, 2 replies; 15+ messages in thread
From: Johan Sandblom @ 2011-08-02 15:10 UTC (permalink / raw)
  To: mailing list for ConTeXt users

I updated to no avail. Perhaps I need to get a newer luatex? I also
tried to change \midaligned to \hbox to \hsize and got another
problem. Curiously it is now located on line 4 of the input file
regardless of whethter line 4 is a comment or not.

Johan

Running `LuaConTeXt' on `minimaltele2' with ``context minimaltele2.tex''

mtx-context     | run 1: luatex
--fmt="/home/johans/context/tex/texmf-cache/luatex-cache/context/2448223e6631addb83df348d74153606/formats/cont-en"
--lua="/home/johans/context/tex/texmf-cache/luatex-cache/context/2448223e6631addb83df348d74153606/formats/cont-en.lui"
--backend="pdf" "./minimaltele2.tex" \stoptext
This is LuaTeX, Version beta-0.70.1-2011051923 (rev 4277)
 \write18 enabled.
(minimaltele2.tex

ConTeXt  ver: 2011.07.26 09:17 MKIV  fmt: 2011.8.2  int: english/english

system          > cont-new.mkiv loaded
(/home/johans/context/tex/texmf-context/tex/context/base/cont-new.mkiv
system          > beware: some patches loaded from cont-new.mkiv
)
system          > minimaltele2.top loaded
(minimaltele2.top)
fonts           > latin modern fonts are not preloaded
languages       > language en is active
{/home/johans/context/tex/texmf-context/fonts/map/pdftex/context/mkiv-base.map}fonts
          > preloading latin modern fonts (second stage)
(/home/johans/context/tex/texmf-context/tex/context/base/type-siz.mkiv)
(/home/johans/context/tex/texmf-context/tex/context/base/type-otf.mkiv)
files           > readfile > asked name: 'loc', not found
{/home/johans/context/tex/texmf/fonts/map/dvips/lm/lm-math.map}{/home/johans/context/tex/texmf/fonts/map/dvips/lm/lm-rm.map}
fonts           > virtual math > unable to resolve name mapsfromchar
fonts           > fallback modern rm 12pt is loaded
! Undefined control sequence.

system          > tex > error on line 4 in file minimaltele2.tex:
Undefined control sequence ...

 1     \mainlanguage[swedish]
 2
 3     %%\definedescription
 4 >>  %% [TelefonEntry]
 5     %% [width=2em]
 6
 7     %%\unexpanded\def\TelefonCommand#1#2#3%
 8     %% {\startTelefonEntry{#2}#3\stopTelefonEntry}
 9     \unexpanded\def\TelefonCommand#1#2#3%
10       {\hbox to \hsize{#2\hfil#3}\par}
11
12     \definesorting[Telefon][Telefone]
13
14     \starttext

<argument> \fakewords
                      {1}{1}
\TelefonCommand ...#3->\hbox to \hsize {#2\hfil #3
                                                  }\par
l.4 \sortingentry{1}{Ö}{\fakewords {1}{1}}{}

\doplacelistofsorts ...gparameter \c!method ", })}
                                                  \stoppacked \endgroup
l.25 ...on][criterium=all,command=\TelefonCommand]

?

2011/8/2 Wolfgang Schuster <schuster.wolfgang@googlemail.com>:
>
> Am 02.08.2011 um 16:50 schrieb Johan Sandblom:
>
>> Thank you. Unfortunately I get the following:
>>
>> ! Undefined control sequence.
>>
>> \TelefonCommand #1#2#3->\maxaligned
>
> You can replace “\maxaligned” with “\hbox to \hsize”.
>
> The command is rather new and the ConTeXt version of \line (\hbox to \hsize) from plain TeX.
>
> Wolfgang
> ___________________________________________________________________________________
> 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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
>



-- 
Johan Sandblom, MD PhD
m +46735521477  Sweden
"What is wanted is not the will to believe, but the
will to find out, which is the exact opposite"
- Bertrand Russell
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: sorted phone directory
  2011-08-02 15:10           ` Johan Sandblom
@ 2011-08-02 15:15             ` Johan Sandblom
  2011-08-02 15:19             ` Wolfgang Schuster
  1 sibling, 0 replies; 15+ messages in thread
From: Johan Sandblom @ 2011-08-02 15:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Sorry that was my fault for not cleaning up the .tuc-file or some
such. Thank you, now it works perfectly.

Johan

2011/8/2 Johan Sandblom <jsandblom@gmail.com>:
> I updated to no avail. Perhaps I need to get a newer luatex? I also
> tried to change \midaligned to \hbox to \hsize and got another
> problem. Curiously it is now located on line 4 of the input file
> regardless of whethter line 4 is a comment or not.
>
> Johan
>
> Running `LuaConTeXt' on `minimaltele2' with ``context minimaltele2.tex''
>
> mtx-context     | run 1: luatex
> --fmt="/home/johans/context/tex/texmf-cache/luatex-cache/context/2448223e6631addb83df348d74153606/formats/cont-en"
> --lua="/home/johans/context/tex/texmf-cache/luatex-cache/context/2448223e6631addb83df348d74153606/formats/cont-en.lui"
> --backend="pdf" "./minimaltele2.tex" \stoptext
> This is LuaTeX, Version beta-0.70.1-2011051923 (rev 4277)
>  \write18 enabled.
> (minimaltele2.tex
>
> ConTeXt  ver: 2011.07.26 09:17 MKIV  fmt: 2011.8.2  int: english/english
>
> system          > cont-new.mkiv loaded
> (/home/johans/context/tex/texmf-context/tex/context/base/cont-new.mkiv
> system          > beware: some patches loaded from cont-new.mkiv
> )
> system          > minimaltele2.top loaded
> (minimaltele2.top)
> fonts           > latin modern fonts are not preloaded
> languages       > language en is active
> {/home/johans/context/tex/texmf-context/fonts/map/pdftex/context/mkiv-base.map}fonts
>          > preloading latin modern fonts (second stage)
> (/home/johans/context/tex/texmf-context/tex/context/base/type-siz.mkiv)
> (/home/johans/context/tex/texmf-context/tex/context/base/type-otf.mkiv)
> files           > readfile > asked name: 'loc', not found
> {/home/johans/context/tex/texmf/fonts/map/dvips/lm/lm-math.map}{/home/johans/context/tex/texmf/fonts/map/dvips/lm/lm-rm.map}
> fonts           > virtual math > unable to resolve name mapsfromchar
> fonts           > fallback modern rm 12pt is loaded
> ! Undefined control sequence.
>
> system          > tex > error on line 4 in file minimaltele2.tex:
> Undefined control sequence ...
>
>  1     \mainlanguage[swedish]
>  2
>  3     %%\definedescription
>  4 >>  %% [TelefonEntry]
>  5     %% [width=2em]
>  6
>  7     %%\unexpanded\def\TelefonCommand#1#2#3%
>  8     %% {\startTelefonEntry{#2}#3\stopTelefonEntry}
>  9     \unexpanded\def\TelefonCommand#1#2#3%
> 10       {\hbox to \hsize{#2\hfil#3}\par}
> 11
> 12     \definesorting[Telefon][Telefone]
> 13
> 14     \starttext
>
> <argument> \fakewords
>                      {1}{1}
> \TelefonCommand ...#3->\hbox to \hsize {#2\hfil #3
>                                                  }\par
> l.4 \sortingentry{1}{Ö}{\fakewords {1}{1}}{}
>
> \doplacelistofsorts ...gparameter \c!method ", })}
>                                                  \stoppacked \endgroup
> l.25 ...on][criterium=all,command=\TelefonCommand]
>
> ?
>
> 2011/8/2 Wolfgang Schuster <schuster.wolfgang@googlemail.com>:
>>
>> Am 02.08.2011 um 16:50 schrieb Johan Sandblom:
>>
>>> Thank you. Unfortunately I get the following:
>>>
>>> ! Undefined control sequence.
>>>
>>> \TelefonCommand #1#2#3->\maxaligned
>>
>> You can replace “\maxaligned” with “\hbox to \hsize”.
>>
>> The command is rather new and the ConTeXt version of \line (\hbox to \hsize) from plain TeX.
>>
>> Wolfgang
>> ___________________________________________________________________________________
>> 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://tex.aanhet.net
>> archive  : http://foundry.supelec.fr/projects/contextrev/
>> wiki     : http://contextgarden.net
>> ___________________________________________________________________________________
>>
>
>
>
> --
> Johan Sandblom, MD PhD
> m +46735521477  Sweden
> "What is wanted is not the will to believe, but the
> will to find out, which is the exact opposite"
> - Bertrand Russell
>



-- 
Johan Sandblom, MD PhD
m +46735521477  Sweden
"What is wanted is not the will to believe, but the
will to find out, which is the exact opposite"
- Bertrand Russell
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: sorted phone directory
  2011-08-02 15:10           ` Johan Sandblom
  2011-08-02 15:15             ` Johan Sandblom
@ 2011-08-02 15:19             ` Wolfgang Schuster
  2011-08-02 20:05               ` Johan Sandblom
  1 sibling, 1 reply; 15+ messages in thread
From: Wolfgang Schuster @ 2011-08-02 15:19 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 02.08.2011 um 17:10 schrieb Johan Sandblom:

> I updated to no avail. Perhaps I need to get a newer luatex? I also
> tried to change \midaligned to \hbox to \hsize and got another
> problem. Curiously it is now located on line 4 of the input file
> regardless of whethter line 4 is a comment or not.

Do you use the \fakewords command in your document?

Wolfgang
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: sorted phone directory
  2011-08-02 14:08   ` Johan Sandblom
  2011-08-02 14:23     ` Wolfgang Schuster
@ 2011-08-02 20:05     ` Thomas A. Schmitz
  2011-08-03  2:41       ` Jaroslav Hajtmar
  1 sibling, 1 reply; 15+ messages in thread
From: Thomas A. Schmitz @ 2011-08-02 20:05 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 08/02/2011 04:08 PM, Johan Sandblom wrote:
> Thank you for your suggestions!
>
> Jaroslav, having the numbers in a separate file and sorting there,
> while possible, would increase overhead in managing the document and
> make it impossible to enter phone numbers at other places in the text.
>
Ultimately, it is of course your decision what you want to do, but I 
think you were a bit quick to reject Jaroslav's suggestion. TeX isn't 
meant to store databases. Having the information in some external file 
will actually make things much easier in the middle and long run. It's 
easier to manage, it scales better, and it will allow you to reuse this 
information in other ways. And ConTeXt is excellent in that it can 
handle many different input formats. I wrote something about using 
databases in xml or sql format in the latest MAPS issue; csv is easy to 
produce (libreoffice calc can produce csv). You could even store the 
information in a raw lua table and then retrieve it via some macros. I 
think the sorting itself should be done in ConTeXt because language 
support for the other solutions is probably not as straightforward (if 
it exists at all), but I would definitely store the information in some 
other format. Again, it is your decision, and of course we don't know 
what special requirements you have, but using some sort of well-known 
format would make your solution much more future-proof.

Good luck

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: sorted phone directory
  2011-08-02 15:19             ` Wolfgang Schuster
@ 2011-08-02 20:05               ` Johan Sandblom
  0 siblings, 0 replies; 15+ messages in thread
From: Johan Sandblom @ 2011-08-02 20:05 UTC (permalink / raw)
  To: mailing list for ConTeXt users

I attempted to make a more realistic example without divulging names
and numbers. There was no \fakewords in the file that I ran but
apparently still in some auxiliary file with the same name. When I
removed all other files it worked fine.

Johan

2011/8/2 Wolfgang Schuster <schuster.wolfgang@googlemail.com>:
>
> Am 02.08.2011 um 17:10 schrieb Johan Sandblom:
>
>> I updated to no avail. Perhaps I need to get a newer luatex? I also
>> tried to change \midaligned to \hbox to \hsize and got another
>> problem. Curiously it is now located on line 4 of the input file
>> regardless of whethter line 4 is a comment or not.
>
> Do you use the \fakewords command in your document?
>
> Wolfgang
> ___________________________________________________________________________________
> 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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
>



-- 
Johan Sandblom, MD PhD
m +46735521477  Sweden
"What is wanted is not the will to believe, but the
will to find out, which is the exact opposite"
- Bertrand Russell
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: sorted phone directory
  2011-08-02 20:05     ` Thomas A. Schmitz
@ 2011-08-03  2:41       ` Jaroslav Hajtmar
  2011-08-03  5:29         ` Johan Sandblom
  0 siblings, 1 reply; 15+ messages in thread
From: Jaroslav Hajtmar @ 2011-08-03  2:41 UTC (permalink / raw)
  To: ntg-context

Hello Johan,
Certainly it is possible to combine solution of Wolfgang with retrieving 
data from an external file without having to sort the data by another 
application. Enough to define a simple ConTeXt macro that contains a 
piece of Lua code. Here my modification of Wolfgang last solution for 
your inspiration:


\def\processexternalfile#1{
\startluacode
   myextfile=io.open('#1',"r")
     repeat
     line=myextfile:read()
       if line ~= nil then
         splitline=string.split(line, ",")
         context('\\Telefon['..splitline[1]..']{'..splitline[2]..'}')
       end
     until (line == nil)
   myextfile:close()
\stopluacode
}


\mainlanguage[swedish]

\definedescription
  [TelefonEntry]
  [width=2em]


\unexpanded\def\TelefonCommand#1#2#3%
   {\hbox to \hsize{#2\hfil#3}\par}


\definesorting[Telefon][Telefone]

\starttext


Wolfgang's solution:

\Telefon[Eldallah Awdawebi]{78423}
\Telefon[Nada Pipidepaulou]{78264}
\Telefon[Aölaksd aölksd]{044578264}
\Telefon[Ö]{320399}
\Telefon[å]{23402394}
\Telefon[åå]{23042}
\Telefon[ååå]{098234}

\startcolumns[n=3]
\placelistofsorts[Telefon][criterium=all,command=\TelefonCommand]
\stopcolumns


\blank[big]


% Create external CSV file "extfile.csv".
% Structure of this file is:

% Eldallah Awdawebi,78423
% Nada Pipidepaulou,78264
% Aölaksd aölksd,044578264
% Ö,320399
% å,23402394
% åå,23042
% ååå,098234


My solution - processing an external file \quotation{extfile.csv}:

\processexternalfile{extfile.csv}


\startcolumns[n=3]
\placelistofsorts[Telefon][criterium=all,command=\TelefonCommand]
\stopcolumns



\stoptext

Best regards
Jaroslav





Dne 2.8.2011 22:05, Thomas A. Schmitz napsal(a):
> On 08/02/2011 04:08 PM, Johan Sandblom wrote:
>> Thank you for your suggestions!
>>
>> Jaroslav, having the numbers in a separate file and sorting there,
>> while possible, would increase overhead in managing the document and
>> make it impossible to enter phone numbers at other places in the text.
>>
> Ultimately, it is of course your decision what you want to do, but I 
> think you were a bit quick to reject Jaroslav's suggestion. TeX isn't 
> meant to store databases. Having the information in some external file 
> will actually make things much easier in the middle and long run. It's 
> easier to manage, it scales better, and it will allow you to reuse 
> this information in other ways. And ConTeXt is excellent in that it 
> can handle many different input formats. I wrote something about using 
> databases in xml or sql format in the latest MAPS issue; csv is easy 
> to produce (libreoffice calc can produce csv). You could even store 
> the information in a raw lua table and then retrieve it via some 
> macros. I think the sorting itself should be done in ConTeXt because 
> language support for the other solutions is probably not as 
> straightforward (if it exists at all), but I would definitely store 
> the information in some other format. Again, it is your decision, and 
> of course we don't know what special requirements you have, but using 
> some sort of well-known format would make your solution much more 
> future-proof.
>
> Good luck
>
> 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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________ 
>
>

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: sorted phone directory
  2011-08-03  2:41       ` Jaroslav Hajtmar
@ 2011-08-03  5:29         ` Johan Sandblom
  0 siblings, 0 replies; 15+ messages in thread
From: Johan Sandblom @ 2011-08-03  5:29 UTC (permalink / raw)
  To: mailing list for ConTeXt users

I agree there may be advantages with a solution involving an external
file. The phone directory is slowly growing, but it has taken it years
to reach one page, so I am not sure the size of the database will ever
be a problem. The current solution works for now, but it is good to be
able to handle external files this way if the need arises.

Thank you for your opinions.

Johan

2011/8/3 Jaroslav Hajtmar <hajtmar@gyza.cz>:
> Hello Johan,
> Certainly it is possible to combine solution of Wolfgang with retrieving
> data from an external file without having to sort the data by another
> application. Enough to define a simple ConTeXt macro that contains a piece
> of Lua code. Here my modification of Wolfgang last solution for your
> inspiration:
>
>
> \def\processexternalfile#1{
> \startluacode
>  myextfile=io.open('#1',"r")
>    repeat
>    line=myextfile:read()
>      if line ~= nil then
>        splitline=string.split(line, ",")
>        context('\\Telefon['..splitline[1]..']{'..splitline[2]..'}')
>      end
>    until (line == nil)
>  myextfile:close()
> \stopluacode
> }
>
>
> \mainlanguage[swedish]
>
> \definedescription
>  [TelefonEntry]
>  [width=2em]
>
>
> \unexpanded\def\TelefonCommand#1#2#3%
>  {\hbox to \hsize{#2\hfil#3}\par}
>
>
> \definesorting[Telefon][Telefone]
>
> \starttext
>
>
> Wolfgang's solution:
>
> \Telefon[Eldallah Awdawebi]{78423}
> \Telefon[Nada Pipidepaulou]{78264}
> \Telefon[Aölaksd aölksd]{044578264}
> \Telefon[Ö]{320399}
> \Telefon[å]{23402394}
> \Telefon[åå]{23042}
> \Telefon[ååå]{098234}
>
> \startcolumns[n=3]
> \placelistofsorts[Telefon][criterium=all,command=\TelefonCommand]
> \stopcolumns
>
>
> \blank[big]
>
>
> % Create external CSV file "extfile.csv".
> % Structure of this file is:
>
> % Eldallah Awdawebi,78423
> % Nada Pipidepaulou,78264
> % Aölaksd aölksd,044578264
> % Ö,320399
> % å,23402394
> % åå,23042
> % ååå,098234
>
>
> My solution - processing an external file \quotation{extfile.csv}:
>
> \processexternalfile{extfile.csv}
>
>
> \startcolumns[n=3]
> \placelistofsorts[Telefon][criterium=all,command=\TelefonCommand]
> \stopcolumns
>
>
>
> \stoptext
>
> Best regards
> Jaroslav
>
>
>
>
>
> Dne 2.8.2011 22:05, Thomas A. Schmitz napsal(a):
>>
>> On 08/02/2011 04:08 PM, Johan Sandblom wrote:
>>>
>>> Thank you for your suggestions!
>>>
>>> Jaroslav, having the numbers in a separate file and sorting there,
>>> while possible, would increase overhead in managing the document and
>>> make it impossible to enter phone numbers at other places in the text.
>>>
>> Ultimately, it is of course your decision what you want to do, but I think
>> you were a bit quick to reject Jaroslav's suggestion. TeX isn't meant to
>> store databases. Having the information in some external file will actually
>> make things much easier in the middle and long run. It's easier to manage,
>> it scales better, and it will allow you to reuse this information in other
>> ways. And ConTeXt is excellent in that it can handle many different input
>> formats. I wrote something about using databases in xml or sql format in the
>> latest MAPS issue; csv is easy to produce (libreoffice calc can produce
>> csv). You could even store the information in a raw lua table and then
>> retrieve it via some macros. I think the sorting itself should be done in
>> ConTeXt because language support for the other solutions is probably not as
>> straightforward (if it exists at all), but I would definitely store the
>> information in some other format. Again, it is your decision, and of course
>> we don't know what special requirements you have, but using some sort of
>> well-known format would make your solution much more future-proof.
>>
>> Good luck
>>
>> 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://tex.aanhet.net
>> archive  : http://foundry.supelec.fr/projects/contextrev/
>> wiki     : http://contextgarden.net
>>
>> ___________________________________________________________________________________
>>
>
> ___________________________________________________________________________________
> 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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
>



-- 
Johan Sandblom, MD PhD
m +46735521477  Sweden
"What is wanted is not the will to believe, but the
will to find out, which is the exact opposite"
- Bertrand Russell
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2011-08-03  5:29 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-02  9:08 sorted phone directory Johan Sandblom
2011-08-02 10:44 ` Jaroslav Hajtmar
2011-08-02 11:15 ` Pontus Lurcock
2011-08-02 11:33 ` Wolfgang Schuster
2011-08-02 14:08   ` Johan Sandblom
2011-08-02 14:23     ` Wolfgang Schuster
2011-08-02 14:50       ` Johan Sandblom
2011-08-02 15:01         ` Wolfgang Schuster
2011-08-02 15:10           ` Johan Sandblom
2011-08-02 15:15             ` Johan Sandblom
2011-08-02 15:19             ` Wolfgang Schuster
2011-08-02 20:05               ` Johan Sandblom
2011-08-02 20:05     ` Thomas A. Schmitz
2011-08-03  2:41       ` Jaroslav Hajtmar
2011-08-03  5:29         ` Johan Sandblom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).