ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Wrong results for chemical structures and reactions
@ 2012-10-02  7:40 Marco Patzer
  2012-10-02  8:06 ` Alan BRASLAU
       [not found] ` <20121002115026.5b4f19f3@sole>
  0 siblings, 2 replies; 4+ messages in thread
From: Marco Patzer @ 2012-10-02  7:40 UTC (permalink / raw)
  To: context

Hi,

chemical structures and reactions produce wrong results. Here is one
example from the wiki and two from the manual.

\starttext

%% does not typeset the reaction, prints the commas, wrong spacing
%% and no arrow
\startformula
 \chemical{2H_2,+,O_2,->,2H_2O}
\stopformula

%% same here, GIVES is not interpreted
\startformula
  \chemical{A,GIVES,B,EQUILIBRIUM,C,MESOMERIC,D}
\stopformula

%% wrong alignment, rules overlay symbols
\startformula
  \setupchemical
    [width=fit,
     height=fit,
     scale=small,
     size=small]
  \startchemical
    \chemical[ONE,Z0,DB1,SB46,MOV1,Z0,SB28][C,C]
  \stopchemical
  \startchemical
    \chemical[SPACE,PLUS,SPACE]
  \stopchemical
  \startchemical
    \chemical[ONE,Z0,SB146,Z6][N,H]
  \stopchemical
  \startchemical
    \chemical[SPACE,GIVES,SPACE]
  \stopchemical
  \startchemical
    \chemical[ONE,Z07,SB1357,MOV1,Z0,SB27,PB:Z2,ONE,Z0,SB13,PE][C,H,C,N]
  \stopchemical
\stopformula

\stoptext

Am I missing something? Is this mechanism not supported any more or
just broken?


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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Wrong results for chemical structures and reactions
  2012-10-02  7:40 Wrong results for chemical structures and reactions Marco Patzer
@ 2012-10-02  8:06 ` Alan BRASLAU
  2012-10-02  8:36   ` Marco Patzer
       [not found] ` <20121002115026.5b4f19f3@sole>
  1 sibling, 1 reply; 4+ messages in thread
From: Alan BRASLAU @ 2012-10-02  8:06 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Tue, 2 Oct 2012 09:40:35 +0200
Marco Patzer <homerow@lavabit.com> wrote:

> Hi,
> 
> chemical structures and reactions produce wrong results. Here is one
> example from the wiki and two from the manual.
> 
> \starttext
> 
> %% does not typeset the reaction, prints the commas, wrong spacing
> %% and no arrow
> \startformula
>  \chemical{2H_2,+,O_2,->,2H_2O}
> \stopformula
> 
> %% same here, GIVES is not interpreted
> \startformula
>   \chemical{A,GIVES,B,EQUILIBRIUM,C,MESOMERIC,D}
> \stopformula
> 
> %% wrong alignment, rules overlay symbols
> \startformula
>   \setupchemical
>     [width=fit,
>      height=fit,
>      scale=small,
>      size=small]
>   \startchemical
>     \chemical[ONE,Z0,DB1,SB46,MOV1,Z0,SB28][C,C]
>   \stopchemical
>   \startchemical
>     \chemical[SPACE,PLUS,SPACE]
>   \stopchemical
>   \startchemical
>     \chemical[ONE,Z0,SB146,Z6][N,H]
>   \stopchemical
>   \startchemical
>     \chemical[SPACE,GIVES,SPACE]
>   \stopchemical
>   \startchemical
>     \chemical[ONE,Z07,SB1357,MOV1,Z0,SB27,PB:Z2,ONE,Z0,SB13,PE][C,H,C,N]
>   \stopchemical
> \stopformula
> 
> \stoptext
> 
> Am I missing something? Is this mechanism not supported any more or
> just broken?
> 
> 
> Marco

\startchemicalformula
not
\startformula

\startchemicalformula
        \chemical{2H_2}
        \chemical{PLUS}
        \chemical{O_2}
        \chemical{GIVES}
        \chemical{2H_2O}
\stopchemicalformula

Also, the shorthand "+" for "PLUS", "->" for "GIVES", etc.
seems to be interpreted only inline, not in displayed chemical formula
mode.


I am working (with Hans) to correct the mkiv chemical code,
which has been completely re-written (from ppchTeX macros).
Also working on a new manual, at the same time...

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Wrong results for chemical structures and reactions
  2012-10-02  8:06 ` Alan BRASLAU
@ 2012-10-02  8:36   ` Marco Patzer
  0 siblings, 0 replies; 4+ messages in thread
From: Marco Patzer @ 2012-10-02  8:36 UTC (permalink / raw)
  To: context

2012-10-02 Alan BRASLAU <alan.braslau@cea.fr>:

Hi Alan

> > chemical structures and reactions produce wrong results. Here is one
> > example from the wiki and two from the manual.
> > 
> > […]
> > 
> \startchemicalformula
> not
> \startformula
> 
> \startchemicalformula
>         \chemical{2H_2}
>         \chemical{PLUS}
>         \chemical{O_2}
>         \chemical{GIVES}
>         \chemical{2H_2O}
> \stopchemicalformula

The spacing is still wrong. Compare:

\starttext
  \chemical{2H_2,+,O_2,->,2H_2O}\blank
  \startchemicalformula
    \chemical{2H_2}
    \chemical{PLUS}
    \chemical{O_2}
    \chemical{GIVES}
    \chemical{2H_2O}
  \stopchemicalformula
\stoptext

How to mid-align the reaction? Wrapping the \startchemicalformula in
\startformula works, but it's clumsy.

> Also, the shorthand "+" for "PLUS", "->" for "GIVES", etc.
> seems to be interpreted only inline, not in displayed chemical formula
> mode.
> 
> 
> I am working (with Hans) to correct the mkiv chemical code,
> which has been completely re-written (from ppchTeX macros).
> Also working on a new manual, at the same time...

That's brilliant!


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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Wrong results for chemical structures and reactions
       [not found] ` <20121002115026.5b4f19f3@sole>
@ 2012-10-02 10:16   ` Marco Patzer
  0 siblings, 0 replies; 4+ messages in thread
From: Marco Patzer @ 2012-10-02 10:16 UTC (permalink / raw)
  To: context

2012-10-02 Alan BRASLAU <alan.braslau@cea.fr>:

> Try the following:
> 
> \starttext
> 
> \startchemicalformula
>  \chemical{2H_2}
>  \chemical{+}
>  \chemical{O_2}
>  \chemical{->}
>  \chemical{2H_2O}
> \stopchemicalformula

\chemical{->} is not rendered correctly.

> \startchemicalformula
>  \chemical{2H_2}
>  \chemical{PLUS}
>  \chemical{O_2}
>  \chemical{GIVES}
>  \chemical{2H_2O}
> \stopchemicalformula

The spacing is wrong. The following yields to better spacing:

\startchemicalformula
 \chemical{2H_2}
 \chemical{PLUS}
 \chemical{}
 \chemical{O_2}
 \chemical{GIVES}
 \chemical{}
 \chemical{2H_2O}
\stopchemicalformula

> \startchemicalformula
>   \chemical{A}
>   \chemical{GIVES}
>   \chemical{B}
>   \chemical{EQUILIBRIUM}
>   \chemical{C}
>   \chemical{MESOMERIC}
>   \chemical{D}
> \stopchemicalformula

Same spacing problem, workaround: \chemical{}

> \setupchemical
>     [width=fit,
>      height=fit,
>      scale=small,
>      size=small]
> 
> \hbox{
> \startchemical
>     \chemical[ONE,Z0,DB1,SB46,MOV1,Z0,SB28][C,C]
> \stopchemical
> \startchemicalformula
>     \chemical{PLUS}
> \stopchemicalformula
> \startchemical
>     \chemical[ONE,Z0,SB146,Z6][N,H]
> \stopchemical
> \startchemicalformula
>     \chemical{GIVES}
> \stopchemicalformula
> \startchemical
>     \chemical[ONE,Z07,SB1357,MOV1,Z0,SB27,MOV2,Z0,SB13][C,H,C,N]
> \stopchemical
> }

Worse than before.

> 3. I believe that the syntax should be rationalized, but I will have to
> discuss this further with Hans. Normally, commands have keywords
> between [] and text to be typeset between {}. This would mean
> \startchemical
> 	\chemical[ONE,Z0,SB146,Z6]{N}{H}
> \stopchemical
> 
> Alternatively:
> \startchemical
> 	\chemical[ONE,Z0=N,SB146,Z6=H]
> \stopchemical
> but currently this puts "N" and "H" into lowercase as "n" and "h"
> as a side effect of the way that Hans wrote the lua code.

If you redo the syntax: My suggestion would be to try to reduce the
use of the string “chemical” if that's feasible.

> How to deal with inline equations, as in \chemical{2H_2,+,O_2,->,2H_2O}?
> I would think that it could work as does math mode:
> \chemical{2H_2 + O_2 -> 2H_2O} (no commas) with spaces (or none)
> delimiting the keywords.

That looks more practical.

> Hans will have to answer me on this. We need to be a bit patient,

I don't need that now. For the current project all structures look
fine (ugly hacks included :). You may consider my comments above
when you (or Hans) are redoing the code. Thanks for the
\startchemicalformula hint, that was the missing piece.

> as I'm sure that he is currently VERY busy preparing for EuroTeX 2012!

Sure. Unfortunately I cannot come, I can't get a week off and for
1-2 days it's too far.


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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-02 10:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-02  7:40 Wrong results for chemical structures and reactions Marco Patzer
2012-10-02  8:06 ` Alan BRASLAU
2012-10-02  8:36   ` Marco Patzer
     [not found] ` <20121002115026.5b4f19f3@sole>
2012-10-02 10:16   ` Marco Patzer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).