Re: [NTG-context] \setvariables and database module

2018-02-01 Thread luigi scarso
On Wed, Jan 31, 2018 at 10:20 PM, Otared Kavian  wrote:
>
>
>> On 31 Jan 2018, at 18:11, Wolfgang Schuster  
>> wrote:
>>
>>> […]
>>> Thanks again, but I wonder where did you find this trick?… in i-context.pdf 
>>> there is no entry for \defineseparatedlist…
>>
>> setup-en.pdf (and i-context.pdf) contains only commands from the core. There 
>> are lists for many modules (e.g. i-database.xml contains the options for the 
>> database module) but no PDF which shows them.
>
> Indeed looking for the file i-database.xml I discovered that in
> context-minimal/tex/texmf-context/tex/context/interface/mkiv/
> there are lots of file such as i-ABC.xml, which can be typeset in order to 
> obtain a pdf.
> A great piece of information… thanks!
In the same folder:
i-context.pdf
i-readme.pdf



-- 
luigi
___
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] \setvariables and database module

2018-01-31 Thread Otared Kavian


> On 31 Jan 2018, at 18:11, Wolfgang Schuster  
> wrote:
> 
>> […]
>> Thanks again, but I wonder where did you find this trick?… in i-context.pdf 
>> there is no entry for \defineseparatedlist…
> 
> setup-en.pdf (and i-context.pdf) contains only commands from the core. There 
> are lists for many modules (e.g. i-database.xml contains the options for the 
> database module) but no PDF which shows them.

Indeed looking for the file i-database.xml I discovered that in
context-minimal/tex/texmf-context/tex/context/interface/mkiv/
there are lots of file such as i-ABC.xml, which can be typeset in order to 
obtain a pdf. 
A great piece of information… thanks!

Best regards: OK

___
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] \setvariables and database module

2018-01-31 Thread Wolfgang Schuster



Otared Kavian 
31. Januar 2018 um 17:58

Yes it does the job!
Thanks again, but I wonder where did you find this trick?… in 
i-context.pdf there is no entry for \defineseparatedlist…


setup-en.pdf (and i-context.pdf) contains only commands from the core. 
There are lists for many modules (e.g. i-database.xml contains the 
options for the database module) but no PDF which shows them.


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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] \setvariables and database module

2018-01-31 Thread Otared Kavian


> On 31 Jan 2018, at 17:40, Wolfgang Schuster  
> wrote:
> 
>> […]
>> 
> Add “strip=yes” to remove spaces around the cells.
> 
> \defineseparatedlist
>   [seplisttalk]
>   [separator={;},
>command=\maketalk,
>strip=yes]
> 

Yes it does the job! 
Thanks again, but I wonder where did you find this trick?… in i-context.pdf 
there is no entry for \defineseparatedlist…

Best regards: OK___
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] \setvariables and database module

2018-01-31 Thread Wolfgang Schuster



Otared Kavian 
30. Januar 2018 um 16:53
Hi again Wolfgang,

I think I understood what is going wrong with my example after your 
hint: I have to remove all spaces around the separator and remove also 
the braces around each entry.

That is the following works fine:

\startseplisttalk
Hacker;Up to date hacking;hacker.jpg
Hacker;Up to date hacking;hacker.jpg
\stopseplisttalk

while the following does not (as far as the filename is concerned):

\startseplisttalk
{Hacker};{Up to date hacking};{hacker.jpg}
Hacker ; Up to date hacking ; hacker.jpg
\stopseplisttalk


Add “strip=yes” to remove spaces around the cells.

\defineseparatedlist
  [seplisttalk]
  [separator={;},
   command=\maketalk,
   strip=yes]

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] \setvariables and database module

2018-01-30 Thread Otared Kavian


> On 30 Jan 2018, at 19:05, Wolfgang Schuster  
> wrote:
>> […]
> Spaces after a control sequence are gobbled and multiple spaces are skipped.
> 
> Braces around the filename are allowed because this function was added with 
> the extensions to the TeX binary (which means it doesn’t work with Knuths 
> original TeX), try this \input{ knuth.tex} to load a file with a space in the 
> name.

Yes, I understand now the rationale behind this behavior.
Many thanks!___
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] \setvariables and database module

2018-01-30 Thread Wolfgang Schuster



Otared Kavian 
30. Januar 2018 um 18:56

Thanks again! That does it.

However, it seems strange that the \externalfigure command does not 
accept a space in front of the file name nor after the file extension, 
while \input is very tolerant in that respect. Compare


\input   knuth.tex
\input knuth.tex
\input{knuth.tex}


Spaces after a control sequence are gobbled and multiple spaces are skipped.

Braces around the filename are allowed because this function was added 
with the extensions to the TeX binary (which means it doesn’t work with 
Knuths original TeX), try this \input{ knuth.tex} to load a file with a 
space in the name.


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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] \setvariables and database module

2018-01-30 Thread Otared Kavian
> On 30 Jan 2018, at 17:37, Wolfgang Schuster  
> wrote:
> 
>> […]
>> Is there a way to make the \defineseparatedlist command to be more tolerant 
>> for the filename? 
>> 
> No but you can remove the space with Lua.
> 
> \externalfigure[\cldcontext{string.collapsespaces("\getvariable{talk}{picture}")}]
> 

Thanks again! That does it.

However, it seems strange that the \externalfigure command does not accept a 
space in front of the file name nor after the file extension, while \input is 
very tolerant in that respect. Compare

\input   knuth.tex   
\input knuth.tex
\input{knuth.tex}

which are all accepted, while when there is a space after the extension,

\startplacefigure[number=no]
\externalfigure[hacker.jpg ]
\stopplacefigure

or a space before the filename 

\startplacefigure[number=no]
\externalfigure[ hacker.jpg]
\stopplacefigure

then ConTeXt does not recognize the file…
Maybe Hans has a reason to explain this behavior, but it is not clear to me.

Best regards: OK


___
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] \setvariables and database module

2018-01-30 Thread Wolfgang Schuster



Otared Kavian 
30. Januar 2018 um 16:53
Hi again Wolfgang,

I think I understood what is going wrong with my example after your 
hint: I have to remove all spaces around the separator and remove also 
the braces around each entry.

That is the following works fine:

\startseplisttalk
Hacker;Up to date hacking;hacker.jpg
Hacker;Up to date hacking;hacker.jpg
\stopseplisttalk

while the following does not (as far as the filename is concerned):

\startseplisttalk
{Hacker};{Up to date hacking};{hacker.jpg}
Hacker ; Up to date hacking ; hacker.jpg
\stopseplisttalk

Is there a way to make the \defineseparatedlist command to be more 
tolerant for the filename?



No but you can remove the space with Lua.

\externalfigure[\cldcontext{string.collapsespaces("\getvariable{talk}{picture}")}]

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] \setvariables and database module

2018-01-30 Thread Otared Kavian
Hi again Wolfgang,

I think I understood what is going wrong with my example after your hint: I 
have to remove all spaces around the separator and remove also the braces 
around each entry.
That is the following works fine:

\startseplisttalk
Hacker;Up to date hacking;hacker.jpg
Hacker;Up to date hacking;hacker.jpg
\stopseplisttalk

while the following does not (as far as the filename is concerned):

\startseplisttalk
{Hacker};{Up to date hacking};{hacker.jpg}
Hacker ; Up to date hacking ; hacker.jpg
\stopseplisttalk

Is there a way to make the \defineseparatedlist command to be more tolerant for 
the filename? 
Best regards: OK

> On 30 Jan 2018, at 16:28, Otared Kavian  wrote:
> 
> 
>> On 30 Jan 2018, at 15:54, Wolfgang Schuster > > wrote:
>>> […]
>> 
>> Use the command key which grabs the content of each column as argument (i.e. 
>> your commands needs as many arguments as your table has columns):
>> 
>> \defineseparatedlist
>>   [seplisttalk]
>>   [separator={;},
>>command=\maketalk]
> 
> 
> Thanks Wolfgang! That fixes the issues concerning the entries which are text, 
> but now the filename is not understood by the command \maketalk: here is the 
> modified code:
> 
> %% begin database-command.tex
> \usemodule[database]
> 
> \starttext
> \startbuffer[pagetalk]
>   \starttabulate[|f{\bi}l|p|][before=]%
>   \NC Speaker \EQ 
>   \goto{{\sc 
> \getvariable{talk}{speakername}}}[fig:\getvariable{talk}{speakername}]
>\NC\NR
>   \NC Title   \EQ \getvariable{talk}{title}\NC\NR
>   \stoptabulate
>   \startplacefigure[number=no]
>   \externalfigure[\getvariable{talk}{picture}]
>   \stopplacefigure
>   \page
> \stopbuffer
> 
> \setvariable{talk}{set}{\getbuffer[pagetalk]}
> 
> \define[3]\maketalk{%
>   \setvariables[talk]%
>   [speakername={#1},
>   title={#2},
>   picture={#3},
>   ]}
> 
> \defineseparatedlist[seplisttalk]
>   [separator={;},
>   command=\maketalk]
> 
> \startseplisttalk
> {Hacker} ; {Up to date hacking} ; {hacker.jpg}
> Hacker ; Up to date hacking ; hacker.jpg
> \stopseplisttalk
> 
> \stoptext
> %% end database-command.tex

___
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] \setvariables and database module

2018-01-30 Thread Otared Kavian

> On 30 Jan 2018, at 15:54, Wolfgang Schuster  
> wrote:
>> […]
> 
> Use the command key which grabs the content of each column as argument (i.e. 
> your commands needs as many arguments as your table has columns):
> 
> \defineseparatedlist
>   [seplisttalk]
>   [separator={;},
>command=\maketalk]


Thanks Wolfgang! That fixes the issues concerning the entries which are text, 
but now the filename is not understood by the command \maketalk: here is the 
modified code:

%% begin database-command.tex
\usemodule[database]

\starttext
\startbuffer[pagetalk]
\starttabulate[|f{\bi}l|p|][before=]%
\NC Speaker \EQ 
\goto{{\sc 
\getvariable{talk}{speakername}}}[fig:\getvariable{talk}{speakername}]
 \NC\NR
\NC Title   \EQ \getvariable{talk}{title}\NC\NR
\stoptabulate
\startplacefigure[number=no]
\externalfigure[\getvariable{talk}{picture}]
\stopplacefigure
\page
\stopbuffer

\setvariable{talk}{set}{\getbuffer[pagetalk]}

\define[3]\maketalk{%
\setvariables[talk]%
[speakername={#1},
title={#2},
picture={#3},
]}

\defineseparatedlist[seplisttalk]
[separator={;},
command=\maketalk]

\startseplisttalk
{Hacker} ; {Up to date hacking} ; {hacker.jpg}
Hacker ; Up to date hacking ; hacker.jpg
\stopseplisttalk

\stoptext
%% end database-command.tex___
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] \setvariables and database module

2018-01-30 Thread Wolfgang Schuster



Otared Kavian 
30. Januar 2018 um 15:44
Hi all,

I need to create a document using a database and the \setvariables 
command (which I understood thanks to Wolfgang Schuster). Everything 
works fine except that using the approach below I need to change the 
entries in the database by enclosing each entry between a pair of 
braces {}, because otherwise the macro I have imagined does not work 
as expected. In the example below the first line of entries is treated 
correctly, while the second one is understood wrongly by my macro 
\maketalk defined below in the minimal example.


It is indeed possible, in theory, to change the database file so that 
each entry is enclosed in a pair of braces, but I would like to avoid 
that mainly because I am not the one who produces nor maintains that 
file and I want to avoid modifying a copy of that file myself.


How can I change my approach to this problem in order to achieve what 
is needed?

Many thanks for any hint.
Best regards: OK

% begin database-command.tex
\usemodule[database]

\starttext
\startbuffer[pagetalk]
\starttabulate[|f{\bi}l|p|][before=]%
\NC Speaker \EQ
\goto{{\sc 
\getvariable{talk}{speakername}}}[fig:\getvariable{talk}{speakername}]

\NC\NR
\NC Title \EQ \getvariable{talk}{title} \NC\NR
\stoptabulate
\startplacefigure[number=no]
\externalfigure[\getvariable{talk}{picture}]
\stopplacefigure
\page
\stopbuffer

\setvariable{talk}{set}{\getbuffer[pagetalk]}

\define[3]\maketalk{%
\setvariables[talk]%
[speakername={#1},
title={#2},
picture={#3},
]}

\defineseparatedlist[seplisttalk]
[separator={;},
first=\maketalk
]


Use the command key which grabs the content of each column as argument 
(i.e. your commands needs as many arguments as your table has columns):


\defineseparatedlist
  [seplisttalk]
  [separator={;},
   command=\maketalk]

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

[NTG-context] \setvariables and database module

2018-01-30 Thread Otared Kavian
Hi all,

I need to create a document using a database and the \setvariables command 
(which I understood thanks to Wolfgang Schuster). Everything works fine except 
that using the approach below I need to change the entries in the database by 
enclosing each entry between a pair of braces {}, because otherwise the macro I 
have imagined does not work as expected. In the example below the first line of 
entries is treated correctly, while the second one is understood wrongly by my 
macro \maketalk defined below in the minimal example.

It is indeed possible, in theory, to change the database file so that each 
entry is enclosed in a pair of braces, but I would like to avoid that mainly 
because I am not the one who produces nor maintains that file and I want to 
avoid modifying a copy of that file myself.

How can I change my approach to this problem in order to achieve what is needed?
Many thanks for any hint.
Best regards: OK

% begin database-command.tex
\usemodule[database]

\starttext
\startbuffer[pagetalk]
\starttabulate[|f{\bi}l|p|][before=]%
\NC Speaker \EQ 
\goto{{\sc 
\getvariable{talk}{speakername}}}[fig:\getvariable{talk}{speakername}]
 \NC\NR
\NC Title   \EQ \getvariable{talk}{title}\NC\NR
\stoptabulate
\startplacefigure[number=no]
\externalfigure[\getvariable{talk}{picture}]
\stopplacefigure
\page
\stopbuffer

\setvariable{talk}{set}{\getbuffer[pagetalk]}

\define[3]\maketalk{%
\setvariables[talk]%
[speakername={#1},
title={#2},
picture={#3},
]}

\defineseparatedlist[seplisttalk]
[separator={;},
first=\maketalk
]

\startseplisttalk
{Hacker} ; {Up to date hacking} ; {hacker.jpg} % this works fine
Hacker ; Up to date hacking ; hacker.jpg % this does not work: the macro takes 
only the three characters H a c
\stopseplisttalk

\stoptext
% end database-command.tex
___
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
___