[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
___

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
___

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 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 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
___

[NTG-context] Expansion help needed, getvariable and TABLE

2018-01-30 Thread Rik Kabel

Listers,

I have a problem, and a question on ConTeXt programming efficiency.

In the example below, I have a set of variables. When these are 
reference directly via \getvariable, everything works as expected in 
simple text and in TABLEs. When I \define a macro to the \getvariable, 
that works in simple text, but only the value of the last iteration 
appears in the TABLE. The macro definition is saved and when it is used, 
that is the value that it has.


So, how can I \define (or \def, ...) a macro to the expanded value to 
avoid this? That is the problem.


The question is, Is there is any advantage to be had in doing this? 
Assume that the value is referenced many (tens of) times. There seems to 
be an aesthetic value of factoring out the multiple identical instances 
of the \getvariable syntax and assigning a more semantically informative 
name, but beyond that, is there any other value?


   % macros=mkvi engine=luajittex

   \setvariables  [one]
   [a=1a,b=1b]
   \setvariables  [two]
   [a=2a,b=2b]

   \define    \Sets
   {one,two}

   \starttexdefinition unexpanded doInlineText #SET
    Direct: \getvariable{#SET}{a} \getvariable{#SET}{b}\par
   \stoptexdefinition

   \starttexdefinition unexpanded doTableRow #SET
    \bTR
  \bTC\getvariable{#SET}{a}\eTC
  \bTC\getvariable{#SET}{b}\eTC
    \eTR
   \stoptexdefinition

   \starttexdefinition doInlineTextExp #SET
    \define\A{\getvariable{#SET}{a}}
    \define\B{\getvariable{#SET}{b}}
    Factored: \A\ \B\par
   \stoptexdefinition

   \starttexdefinition doTableRowExp #SET
    \define\A{\getvariable{#SET}{a}}
    \define\B{\getvariable{#SET}{b}}
    \bTR
  \bTC\A\eTC
  \bTC\B\eTC
    \eTR
   \stoptexdefinition

   \starttext

   \starttext

   \expandafter\processcommalist\expandafter[\Sets]\doInlineText

    \bTABLE[frame=off]
  \bTABLEhead
    \bTR[nc=2]
  \bTH Direct\eTH
    \eTR
  \eTABLEhead
  \bTABLEbody
   \expandafter\processcommalist\expandafter[\Sets]\doTableRow
  \eTABLEbody
    \eTABLE

   \expandafter\processcommalist\expandafter[\Sets]\doInlineTextExp

    \bTABLE[frame=off]
  \bTABLEhead
    \bTR[nc=2]
  \bTH Factored\eTH
    \eTR
  \eTABLEhead
  \bTABLEbody
   \expandafter\processcommalist\expandafter[\Sets]\doTableRowExp
  \eTABLEbody
    \eTABLE

   \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
___

Re: [NTG-context] Expansion help needed, getvariable and TABLE

2018-01-30 Thread Rik Kabel

On 2018-01-30 21:10, Rik Kabel wrote:


Listers,

I have a problem, and a question on ConTeXt programming efficiency.

In the example below, I have a set of variables. When these are 
reference directly via \getvariable, everything works as expected in 
simple text and in TABLEs. When I \define a macro to the \getvariable, 
that works in simple text, but only the value of the last iteration 
appears in the TABLE. The macro definition is saved and when it is 
used, that is the value that it has.


So, how can I \define (or \def, ...) a macro to the expanded value to 
avoid this? That is the problem.


The question is, Is there is any advantage to be had in doing this? 
Assume that the value is referenced many (tens of) times. There seems 
to be an aesthetic value of factoring out the multiple identical 
instances of the \getvariable syntax and assigning a more semantically 
informative name, but beyond that, is there any other value?




Replying to my own query, I see that I just have to localize the 
definitions by grouping them, as


\starttexdefinition doTableRowExp #SET
   {\define\A{\getvariable{#SET}{a}}
    \define\B{\getvariable{#SET}{b}}
    \bTR
  \bTC\A\eTC
  \bTC\B\eTC
    \eTR}
\stoptexdefinition

Does it matter if I use {}, \bgroup\egroup, or some other mechanism?

My style question is still outstanding.

--
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
___

Re: [NTG-context] Spurious space in \definestartstop

2018-01-30 Thread Henri Menke
On Tue, 2018-01-30 at 21:24 +0100, Wolfgang Schuster wrote:
> 
> > Henri Menke 30. Januar 2018 um 21:12
> > On Tue, 2018-01-30 at 11:58 +0100, Hans Hagen wrote:
> > > On 1/30/2018 11:34 AM, Henri Menke wrote:
> > > > On 01/30/2018 09:17 PM, Hans Hagen wrote:
> > > > > On 1/30/2018 2:54 AM, Henri Menke wrote:
> > > > > > Dear list,
> > > > > > 
> > > > > > the title says it all.  Please add \ignorespaces in a place you deem
> > > > > > appropriate.  MWE is below.
> > > > > sometimes you will also add \removeuwantedspaces in the stop
> > > > I'm confused.  Does that mean there is going to be a fix?
> > > no, why should there be? spaces are never ignored after the last [...] 
> > > that is checked for unless a command has an explicit \ignorespaces
> > I'm not convinced.  Both "before" and "commands" see a \relax and therefore
> > \ignorespaces is dropped.  I can put \removeunwantedspaces there but that
> > deletes the space before \start.  The \framed command correctly drops the
> > space
> > after the options.
> > 
> > ---
> > 
> > \definestartstop
> >   [spurious space a]
> >   [before=\ignorespaces,
> >    after=\removeunwantedspaces]
> > 
> > \definestartstop
> >   [spurious space b]
> >   [before=\removeunwantedspaces,
> >    after=\removeunwantedspaces]
> > 
> > \starttext
> > 
> > Hello Foo Bar World
> > 
> > Hello \start[spurious space a] Foo Bar \stop\ World
> > %   ^^^ neither space^^^ is skipped
> > 
> > Hello \start[spurious space b] Foo Bar \stop\ World
> > %   ^^^ skips this space ^^^ instead of this
> > 
> > Hello \startframed[offset=overlay] Foo Bar \stopframed\ World
> > % That's the behaviour I'm looking for.
> > 
> > \stoptext
> > 
>  You assume \start[<...>] ... \stop is linked to \definestartstop but this
> isn’t the case,
> what the environment does is to generate a start-command with the argument
> but this works for every environment, e.g. \start[itemize] ... \stop does the
> same
> as \startitemize ... \stopitemize.

I'm not asking to add \ignorespaces to the definition of \start.  I'm rather
asking, where I have to but \ignorespaces in the setup to eat the space after
the options I pass to \start.

> 
> Adding the \ignorespace is not an option in this case because it would effect
> all environments which you use with the argument for \start.
> 
> 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
> __
> _
___
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] Spurious space in \definestartstop

2018-01-30 Thread Henri Menke
On Tue, 2018-01-30 at 11:58 +0100, Hans Hagen wrote:
> On 1/30/2018 11:34 AM, Henri Menke wrote:
> > 
> > On 01/30/2018 09:17 PM, Hans Hagen wrote:
> > > 
> > > On 1/30/2018 2:54 AM, Henri Menke wrote:
> > > > 
> > > > Dear list,
> > > > 
> > > > the title says it all.  Please add \ignorespaces in a place you deem
> > > > appropriate.  MWE is below.
> > > sometimes you will also add \removeuwantedspaces in the stop
> > I'm confused.  Does that mean there is going to be a fix?
> no, why should there be? spaces are never ignored after the last [...] 
> that is checked for unless a command has an explicit \ignorespaces

I'm not convinced.  Both "before" and "commands" see a \relax and therefore
\ignorespaces is dropped.  I can put \removeunwantedspaces there but that
deletes the space before \start.  The \framed command correctly drops the space
after the options.

---

\definestartstop
  [spurious space a]
  [before=\ignorespaces,
   after=\removeunwantedspaces]

\definestartstop
  [spurious space b]
  [before=\removeunwantedspaces,
   after=\removeunwantedspaces]

\starttext

Hello Foo Bar World

Hello \start[spurious space a] Foo Bar \stop\ World
%   ^^^ neither space^^^ is skipped

Hello \start[spurious space b] Foo Bar \stop\ World
%   ^^^ skips this space ^^^ instead of this

Hello \startframed[offset=overlay] Foo Bar \stopframed\ World
% That's the behaviour I'm looking for.

\stoptext

> > 
> > > 
> > > > 
> > > > Cheers, Henri
> > > > 
> > > > ---
> > > > 
> > > > \definestartstop
> > > >     [spurious space]
> > > > 
> > > > \starttext
> > > > 
> > > > Hello World
> > > > 
> > > > Hello \start[spurious space] World \stop
> > > > %  ^^^ spurious space here!
> > > > 
> > > > \stoptext
> > > > 
> > > > ___
> > > > 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-c
> > > > ontext
> > > > webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> > > > archive  : https://bitbucket.org/phg/context-mirror/commits/
> > > > 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-conte
> > xt
> > webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> > archive  : https://bitbucket.org/phg/context-mirror/commits/
> > 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Spurious space in \definestartstop

2018-01-30 Thread Alan Braslau
Might I add that the use of a command containing spaces in its name is
spurious. Try: \definestartstop[spuriusspacea] \startspuriusspacea ...
\stopspuriuspsacea, and then come up with a better name!

Alan

On Tue, 30 Jan 2018 21:24:41 +0100
Wolfgang Schuster  wrote:

> > Henri Menke 
> > 30. Januar 2018 um 21:12
> > On Tue, 2018-01-30 at 11:58 +0100, Hans Hagen wrote:  
> >> On 1/30/2018 11:34 AM, Henri Menke wrote:  
> >>> On 01/30/2018 09:17 PM, Hans Hagen wrote:  
>  On 1/30/2018 2:54 AM, Henri Menke wrote:  
> > Dear list,
> >
> > the title says it all.  Please add \ignorespaces in a place you
> > deem appropriate.  MWE is below.  
>  sometimes you will also add \removeuwantedspaces in the stop  
> >>> I'm confused.  Does that mean there is going to be a fix?  
> >> no, why should there be? spaces are never ignored after the last
> >> [...] that is checked for unless a command has an explicit
> >> \ignorespaces  
> >
> > I'm not convinced.  Both "before" and "commands" see a \relax and
> > therefore \ignorespaces is dropped.  I can put
> > \removeunwantedspaces there but that deletes the space before
> > \start.  The \framed command correctly drops the space after the
> > options.
> >
> > ---
> >
> > \definestartstop
> >[spurious space a]
> >[before=\ignorespaces,
> > after=\removeunwantedspaces]
> >
> > \definestartstop
> >[spurious space b]
> >[before=\removeunwantedspaces,
> > after=\removeunwantedspaces]
> >
> > \starttext
> >
> > Hello Foo Bar World
> >
> > Hello \start[spurious space a] Foo Bar \stop\ World
> > %   ^^^ neither space^^^ is skipped
> >
> > Hello \start[spurious space b] Foo Bar \stop\ World
> > %   ^^^ skips this space ^^^ instead of this
> >
> > Hello \startframed[offset=overlay] Foo Bar \stopframed\ World
> > % That's the behaviour I'm looking for.
> >
> > \stoptext
> >  
> You assume \start[<...>] ... \stop is linked to \definestartstop but 
> this isn’t the case,
> what the environment does is to generate a start-command with the
> argument but this works for every environment, e.g.
> \start[itemize] ... \stop does the same
> as \startitemize ... \stopitemize.
> 
> Adding the \ignorespace is not an option in this case because it
> would effect
> all environments which you use with the argument for \start.
> 
> 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] Spurious space in \definestartstop

2018-01-30 Thread Wolfgang Schuster



Henri Menke 
30. Januar 2018 um 21:12
On Tue, 2018-01-30 at 11:58 +0100, Hans Hagen wrote:

On 1/30/2018 11:34 AM, Henri Menke wrote:

On 01/30/2018 09:17 PM, Hans Hagen wrote:

On 1/30/2018 2:54 AM, Henri Menke wrote:

Dear list,

the title says it all.  Please add \ignorespaces in a place you deem
appropriate.  MWE is below.

sometimes you will also add \removeuwantedspaces in the stop

I'm confused.  Does that mean there is going to be a fix?
no, why should there be? spaces are never ignored after the last [...] 
that is checked for unless a command has an explicit \ignorespaces


I'm not convinced.  Both "before" and "commands" see a \relax and therefore
\ignorespaces is dropped.  I can put \removeunwantedspaces there but that
deletes the space before \start.  The \framed command correctly drops the space
after the options.

---

\definestartstop
   [spurious space a]
   [before=\ignorespaces,
after=\removeunwantedspaces]

\definestartstop
   [spurious space b]
   [before=\removeunwantedspaces,
after=\removeunwantedspaces]

\starttext

Hello Foo Bar World

Hello \start[spurious space a] Foo Bar \stop\ World
%   ^^^ neither space^^^ is skipped

Hello \start[spurious space b] Foo Bar \stop\ World
%   ^^^ skips this space ^^^ instead of this

Hello \startframed[offset=overlay] Foo Bar \stopframed\ World
% That's the behaviour I'm looking for.

\stoptext

You assume \start[<...>] ... \stop is linked to \definestartstop but 
this isn’t the case,

what the environment does is to generate a start-command with the argument
but this works for every environment, e.g. \start[itemize] ... \stop 
does the same

as \startitemize ... \stopitemize.

Adding the \ignorespace is not an option in this case because it would 
effect

all environments which you use with the argument for \start.

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] Expansion help needed, getvariable and TABLE

2018-01-30 Thread Wolfgang Schuster



Rik Kabel 
31. Januar 2018 um 03:10

Listers,

I have a problem, and a question on ConTeXt programming efficiency.

In the example below, I have a set of variables. When these are 
reference directly via \getvariable, everything works as expected in 
simple text and in TABLEs. When I \define a macro to the \getvariable, 
that works in simple text, but only the value of the last iteration 
appears in the TABLE. The macro definition is saved and when it is 
used, that is the value that it has.


So, how can I \define (or \def, ...) a macro to the expanded value to 
avoid this? That is the problem.


The question is, Is there is any advantage to be had in doing this? 
Assume that the value is referenced many (tens of) times. There seems 
to be an aesthetic value of factoring out the multiple identical 
instances of the \getvariable syntax and assigning a more semantically 
informative name, but beyond that, is there any other value?



Natural tables collect the content of all cells to perform the width and 
height calculations
and you have to expand the content of the cells to get the current value 
of \getvariable.


\starttexdefinition unexpanded doTableRow #SET
\bTR
  \expanded{\bTC\getvariable{#SET}{a}\eTC}
  \expanded{\bTC\getvariable{#SET}{b}\eTC}
\eTR
\stoptexdefinition


BTW: You can use the \processcommacommand command when you save your 
lists in a macro (no need for \expandafter).


\defineexpandable\Sets{one,two}

\processcommacommand[\Sets]\doInlineTextExp


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] Spurious space in \definestartstop

2018-01-30 Thread Henri Menke
On 01/30/2018 09:17 PM, Hans Hagen wrote:
> On 1/30/2018 2:54 AM, Henri Menke wrote:
>> Dear list,
>>
>> the title says it all.  Please add \ignorespaces in a place you deem
>> appropriate.  MWE is below.
> 
> sometimes you will also add \removeuwantedspaces in the stop

I'm confused.  Does that mean there is going to be a fix?

> 
>> Cheers, Henri
>>
>> ---
>>
>> \definestartstop
>>    [spurious space]
>>
>> \starttext
>>
>> Hello World
>>
>> Hello \start[spurious space] World \stop
>> %  ^^^ spurious space here!
>>
>> \stoptext
>> ___
>> 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
>> ___
>>
> 
> 

___
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] Spurious space in \definestartstop

2018-01-30 Thread Hans Hagen

On 1/30/2018 11:34 AM, Henri Menke wrote:

On 01/30/2018 09:17 PM, Hans Hagen wrote:

On 1/30/2018 2:54 AM, Henri Menke wrote:

Dear list,

the title says it all.  Please add \ignorespaces in a place you deem
appropriate.  MWE is below.


sometimes you will also add \removeuwantedspaces in the stop


I'm confused.  Does that mean there is going to be a fix?


no, why should there be? spaces are never ignored after the last [...] 
that is checked for unless a command has an explicit \ignorespaces

Cheers, Henri

---

\definestartstop
    [spurious space]

\starttext

Hello World

Hello \start[spurious space] World \stop
%  ^^^ spurious space here!

\stoptext
___
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
___






___
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
___




--

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
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] Spurious space in \definestartstop

2018-01-30 Thread Hans Hagen

On 1/30/2018 2:54 AM, Henri Menke wrote:

Dear list,

the title says it all.  Please add \ignorespaces in a place you deem
appropriate.  MWE is below.


sometimes you will also add \removeuwantedspaces in the stop


Cheers, Henri

---

\definestartstop
   [spurious space]

\starttext

Hello World

Hello \start[spurious space] World \stop
%  ^^^ spurious space here!

\stoptext
___
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
___




--

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
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
___