Re: [NTG-context] Check the character after a macro

2015-05-01 Thread Sam Ḥilluc
On 2015-05-01 21:10, Wolfgang Schuster wrote:
> You can use the \doifelsenextchar command to check the character after your 
> command.
> 
> \define[1]\MyMacro
>   {\doifelsenextchar{,}
>  {#1}
>  {#1. }}
> 
> \starttext
> 
> \MyMacro{left} right
> 
> \MyMacro{left}, right
> 
> \stoptext
> 
> 
> The limitation of this method is that you check only for one character at a 
> time
> and when want to check for more you have to use multiple \doifelsenextchar 
> lines.
> 
> \doifelsenextchar{,}
>   {...}
>   {\doifelsenextchar{.}
>  {...}
>  {...}}
> 
> Wolfgang

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

Re: [NTG-context] Check the character after a macro

2015-05-01 Thread Wolfgang Schuster

> Am 01.05.2015 um 20:41 schrieb Sam Ḥilluc :
> 
> On 2015-05-01 19:38, Otared Kavian wrote:
>> Hi,
>> 
>> You have several commands in ConTeXt doing what you are seeking to do: 
>> please look at the examples below:
>> 
>> %%% begin do-if-inset.tex
>> \starttext
>> \type{\doifinset{A}{A,B,C}{should go}:} \doifinset{A}{A,B,C}{should go}
>> 
>> \type{\doifinset{D}{A,B,C}{should go}:}  \doifinset{D}{A,B,C}{should 
>> participate}
>> 
>> 
>> \type{\doifnotinset{}{A,B,C}{not in the set}:} \doifnotinset{}{A,B,C}{not in 
>> the set}
>> 
>> \type{\doifnotinset{D}{A,B,C}{not in the set}:} \doifnotinset{D}{A,B,C}{not 
>> in the set}
>> 
>> \doifinsetelse{D}{A,B,C}{it is in the set}{it is not in the set}
>> 
>> \define\test{B}
>> 
>> \type{\doifinsetelse{\test}{A,B,C}{\test\ is in the set}{\test\ is not in 
>> the set}}
>> 
>> \doifinsetelse{\test}{A,B,C}{\test\ is in the set}{\test\ is not in the set}
>> \stoptext
>> %%% end do-if-inset.tex
>> 
>> Best regards: OK
> 
> This works for testing if a given character is in a set, but how can I 
> retrieve
> that character just after the defined macro.
> 
> To give an example, a macro that adds a dot if the next character is not a
> comma.
> 
>\MyMacro{text1} text2 ->  text1. text2
>\MyMacro{text1}, text2->  text1, text2


You can use the \doifelsenextchar command to check the character after your 
command.

\define[1]\MyMacro
  {\doifelsenextchar{,}
 {#1}
 {#1. }}

\starttext

\MyMacro{left} right

\MyMacro{left}, right

\stoptext


The limitation of this method is that you check only for one character at a time
and when want to check for more you have to use multiple \doifelsenextchar 
lines.

\doifelsenextchar{,}
  {...}
  {\doifelsenextchar{.}
 {...}
 {...}}

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
___

Re: [NTG-context] Check the character after a macro

2015-05-01 Thread Sam Ḥilluc
On 2015-05-01 19:38, Otared Kavian wrote:
> Hi,
> 
> You have several commands in ConTeXt doing what you are seeking to do: please 
> look at the examples below:
> 
> %%% begin do-if-inset.tex
> \starttext
> \type{\doifinset{A}{A,B,C}{should go}:} \doifinset{A}{A,B,C}{should go}
> 
> \type{\doifinset{D}{A,B,C}{should go}:}  \doifinset{D}{A,B,C}{should 
> participate}
> 
> 
> \type{\doifnotinset{}{A,B,C}{not in the set}:} \doifnotinset{}{A,B,C}{not in 
> the set}
> 
> \type{\doifnotinset{D}{A,B,C}{not in the set}:} \doifnotinset{D}{A,B,C}{not 
> in the set}
> 
> \doifinsetelse{D}{A,B,C}{it is in the set}{it is not in the set}
> 
> \define\test{B}
> 
> \type{\doifinsetelse{\test}{A,B,C}{\test\ is in the set}{\test\ is not in the 
> set}}
> 
> \doifinsetelse{\test}{A,B,C}{\test\ is in the set}{\test\ is not in the set}
> \stoptext
> %%% end do-if-inset.tex
> 
> Best regards: OK

This works for testing if a given character is in a set, but how can I retrieve
that character just after the defined macro.

To give an example, a macro that adds a dot if the next character is not a
comma.

\MyMacro{text1} text2 ->  text1. text2
\MyMacro{text1}, text2->  text1, text2

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

Re: [NTG-context] Check the character after a macro

2015-05-01 Thread Otared Kavian
Hi,

You have several commands in ConTeXt doing what you are seeking to do: please 
look at the examples below:

%%% begin do-if-inset.tex
\starttext
\type{\doifinset{A}{A,B,C}{should go}:} \doifinset{A}{A,B,C}{should go}

\type{\doifinset{D}{A,B,C}{should go}:}  \doifinset{D}{A,B,C}{should 
participate}


\type{\doifnotinset{}{A,B,C}{not in the set}:} \doifnotinset{}{A,B,C}{not in 
the set}

\type{\doifnotinset{D}{A,B,C}{not in the set}:} \doifnotinset{D}{A,B,C}{not in 
the set}

\doifinsetelse{D}{A,B,C}{it is in the set}{it is not in the set}

\define\test{B}

\type{\doifinsetelse{\test}{A,B,C}{\test\ is in the set}{\test\ is not in the 
set}}

\doifinsetelse{\test}{A,B,C}{\test\ is in the set}{\test\ is not in the set}
\stoptext
%%% end do-if-inset.tex

Best regards: OK

> On 01 May 2015, at 18:56, Sam Ḥilluc  wrote:
> 
> Hello,
> 
> Is it possible to check (in a macro definition) if the character following the
> macro is included in a set of characters?
> 
> Something that could work like this:
> 
>\def\MyMacro#1{%
>\ifNextCharIn{abcd} \dothis%
>\else \dothat%
>\fi%
>}
> 
> Cheers.
> ___
> 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
___

[NTG-context] Check the character after a macro

2015-05-01 Thread Sam Ḥilluc
Hello,

Is it possible to check (in a macro definition) if the character following the
macro is included in a set of characters?

Something that could work like this:

\def\MyMacro#1{%
\ifNextCharIn{abcd} \dothis%
\else \dothat%
\fi%
}

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

[NTG-context] Removing a single ligature and using swash alternates

2015-05-01 Thread Manuel Blanco
Hello,

I'm using Minion Pro, and I would like to remove the Th ligature (but only
that one).

Also, I'm trying to define a \swash command that uses swash from Minion Pro
Italic. Any help?

\usemodule [simplefonts] [size=11pt]
\setmainfont [Minion Pro]
  [expansion=quality,
   protrusion=quality]
\setupalign [hz,hanging]

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

Re: [NTG-context] Synonyms’ \infull doesn’t work anymore

2015-05-01 Thread Thomas Floeren

> On 01 May 15, at 11:47, Wolfgang Schuster  wrote:
> 
> 
>> Am 01.05.2015 um 04:11 schrieb Thomas Floeren :
>> 
>> Hi,
>> 
>> starting with the Beta from 16 April I have a problem with synonyms. The 
>> \infull part doesn’t work anymore.
>> 
>> Example:
>> 
>> ```
>> \definesynonyms [Tea] [Teas] [\fullTea]
>> \setupsynonyms  [Tea] [synonymstyle=italic]
>> \Tea [tFop] {FOP} {Flowery Orange Pekoe}
>> 
>> \starttext
>> \tFop\ is ‘\fullTea{tFop}’.
>> \stoptext
>> 
>> ```
>> 
>> I can make it work again with some hackery in the strc-syn.mkiv file: If I 
>> copy back the line
>> `\simplelistparameter\c!textcommand{\clf_synonymmeaning{#1}{#2}}%` (e.g. 
>> from the Beta 14 April) into the `strc_synonyms_insert_meaning` definition 
>> (at line ~338) it works again.
> 
> 
> You have to change the definition for the \strc_synonyms_insert_meaning 
> command.
> 
> \unexpanded\def\strc_synonyms_insert_meaning#1#2% name tag
>  {\begingroup
>   \def\currentsimplelist{#1}%
> +  \def\currentsynonymtag{#2}%
> +  \fastsetup{\??simplelistrenderings::\v!text}%
> -  \fastsetup{\??simplelistrenderings:\v!text}%
>   \endgroup}
> 

Ah, thank you!

I was close … more or less ;-)

-- 
Tom





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

Re: [NTG-context] Synonyms’ \infull doesn’t work anymore

2015-05-01 Thread Wolfgang Schuster

> Am 01.05.2015 um 04:11 schrieb Thomas Floeren :
> 
> Hi,
> 
> starting with the Beta from 16 April I have a problem with synonyms. The 
> \infull part doesn’t work anymore.
> 
> Example:
> 
> ```
> \definesynonyms [Tea] [Teas] [\fullTea]
> \setupsynonyms  [Tea] [synonymstyle=italic]
> \Tea [tFop] {FOP} {Flowery Orange Pekoe}
> 
> \starttext
> \tFop\ is ‘\fullTea{tFop}’.
> \stoptext
> 
> ```
> 
> I can make it work again with some hackery in the strc-syn.mkiv file: If I 
> copy back the line
> `\simplelistparameter\c!textcommand{\clf_synonymmeaning{#1}{#2}}%` (e.g. from 
> the Beta 14 April) into the `strc_synonyms_insert_meaning` definition (at 
> line ~338) it works again.


You have to change the definition for the \strc_synonyms_insert_meaning command.

\unexpanded\def\strc_synonyms_insert_meaning#1#2% name tag
  {\begingroup
   \def\currentsimplelist{#1}%
+  \def\currentsynonymtag{#2}%
+  \fastsetup{\??simplelistrenderings::\v!text}%
-  \fastsetup{\??simplelistrenderings:\v!text}%
   \endgroup}

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
___

Re: [NTG-context] Letterhead Usage

2015-05-01 Thread Wolfgang Schuster

> Am 30.04.2015 um 20:46 schrieb henman :
> 
> 
> I have created a letterhead for correspondence, but it is too unfriendly to 
> have to include it in every time.
> 
> I would like to use it as a package, but don't know if it's possible.
> 
> The problem I see is that the command \setlayer must  be done after the 
> \starttext command.
> If it doesn't then formatting commands such as \sc  will not take affect and 
> I believe a different font is also applied.
> 
> What would  be a user friendly way to implement letterheads (made up using 
> the layers functionality of context?


You can put the layer settings in a setups environment and flush the content 
when the page backgrounds are applied
with the setups key for \setupbackground.

\definelayer[letterhead][width=\paperwidth,height=\paperheight]

\startsetups[letterhead]

\ifnum\rawcountervalue[userpage]=1


\setlayerframed[letterhead][x=\backspace,y=1cm][width=\textwidth,height=2cm,align={middle,lohi}]{First
 page}

\else


\setlayerframed[letterhead][x=\backspace,y=1cm][width=\textwidth,height=2cm,align={middle,lohi}]{Second
 page}

\fi

\stopsetups

\setupbackgrounds[page][background=letterhead,setups=letterhead]

\starttext
\dorecurse{3}{\page[empty]}
\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
___

Re: [NTG-context] line number overwriting

2015-05-01 Thread Wolfgang Schuster

> Am 30.04.2015 um 11:24 schrieb Pierre-François Bonnefoi :
> 
> Hello,
> 
> thank you for your solution.
> 
> As I understand this code, it's a patch to some internal processing code, so 
> I've integrated it in my environment file.
> 
> The result is similar to the previous result :
> 
> 
> 
> I've two columns paragraph, with a verbatim zone in the left column that gets 
> two numbering : 1 to 25 then 26  to 50.
> 
> If I change the numbering style with the command "\definelinenumbering" 
> associated to the verbatim zone from the global numbering style, I get one 
> numbering with the  
> particular style and the other with the global style.

When you create custom typing environment context also creates a line numbering 
environment with the same name
and to change its values you should use the \setuplinenumbering command and not 
\definelinenumbering.

> I don't know if this gives insight into the process that occurs in the 
> rendering engine.

Please make a minimal example with the problem.

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
___

Re: [NTG-context] Letterhead Usage

2015-05-01 Thread Pablo Rodriguez
On 04/30/2015 08:46 PM, henman wrote:
> I have created a letterhead for correspondence, but it is too unfriendly 
> to have to include it in every time.
> 
> I would like to use it as a package, but don't know if it's possible.
> 
> The problem I see is that the command \setlayer must  be done after the 
> \starttext command.
> If it doesn't then formatting commands such as \sc  will not take affect 
> and I believe a different font is also applied.
> 
> What would  be a user friendly way to implement letterheads (made up 
> using the layers functionality of context?

Hi,

could you provide a minimal sample that shows the issues you’re
experiencing?


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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___