[NTG-context] m-database: setting text style for every first line of a table, and text/cell style for specific parts of the table?

2012-05-05 Thread Sander Maijers
Hello everyone,

I did manage to get a background color for the first row. This is a snippet 
that I use

\defineseparatedlist
  [CSV]
  [separator=comma,
   
first={\bTR[align=middle,background=color,backgroundcolor=gray]},last=\eTR,
   left=\bTD,right=\eTD,
   before={\bTABLE[align=middle]},after=\eTABLE]

\processseparatedfile[CSV][/tmp/CSV.csv]

Also, can you think of a way to specify the cell and text style for individual 
cells with processseparatedfile?

Regards,
Sander Maijers
___
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] Font for MetaPost graphics

2012-05-05 Thread Aditya Mahajan

On Sat, 5 May 2012, Marco wrote:


On 2012-05-05 Hans Hagen  wrote:

That means, MPenvironment will be dropped, right? But what is the
new interface, \setupMPtext or MPinstance?


\setupMPinstance

The advantage is that you can have multiple instances in parallel.

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] Font for MetaPost graphics

2012-05-05 Thread Marco
On 2012-05-05 Hans Hagen  wrote:

That means, MPenvironment will be dropped, right? But what is the
new interface, \setupMPtext or MPinstance?

>  > +1
>  >
>  > Marco
> 
> So .. we know who is going to wikify this ...

You're welcome :)

Marco


___
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] Font for MetaPost graphics

2012-05-05 Thread Hans Hagen

On 4-5-2012 09:13, Aditya Mahajan wrote:

On Fri, 4 May 2012, Mojca Miklavec wrote:


I can think of many workarounds to this, but I agree that there is a
valid reason why
\startMPenvironment
(or some other command) should be able to change the font inside
metapost labels only.


A better alternative would to define

\setupMPtext
[
style=...,
color=...,
setups=...,
]

that can be used to set the style for metapost text.


As we already have instances, I've extended that mechanism, so one can say:

\startsetups mp:instance:one
indeed:\space
\stopsetups

\setupMPinstance
  [metafun]
  [textstyle=bold,
   textcolor=darkgreen,
   setups=mp:instance:one]

\defineMPinstance
  [mympinstance]
  [metafun]
  [textcolor=red]

\starttext

\startMPcode
draw textext("some text") ;
\stopMPcode

\startMPcode{mympinstance}
draw textext("some text") ;
\stopMPcode

\stoptext

> +1
>
> Marco

So .. we know who is going to wikify this ...

Hans


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Font for MetaPost graphics

2012-05-05 Thread Hans Hagen

On 4-5-2012 13:09, Marco wrote:

On 2012-05-04 Aditya Mahajan  wrote:


On Fri, 4 May 2012, Mojca Miklavec wrote:



But my guess is that the  argument goes into the opposite way. I
past (and still in MKII) one *had  to* set up fonts twice - once
for the main  document and once for MetaPost  since MetaPost did
its own processing of labels and MetaPost didn't see the ConTeXt
font setups. So  it was "difficult" to convince  MetaPost to use
the same font.


I agree, it's  a big step forward towards  usability and consistency
to have  MetaPost automatically inherit ConTeXts  settings. However,
it went out-of-control now.


well, you still get text and not something random, so out-of-control is 
a bit too strong


anyhow, we can do

\newconditional\MPLIBtextgetdone

\def\MPLIBsettext#1% #2%
  {\ifconditional\MPLIBtextgetdone
   \else
 \cldcontext{metapost.tex.get()}%
 \settrue\MPLIBtextgetdone % no \global needed
   \fi
   \dowithnextbox{\ctxlua{metapost.settext(\number\nextbox,#1)}}\hbox}

\def\MPLIBresettexts
  {\ctxlua{metapost.resettextexts()}%$
   \setfalse\MPLIBtextgetdone}

\starttext

Serif

\startMPcode
draw textext("\ss Sans") ;
\stopMPcode

Serif

\startMPenvironment
\ss
\stopMPenvironment

\startMPcode
draw textext("Sans") ;
\stopMPcode

Serif

\stoptext



A better alternative would to define

\setupMPtext
 [
  style=...,
  color=...,
  setups=...,
 ]

that can be used to set the style for metapost text.


this is ok for me, but then we mighe as well drop \startMPenviroment 
(and someone has to wikify that then)


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] drawarrow and transparency

2012-05-05 Thread Hans Hagen

On 2-5-2012 17:35, Alan BRASLAU wrote:

I have a MetaPost question concerning drawarrow withtransparency
(or any other compound object).

Is there some clever way to achieve uniform transparency
for a compound object? For example, in the minimal example
below, how can one obtain a transparent arrow without getting
an X-ray vision of the arrowhead?

\starttext
\startMPpage
drawarrow origin--(1cm,0) withtransparency(1,.5) ;
drawarrow origin--(0,1cm) withtransparency(1,.5) ;
\stopMPpage
\stoptext


This is a side effect of an arrow being a composed graphic. I 
experimented a bit with transparency grouping and after several variants 
I settled to the following approach:


\starttext

\startMPpage[offset=1mm]

drawarrow (1cm,0cm) -- (0cm,0cm) withcolor red 
withtransparency(1,.5)  ;


draw image (
drawarrow (1cm,0cm) -- (0cm,0cm) withcolor red 
withtransparency(1,.5)  ;

) shifted (0,2mm) asgroup "" ;

draw image (
drawarrow (1cm,0cm) -- (0cm,0cm) withcolor red 
withtransparency(1,.5)  ;

) shifted (0,4mm) asgroup "isolated" ;

draw image (
drawarrow (1cm,0cm) -- (0cm,0cm) withcolor red 
withtransparency(1,.5)  ;

) shifted (0,6mm) asgroup "knockout" ;

draw image (
drawarrow (1cm,0cm) -- (0cm,0cm) withcolor red 
withtransparency(1,.5)  ;

) shifted (0,8mm) asgroup "isolated,knockout" ;

addbackground withcolor green ;

\stopMPpage

\stoptext

As we have to use xforms (a pitty that this is needed) there is the 
usual interference and something fishy with clipping is going on.


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___