[NTG-context] French punctuation again...

2008-11-15 Thread Jeff Smith
Hi all!

The \setcharacterspacing[frenchpunctuation] stuff I saw discussed
recently on this list does not work. Is it because I still use
MKII+Xetex? I get the usual error when there is an unknown command:

! Undefined control sequence.
l.6 \setcharacterspacing
[frenchpunctuation]
?

I use the minimals and updated just a couple of minutes ago to be sure:

ConTeXt  ver: 2008.11.10 21:40 MKII  fmt: 2008.11.15  int: english/english

Now, the real problem is that the following old hacks don't work anymore:

\def\activateSomeCharacters{%

\defineactivecharacter ! {\,\string!}%

\defineactivecharacter ? {\,\string?}%

\defineactivecharacter : {\,\string:}%

\defineactivecharacter ; {\,\string;}}

\activateSomeCharacters

\appendtoks\activateSomeCharacters\to\everystarttext

They were sufficient for me. The error I get is when I define my body font:


! Missing \endcsname inserted.

   \kern
\textormathspace ...fmmode \mskip #1#2\else \kern
  #1\hspaceamount \empty {#3...

\@@fontfile ->name\textormathspace +\thinmuskip 1
 :Nimbus Sans L
\dogetglobalfontparameter ...me \??ff \@@fontfile
  #1\endcsname {#2}\expandaf...

\getglobalfontparameters ...arameter \@@fontdata ,
  ]=,
\dodefinefontsynonym ... \getglobalfontparameters
  \fi \ifcsname \??ff \@@fon...
...
l.128 \setupbodyfont
[bodytext,12pt,rm]
?

I can't make sense of any of this, especially because I call for the
serif font while the Nimbus is my sans-serif.

Everything works perfectly if I just remove the character hacks above.

Can anyone help? Did I provide enough information?

Thanks!
Jeff
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] catcode change in macros

2008-11-15 Thread Wolfgang Schuster

Am 15.11.2008 um 21:41 schrieb Hans Hagen:

> Aditya Mahajan wrote:
>> On Sat, 15 Nov 2008, Wolfgang Schuster wrote:
>>
>>> Am 14.11.2008 um 19:37 schrieb Aditya Mahajan:
>>>
 On Fri, 14 Nov 2008, Aditya Mahajan wrote:

> On Fri, 14 Nov 2008, Wolfgang Schuster wrote:
>
>> Hi,
>>
>> I make in a module the comment sign a simple letter to pass
>> number formats to a lua function and want to know if should
>> use another (better) way to change the catodes.
> I think it will be cleaner to use catcode tables. See syst- 
> cat.mkiv.
 and syst-cat.tex
>>> I keep now my low level solution but with fewer lines.
>>
>> Even though you are still using the mailling list, I will reply :-)
>>
>>> To help other users with the same question I present
>>> here my solution:
>>>
>>> \def\ax{ax}
>>>
>>> \def\setupaxis
>>>  {\catcode`\%\@@letter
>>>   \dodoubleargument\dosetupaxis}
>>>
>>> \def\dosetupaxis[#1][#2]%
>>>  {\def\docommand##1{\getparameters[\ax##1][#2]}%
>>>   \catcode`\%\@@comment
>>>   \processcommalist[#1]\docommand}
>>>
>>> \setupaxis
>>>  [\c!x,\c!y]
>>>  [\c!format=%d]
>>
>> Here you are assuming that whenever \setupaxis will be used, the  
>> catcode
>> of % is comment. This may not be the case. You can of course, store  
>> the
>> inital catcode of % and then restore it later, as done by many LaTeX
>> packages.

Right but I dropped catcode tables because I had a problems
with them (see below).

>> The main advantage of catcode tables is that you can do
>> \pushcatcodetable, and \popcatcodetable, and not do the book keeping
>> yourself. Here is a solution using catcodetables:
>>

I can't use it in my macro.

\unprotect

\long\def\startchangecatcodetable#1#2#3\stopchangecatcodetable
   {\bgroup
\catcodetable\scratchcatcodetable
\catcodetable#1\relax
#3%
\savecatcodetable#2\relax
\egroup}

\newcatcodetable \LUAstringcatcodes

\startchangecatcodetable \ctxcatcodes \LUAstringcatcodes
   \catcode`\%\@@letter
\stopchangecatcodetable

\def\ax{ax}

\def\setupaxis
   {\pushcatcodetable
\catcodetable\LUAstringcatcodes
\dodoubleargument\dosetupaxis}

\def\dosetupaxis[#1][#2]%
   {\def\docommand##1{\getparameters[\ax##1][#2]}%
\popcatcodetable
\processcommalist[#1]\docommand}

\setupaxis
   [\c!x,\c!y]
   [\c!format=%d]

\protect

\starttext
\getvalue{axxformat}
\stoptext

>> Hans, do you think that something like \startchangecatcodetable  
>> should be
>> added to the core. An old definition of \extendcatcodetable almost  
>> does
>> that, but does not provide a name to the resulatant catcodetable.
>
> i wonder if change is the right name, isn't it more cloning?
>
> anyhow, keep in mind that in mkiv we print back to tex every now and
> then and then we use one of the predefined catcode tables.

I save \axxformat in a Lua table and use it only in string.format,
it never appears in the output.

> Another option is:
>
>  [\c!format=\letterpercent d]

No interest, if I want %d to format my string in Lua I want
to write also in this format in 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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] catcode change in macros

2008-11-15 Thread Hans Hagen
Aditya Mahajan wrote:
> On Sat, 15 Nov 2008, Wolfgang Schuster wrote:
> 
>> Am 14.11.2008 um 19:37 schrieb Aditya Mahajan:
>>
>>> On Fri, 14 Nov 2008, Aditya Mahajan wrote:
>>>
 On Fri, 14 Nov 2008, Wolfgang Schuster wrote:

> Hi,
>
> I make in a module the comment sign a simple letter to pass
> number formats to a lua function and want to know if should
> use another (better) way to change the catodes.
 I think it will be cleaner to use catcode tables. See syst-cat.mkiv.
>>> and syst-cat.tex
>> I keep now my low level solution but with fewer lines.
> 
> Even though you are still using the mailling list, I will reply :-)
> 
>> To help other users with the same question I present
>> here my solution:
>>
>> \def\ax{ax}
>>
>> \def\setupaxis
>>   {\catcode`\%\@@letter
>>\dodoubleargument\dosetupaxis}
>>
>> \def\dosetupaxis[#1][#2]%
>>   {\def\docommand##1{\getparameters[\ax##1][#2]}%
>>\catcode`\%\@@comment
>>\processcommalist[#1]\docommand}
>>
>> \setupaxis
>>   [\c!x,\c!y]
>>   [\c!format=%d]
> 
> Here you are assuming that whenever \setupaxis will be used, the catcode 
> of % is comment. This may not be the case. You can of course, store the 
> inital catcode of % and then restore it later, as done by many LaTeX 
> packages.
> 
> The main advantage of catcode tables is that you can do
> \pushcatcodetable, and \popcatcodetable, and not do the book keeping 
> yourself. Here is a solution using catcodetables:
> 
> \unprotect
> 
> % A mixture of \startcatcodetable and \extendcatcodetable
> \long\def\startchangecatcodetable#1#2#3\stopchangecatcodetable
>{\bgroup
> \catcodetable\scratchcatcodetable
> \catcodetable#1\relax
> #3%
> \savecatcodetable#2\relax
> \egroup}
> 
> 
> \newcatcodetable \LUAstringcatcodes
> 
> \startchangecatcodetable \ctxcatcodes \LUAstringcatcodes
>\catcode`\%\@@letter
> \stopchangecatcodetable
> 
> \protect
> 
> \starttext
> 
> \pushcatcodetable
> \catcodetable\LUAstringcatcodes
> % Does this print
> Hello world
> \popcatcodetable
> 
> \stoptext
> 
> So, you code now becomes
> 
> \unprotect
> \def\ax{ax}
> 
> \def\setupaxis
>{\pushcatcodetable
> \catcodetable\LUAstringcatcodes
> \dodoubleargument\dosetupaxis}
> 
> \def\dosetupaxis[#1][#2]%
>{\def\docommand##1{\getparameters[\ax##1][#2]}%
> \popcatcodetable
> \processcommalist[#1]\docommand}
> 
> \setupaxis
>[\c!x,\c!y]
>[\c!format=%d]
> 
> Hans, do you think that something like \startchangecatcodetable should be 
> added to the core. An old definition of \extendcatcodetable almost does 
> that, but does not provide a name to the resulatant catcodetable.

i wonder if change is the right name, isn't it more cloning?

anyhow, keep in mind that in mkiv we print back to tex every now and 
then and then we use one of the predefined catcode tables.

Another option is:

  [\c!format=\letterpercent d]

Hans


-
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
  | 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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] catcode change in macros

2008-11-15 Thread Aditya Mahajan
On Sat, 15 Nov 2008, Wolfgang Schuster wrote:

>
> Am 14.11.2008 um 19:37 schrieb Aditya Mahajan:
>
>> On Fri, 14 Nov 2008, Aditya Mahajan wrote:
>>
>>> On Fri, 14 Nov 2008, Wolfgang Schuster wrote:
>>>
 Hi,

 I make in a module the comment sign a simple letter to pass
 number formats to a lua function and want to know if should
 use another (better) way to change the catodes.
>>>
>>> I think it will be cleaner to use catcode tables. See syst-cat.mkiv.
>>
>> and syst-cat.tex
>
> I keep now my low level solution but with fewer lines.

Even though you are still using the mailling list, I will reply :-)

> To help other users with the same question I present
> here my solution:
>
> \def\ax{ax}
>
> \def\setupaxis
>   {\catcode`\%\@@letter
>\dodoubleargument\dosetupaxis}
>
> \def\dosetupaxis[#1][#2]%
>   {\def\docommand##1{\getparameters[\ax##1][#2]}%
>\catcode`\%\@@comment
>\processcommalist[#1]\docommand}
>
> \setupaxis
>   [\c!x,\c!y]
>   [\c!format=%d]

Here you are assuming that whenever \setupaxis will be used, the catcode 
of % is comment. This may not be the case. You can of course, store the 
inital catcode of % and then restore it later, as done by many LaTeX 
packages.

The main advantage of catcode tables is that you can do
\pushcatcodetable, and \popcatcodetable, and not do the book keeping 
yourself. Here is a solution using catcodetables:

\unprotect

% A mixture of \startcatcodetable and \extendcatcodetable
\long\def\startchangecatcodetable#1#2#3\stopchangecatcodetable
   {\bgroup
\catcodetable\scratchcatcodetable
\catcodetable#1\relax
#3%
\savecatcodetable#2\relax
\egroup}


\newcatcodetable \LUAstringcatcodes

\startchangecatcodetable \ctxcatcodes \LUAstringcatcodes
   \catcode`\%\@@letter
\stopchangecatcodetable

\protect

\starttext

\pushcatcodetable
\catcodetable\LUAstringcatcodes
% Does this print
Hello world
\popcatcodetable

\stoptext

So, you code now becomes

\unprotect
\def\ax{ax}

\def\setupaxis
   {\pushcatcodetable
\catcodetable\LUAstringcatcodes
\dodoubleargument\dosetupaxis}

\def\dosetupaxis[#1][#2]%
   {\def\docommand##1{\getparameters[\ax##1][#2]}%
\popcatcodetable
\processcommalist[#1]\docommand}

\setupaxis
   [\c!x,\c!y]
   [\c!format=%d]

Hans, do you think that something like \startchangecatcodetable should be 
added to the core. An old definition of \extendcatcodetable almost does 
that, but does not provide a name to the resulatant catcodetable.

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


Re: [NTG-context] How to randomize points in a given area?

2008-11-15 Thread Wolfgang Schuster

Am 15.11.2008 um 04:10 schrieb Yue Wang:

> Hi, Hans,
>
> In your "metapost graphics" pdf document, I can find a card which
> randomizes points in a path of Christmas tree, how to do that? thanks.


You could try to make something with this example code.

\setupcolors[state=start]

\starttext

\startMPpage[offset=1cm]
for i=1 upto 5000:
 v := uniformdeviate(100) + 1 ;
 h := uniformdeviate(v) / 5 * normaldeviate ;
 l := uniformdeviate(5) ;
 draw ((-l,0)--(l,0)) rotated uniformdeviate(180) shifted (h,-v)  
withcolor transparent(1,.5,green) ;
endfor
\stopMPpage

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


Re: [NTG-context] catcode change in macros

2008-11-15 Thread Wolfgang Schuster

Am 14.11.2008 um 19:37 schrieb Aditya Mahajan:

> On Fri, 14 Nov 2008, Aditya Mahajan wrote:
>
>> On Fri, 14 Nov 2008, Wolfgang Schuster wrote:
>>
>>> Hi,
>>>
>>> I make in a module the comment sign a simple letter to pass
>>> number formats to a lua function and want to know if should
>>> use another (better) way to change the catodes.
>>
>> I think it will be cleaner to use catcode tables. See syst-cat.mkiv.
>
> and syst-cat.tex

I keep now my low level solution but with fewer lines.

To help other users with the same question I present
here my solution:

\def\ax{ax}

\def\setupaxis
   {\catcode`\%\@@letter
\dodoubleargument\dosetupaxis}

\def\dosetupaxis[#1][#2]%
   {\def\docommand##1{\getparameters[\ax##1][#2]}%
\catcode`\%\@@comment
\processcommalist[#1]\docommand}

\setupaxis
   [\c!x,\c!y]
   [\c!format=%d]

Regards,
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] equal columnset height on last page?

2008-11-15 Thread Yue Wang
Hi, power ConTeXt users:

Is there any way to get automatic equal columnset heights on last
page? (on the last page, all column are of the same height).
I browsed column.pdf and only find ways to manually set number of
lines in each columnset.

Yue Wang
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] stretching smallcaps with a style command

2008-11-15 Thread Bob Reynolds
Hello Everyone:

I'm an intermediate-skilled user trying to typeset notes for my CompTIA A+ 
certification course with ConTeXt, but I'm having trouble with styling 
abbreviations. I would like to letterspace (I think that is a correct 
typographical term, I'm a little new at typesetting, sorry) and smallcap my 
dozens of abbreviations, and I can get it to work manually but not with 
\setupsynonyms. Googling the wiki, mailing lists, etc. didn't help and I'm not 
enough of a TeX programmer to understand the definitions in the source code in 
this case. I run TeXLive 2008 on Gentoo Linux with ConTeXt version:

CtxTools | context version: 2008.05.21 15:21 
(/usr/share/texmf-dist/tex/context/base/context.tex)
CtxTools | context version: 2008.05.21 15:21 
(/usr/share/texmf-dist/tex/context/base/cont-new.tex)

http://live.contextgarden.net/ doesn't seem to be working for anything at the 
moment, so I don't know if it works there or not. Below is a small sample input 
I made to illustrate my attempts; I tried to make it as transparent as 
possible. I would greatly appreciate any help.

Thank You Very Much,
Bob



\setupcolor [hex]
\definecolor [LightBlue] [h=8080FF]
\setupcolors [state=start]

\setupbodyfont [10pt]
\setupcapitals [sc=yes]

\def\stretchedspaceamount {.1em}
\define [1] \StretchedSmallCaps {\smallcaps {\stretchedlowercase {#1}}}
\define \Term {\color [LightBlue]}

% \setupsynonyms [abbreviation] [textstyle=\StretchedSmallCaps] % I would like 
this to work, but it doesn't
% \setupsynonyms [abbreviation] [textstyle=\italic] % other commands like this 
work
\abbreviation {CPU} {central processing unit}


\starttext

\Term {\StretchedSmallCaps {CPU}} = \Term {\infull {CPU}} % this produces the 
output that I want

\Term {\smallcaps {\lowercase {CPU}}} = \Term {\infull {CPU}} % this is what it 
looks like without stretching

\Term {\CPU} = \Term {\infull {CPU}} % this is what I want to type to produce 
the stretched, smallcaps output

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