Re: [NTG-context] Wrong results for chemical structures and reactions
2012-10-02 Alan BRASLAU
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
participants (1)
-
Marco Patzer