[NTG-context] ppchtex, color and mkiv

2010-11-19 Thread Jörg Hagmann
From a thread on this list (May 2009: 
http://archive.contextgarden.net/message/20090512.132914.5c29b5f4.en.html) 
I gather that whereas colouring a whole molecule works fine, colouring 
groups within a chemical structure is not yet fully implemented in mkiv. 
 Is that still correct?


Putting colour on atoms works with {\blue C} etc. or \defineprocessor 
... etc. chemred-C etc.. However, I couldn't find a way to colour the 
bonds belonging to the group. Is there one?


ppchTEX does a superb job and I hope that the most useful features will 
be implemented in the near future in mkiv!


Jörg
___
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] ppchtex, color and mkiv

2010-11-19 Thread Alan BRASLAU
On Friday 19 November 2010 09:52:47 Jörg Hagmann wrote:
  From a thread on this list (May 2009:
 http://archive.contextgarden.net/message/20090512.132914.5c29b5f4.en.html)
 I gather that whereas colouring a whole molecule works fine, colouring
 groups within a chemical structure is not yet fully implemented in mkiv.
   Is that still correct?
 
 Putting colour on atoms works with {\blue C} etc. or \defineprocessor
 ... etc. chemred-C etc.. However, I couldn't find a way to colour the
 bonds belonging to the group. Is there one?

The only way that I managed to do this is to draw the chemical twice and to 
use overlays (or to trick the bounding box using left=,right=,top=,bottom=). 
It would be nice to be able to draw colored bonds, perhaps with the syntax:
\chemical[SIX,rulecolor=blue,SB1,rulecolor=black,SB2..6][]

The problem is that we usually don't mix single tokens with token=val.
(but Hans has broken this rule with an experimental feature: Z1=C, currently 
broken as it converts C to lowercase...)

For now, rulecolor= can only be specified in \startchemical or \setupchemical.

Maybe we can discuss this with Hans off-list?

Alan
___
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] ppchtex color

2009-05-13 Thread Hans Hagen

Alan BRASLAU wrote:

i split ppchtex in mkii/mkiv (and included the fixes) so we can improve
things eventually

can you check if it still runs ok (beta zip on website)

Hans


Works correctly (bonds in red, atoms in black):

\usemodule[chemic]
\setupchemical[rulecolor=red]
\starttext
\startchemical
\chemical[ONE,SB,Z0][C]
\stopchemical
\stoptext


However, the following variant does not work.

\usemodule[chemic]
\starttext
\startchemical[rulecolor=red]
\chemical[ONE,SB,Z0][C]
\stopchemical
\stoptext

I don't understand, as my (quick) look at the source code
indicates that the parameters should be handled identically.


no, that was actually the problem ... local vs global ... for the moment 
set it up local (per formula) as i need to make an inheritance chain


now that i've split in mkii/mkiv that's easier since we no longer have 
to keep things working in latex (which means that we can use more core 
helper code)


just remind me occasionally

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] ppchtex color

2009-05-13 Thread Alan BRASLAU
On Wednesday 13 May 2009 10:33:18 Hans Hagen wrote:
 Alan BRASLAU wrote:
  Works correctly (bonds in red, atoms in black):
 
  \usemodule[chemic]
  \setupchemical[rulecolor=red]
  \starttext
  \startchemical
  \chemical[ONE,SB,Z0][C]
  \stopchemical
  \stoptext
 
 
  However, the following variant does not work.
 
  \usemodule[chemic]
  \starttext
  \startchemical[rulecolor=red]
  \chemical[ONE,SB,Z0][C]
  \stopchemical
  \stoptext
 
  I don't understand, as my (quick) look at the source code
  indicates that the parameters should be handled identically.

 no, that was actually the problem ... local vs global ... for the moment
 set it up local (per formula) as i need to make an inheritance chain

 now that i've split in mkii/mkiv that's easier since we no longer have
 to keep things working in latex (which means that we can use more core
 helper code)

 just remind me occasionally

OK. The following extension would also be useful:

\usemodule[chemic]
\starttext
\startchemical
\chemical[SIX,B,rulecolor=red,AU][]
\stopchemical
\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
___


Re: [NTG-context] ppchtex color

2009-05-13 Thread Hans Hagen

Alan BRASLAU wrote:

On Wednesday 13 May 2009 10:33:18 Hans Hagen wrote:

Alan BRASLAU wrote:

Works correctly (bonds in red, atoms in black):

\usemodule[chemic]
\setupchemical[rulecolor=red]
\starttext
\startchemical
\chemical[ONE,SB,Z0][C]
\stopchemical
\stoptext


However, the following variant does not work.

\usemodule[chemic]
\starttext
\startchemical[rulecolor=red]
\chemical[ONE,SB,Z0][C]
\stopchemical
\stoptext

I don't understand, as my (quick) look at the source code
indicates that the parameters should be handled identically.

no, that was actually the problem ... local vs global ... for the moment
set it up local (per formula) as i need to make an inheritance chain

now that i've split in mkii/mkiv that's easier since we no longer have
to keep things working in latex (which means that we can use more core
helper code)

just remind me occasionally


OK. The following extension would also be useful:

\usemodule[chemic]
\starttext
\startchemical
\chemical[SIX,B,rulecolor=red,AU][]
\stopchemical
\stoptext


in mkiv syntax that is:

\defineprocessor[chemred][color=red]

\startchemical
\chemical[SIX,SB,C135,R,Z][chemred-A,chemred-C,chemred-C]
\stopchemical

we can rewrite ppchtex a bit but it depends on how much time you want to 
spend on filling in the holes that i will create (i can make the framework)



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


[NTG-context] ppchtex color

2009-05-12 Thread Alan BRASLAU
No, ppchtex is not dead...

I would like to use color.

1. color= and rulecolor= does not appear to be implemented (mkiv)...
2. how can one change the color of the bonds?
3. using \color[red]{} causes the text to be offset.

minimal example:

\setupcolors[state=start]
\usemodule[chemic]
\starttext

\startchemical
\chemical[ONE,SB,Z0][C]
\stopchemical

\startchemical
\color[red]{\chemical[ONE,SB,Z0][C]}
\stopchemical
% text C is offset...

\startchemical
\chemical[ONE,SB,Z0][{\red C}]
\stopchemical
% OK, but I would like to draw the bonds as well in red.

\startchemical[color=red]
\chemical[ONE,SB,Z0][C]
\stopchemical
% C is red in mkii, black in mkiv

\startchemical[rulecolor=red]
\chemical[ONE,SB,Z0][C]
\stopchemical
% bonds are black, C is red in mkii, black in mkiv

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


Re: [NTG-context] ppchtex color

2009-05-12 Thread Hans Hagen

Alan BRASLAU wrote:


\startchemical
\color[red]{\chemical[ONE,SB,Z0][C]}
\stopchemical
% text C is offset...


add a % after the } (maybe we should ignore endofline, i.e. make a mkiv 
variant and extend/maintain that)



-
  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] ppchtex color

2009-05-12 Thread Hans Hagen

Alan BRASLAU wrote:

No, ppchtex is not dead...

I would like to use color.

1. color= and rulecolor= does not appear to be implemented (mkiv)...
2. how can one change the color of the bonds?
3. using \color[red]{} causes the text to be offset.

minimal example:

\setupcolors[state=start]
\usemodule[chemic]
\starttext

\startchemical
\chemical[ONE,SB,Z0][C]
\stopchemical

\startchemical
\color[red]{\chemical[ONE,SB,Z0][C]}
\stopchemical
% text C is offset...

\startchemical
\chemical[ONE,SB,Z0][{\red C}]
\stopchemical
% OK, but I would like to draw the bonds as well in red.

\startchemical[color=red]
\chemical[ONE,SB,Z0][C]
\stopchemical
% C is red in mkii, black in mkiv


has to do with different color mechanism ..

path line 1171:

\setbox2=\hbox{\@@dochemicalcolor$\@@dochemicalstyle{\@@localchemicalformat 
\chemicaltext}$}%




\startchemical[rulecolor=red]
\chemical[ONE,SB,Z0][C]
\stopchemical
% bonds are black, C is red in mkii, black in mkiv

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



--

-
  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] ppchtex color

2009-05-12 Thread Hans Hagen

Alan BRASLAU wrote:

No, ppchtex is not dead...

I would like to use color.

1. color= and rulecolor= does not appear to be implemented (mkiv)...
2. how can one change the color of the bonds?
3. using \color[red]{} causes the text to be offset.

minimal example:

\setupcolors[state=start]
\usemodule[chemic]
\starttext

\startchemical
\chemical[ONE,SB,Z0][C]
\stopchemical

\startchemical
\color[red]{\chemical[ONE,SB,Z0][C]}
\stopchemical
% text C is offset...

\startchemical
\chemical[ONE,SB,Z0][{\red C}]
\stopchemical
% OK, but I would like to draw the bonds as well in red.

\startchemical[color=red]
\chemical[ONE,SB,Z0][C]
\stopchemical
% C is red in mkii, black in mkiv

\startchemical[rulecolor=red]
\chemical[ONE,SB,Z0][C]
\stopchemical


setting happened at the outer level (ok, that's broken now but we can 
fix that later); so now, each formula must have the settings; when i 
have time i'll make a mkiv variant so that we can upgrade (i don't want 
interference with mkii since that version is also used in latex and we 
don't need to upgrade that)


\def\setchemicalattributes
  {\scratchdimen\@@chemicalrulethickness
   \def\chemicalattributes
 {withpen pencircle scaled \the\scratchdimen\space
  withcolor }%
   \doifelsenothing\@@chemicalrulecolor
 {\edef\chemicalattributes{\chemicalattributes black}}
 {\edef\chemicalattributes{\chemicalattributes 
\MPcolor{\@@chemicalrulecolor}}}%

   \startMPdrawing
 drawoptions (\chemicalattributes) ;
   \stopMPdrawing}


-
  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] ppchtex color

2009-05-12 Thread Hans Hagen

Alan BRASLAU wrote:

No, ppchtex is not dead...


i split ppchtex in mkii/mkiv (and included the fixes) so we can improve 
things eventually


can you check if it still runs ok (beta zip on website)

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] ppchtex color

2009-05-12 Thread Alan BRASLAU
 i split ppchtex in mkii/mkiv (and included the fixes) so we can improve
 things eventually
 
 can you check if it still runs ok (beta zip on website)
 
 Hans

Unzipped cont-tmf.zip on top of my minimals installation and ran context on my 
current working documents:

system  : module chemic loaded
(/usr/local/context.new/tex/texmf-context/tex/context/base/m-chemic.tex 
(/usr/local/context.new/tex/texmf-context/tex/context/base/m-chemic.mkiv
system  : module pictex loaded
(/usr/local/context.new/tex/texmf-context/tex/context/base/m-pictex.tex 
(/usr/local/context.new/tex/texmf-context/tex/context/base/thrd-pic.tex
warning : \dimen \linethickness is already defined (\relax it first)
)) (/usr/local/context.new/tex/texmf-context/tex/context/base/ppchtex.mkiv
ppchtex : using PiCTeX and MetaPost
)))

It appears to work as before...
(I will now look into your color suggestions.)

Alan



___
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] ppchtex color

2009-05-12 Thread Alan BRASLAU
 i split ppchtex in mkii/mkiv (and included the fixes) so we can improve
 things eventually
 
 can you check if it still runs ok (beta zip on website)
 
 Hans

Works correctly (bonds in red, atoms in black):

\usemodule[chemic]
\setupchemical[rulecolor=red]
\starttext
\startchemical
\chemical[ONE,SB,Z0][C]
\stopchemical
\stoptext


However, the following variant does not work.

\usemodule[chemic]
\starttext
\startchemical[rulecolor=red]
\chemical[ONE,SB,Z0][C]
\stopchemical
\stoptext

I don't understand, as my (quick) look at the source code
indicates that the parameters should be handled identically.

Alan

___
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] ppchtex color

2009-05-12 Thread Hans Hagen

Alan BRASLAU wrote:

i split ppchtex in mkii/mkiv (and included the fixes) so we can improve
things eventually

can you check if it still runs ok (beta zip on website)

Hans


Unzipped cont-tmf.zip on top of my minimals installation and ran context on my 
current working documents:


system  : module chemic loaded
(/usr/local/context.new/tex/texmf-context/tex/context/base/m-chemic.tex 
(/usr/local/context.new/tex/texmf-context/tex/context/base/m-chemic.mkiv

system  : module pictex loaded
(/usr/local/context.new/tex/texmf-context/tex/context/base/m-pictex.tex 
(/usr/local/context.new/tex/texmf-context/tex/context/base/thrd-pic.tex

warning : \dimen \linethickness is already defined (\relax it first)
)) (/usr/local/context.new/tex/texmf-context/tex/context/base/ppchtex.mkiv
ppchtex : using PiCTeX and MetaPost
)))

It appears to work as before...
(I will now look into your color suggestions.)


color should work ok (that is: color=red, and rulecolor=red)


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