[NTG-context] Setting style and color attributes of label in metapost

2011-09-24 Thread Aditya Mahajan
I am writing a module which uses metapost in the background for drawing. I 
wanted to create an interface for setting the style and color of metapost 
labels but using \doset...attributes is not working.


Here is an example:

\definenamespace
  [test]
  [style=yes,
   name=test,
   command=yes,
   setup=yes]

\definetest
  [blue]
  [color=blue, text=Blue]

\definetest
  [two]
  [blue]
  [style=\bold, text=Two]

\starttext
\edef\currenttest{two}
\startMPdrawing
  label.lft(\sometxt{\dosettestattributes{style}{color}
  \testparameter{text}}, (0,0)) ;
\stopMPdrawing

\edef\currenttest{blue}
\startMPdrawing
  label.lft(\sometxt{\dosettestattributes{color}{style}
  \testparameter{text}}, (2cm,0)) ;
\stopMPdrawing
\MPdrawingdonetrue\getMPdrawing
\stoptext

Notice that the first label has the same style as the last label. This is 
happening because \doset..attributes is defined as an unexpandable macro. 
I can get around this by setting the value of \currenttest inside the 
\sometxt{...} argument. Something like:


\def\dosometxt#1#2%
{\normaldosometxt{#1}%
  {\def\noexpand\letterbackslash currenttest{\currenttest #2}}}


Surely, there should be a more direct way of achieving this?

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


Re: [NTG-context] caption labels

2011-09-24 Thread Wolfgang Schuster

Am 24.09.2011 um 13:27 schrieb Felix Ingram:

>> Am 23.09.2011 um 12:45 schrieb Felix Ingram:
>> 
> I'm defining a new float that I'd like to caption with its own label.
> Something like:
> 
> \definefloat[picture][pictures]
> 
> I'd then like the caption to read:
> 
> Picture 1 - my caption text
> Picture 2 - etc
> 
> At the moment I've used \setupcaption[picture][way=bytext] to sort out
> the numbering but I cannot figure out how to do the label.
 
 \setupcaption[picture][way=bytext,label=Picture] does the trick
>>> 
>>> This doesn't work for me. Setupcaption doesn't appear to support a
>>> label option (MKIV and assuming I'm looking at the correct source
>>> file…)
>> 
>> Use “\setuplabeltext[picture=Picture ]”.
>> 
>> Wolfgang
> 
> Firstly, thanks for the reply. Secondly, apologies again for not
> supplying a minimal example - this would have helped me track down
> what's causing my issue.
> 
> 
> \mainlanguage[en-gb] %% Remove me for labels
> %\mainlanguage[en]  %% or use me instead
> 
> \definefloat[picture][pictures] % Define our fancy boxout
> \starttext
> \placepicture{This is my caption}{Some float text}
> \stoptext
> 
> 
> The above will fail to generate a caption. Removing the \mainlanguage
> command will cause the label to appear as expected. Using
> \setuplabeltext[en-gb][picture=Picture ] will fail to work. Changing
> the main language to 'en' or 'nl' will cause the label to reappear.
> 
> I'll change the main language to 'en' for the time being.

Use can use “\setuplabeltext[en][picture=Picture ]” to set a label for “en-gb”.

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] caption labels

2011-09-24 Thread Felix Ingram
> Am 23.09.2011 um 12:45 schrieb Felix Ingram:
>
 I'm defining a new float that I'd like to caption with its own label.
 Something like:

 \definefloat[picture][pictures]

 I'd then like the caption to read:

 Picture 1 - my caption text
 Picture 2 - etc

 At the moment I've used \setupcaption[picture][way=bytext] to sort out
 the numbering but I cannot figure out how to do the label.
>>>
>>> \setupcaption[picture][way=bytext,label=Picture] does the trick
>>
>> This doesn't work for me. Setupcaption doesn't appear to support a
>> label option (MKIV and assuming I'm looking at the correct source
>> file…)
>
> Use “\setuplabeltext[picture=Picture ]”.
>
> Wolfgang

Firstly, thanks for the reply. Secondly, apologies again for not
supplying a minimal example - this would have helped me track down
what's causing my issue.


\mainlanguage[en-gb] %% Remove me for labels
%\mainlanguage[en]  %% or use me instead

\definefloat[picture][pictures] % Define our fancy boxout
\starttext
\placepicture{This is my caption}{Some float text}
\stoptext


The above will fail to generate a caption. Removing the \mainlanguage
command will cause the label to appear as expected. Using
\setuplabeltext[en-gb][picture=Picture ] will fail to work. Changing
the main language to 'en' or 'nl' will cause the label to reappear.

I'll change the main language to 'en' for the time being.

Thanks again for the help,

Felix
___
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] math signs in itemize

2011-09-24 Thread R. Ermers
Dear all,
After my update a few days ago I have run into the problem earlier described 
under the subject "new beta" (Marco Pessotto). The file processed nicely until 
then. I use gentium as the main font.

\definefont[gentium][Xserif][name:Gentium at 12pt]
See more details underneath.

I am right before a deadline, so any help is welcome.

Kind regards,

Robert

Snippets from log file:

structure   > sectioning > subsection @ level 4 : 0.0.1.1 -> Sociale vorming
! Math error: parameter \Umathquad\displaystyle is not set.

system  > tex > error on line 741 in file asp87b.tex: Math error: 
parameter \Umathquad\displaystyle is not set ...


\mathematics ...rmalstartimath #1\normalstopimath 
  \fi 
\dodosymbol ...bol \csname \??ss :#1:#2\endcsname 
  \relax }\relax 
\donormalsymbol ...bol \redosymbol \currentsymbol 
  \fi \fi 
\dodosymbol ...bol \csname \??ss :#1:#2\endcsname 
  \relax }\relax 
\donormalsymbol ...bol \redosymbol \currentsymbol 
  \fi \fi 
 
   }
...
l.741 \item h
 et type van de abc abc abc
? 
! \textfont0 is undefined (character 8226).

system  > tex > error on line 741 in file asp87b.tex: \textfont0 is 
undefined (character 8226) ...

I use context version: 2011.05.18 18:04.



mkiv lua stats  > used config file  - 
selfautoparent:/texmf/web2c/texmfcnf.lua
mkiv lua stats  > used cache path   - 
/prog2/context2/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e
mkiv lua stats  > input load time   - 0.005 seconds
mkiv lua stats  > stored bytecode data  - 285 modules, 60 tables, 345 chunks
mkiv lua stats  > loaded tex modules- 4 requested, 4 found (*-newmat 
t-annotation t-lettrine t-simplefonts), 0 missing
mkiv lua stats  > cleaned up reserved nodes - 33 nodes, 11 lists of 426
mkiv lua stats  > node memory usage - 62 hlist, 2 vlist, 256 disc, 3 
math, 369 glue, 134 kern, 26 penalty, 1 noad, 1 math_char, 1875 glyph, 877 
attribute, 106 glue_spec, 183 attribute_list, 2 temp, 7 if_stack, 8 local_par, 
3 dir, 2 late_lua
mkiv lua stats  > node list callback tasks  - 6 unique task lists, 6 instances 
(re)created, 4004 calls
mkiv lua stats  > used backend  - pdf (backend for directly 
generating pdf output)
mkiv lua stats  > loaded patterns   - en::2 nl::1
mkiv lua stats  > callbacks - 4337 direct, 5407 indirect, 9744 
total
mkiv lua stats  > lxml preparation time - 0.000 seconds, 0 nodes, 17 lpath 
calls, 6 cached calls
mkiv lua stats  > result saved in file  - asp87b.pdf
mkiv lua stats  > loaded fonts  - 4 files: lmmono10-regular.otf 
texgyretermes-bold.otf texgyretermes-italic.otf texgyretermes-regular.otf
mkiv lua stats  > fonts load time   - 1.036 seconds 
mkiv lua stats  > math processing time  - 2.428 seconds 
mkiv lua stats  > graphics processing time  - 0.003 seconds including tex, 1 
processed images
mkiv lua stats  > luatex banner - this is luatex, version 
beta-0.70.1-2011051908 (rev 4277)
mkiv lua stats  > control sequences - 30844 of 165536
mkiv lua stats  > current memory usage  - 33 MB (ctx: 34 MB)
mkiv lua stats  > runtime   - 5.377 seconds, 3 processed pages, 
3 shipped pages, 0.558 pages/second



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