label oxidation and chemical reduction in chemical formula

View: New views
5 Messages — Rating Filter:   Alert me  

label oxidation and chemical reduction in chemical formula

by Arne Röhrs :: Rate this Message:

| View Threaded | Show Only this Message

Hello,

normally I'am  using mhchem for simpel chemical formulas.

But now I want to create a chemical formula at which it is labeled  
with an arrow for exampel that "Natrium" is oxidised from Na to Na+

Example:

oxidation
-----------------
|                    |
Na + Cl -> Na+   +   Cl-

Is there someone, who has an example for me created with tikz?

Best wishes

Arne

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

Re: label oxidation and chemical reduction in chemical formula

by Hans Meine-4 :: Rate this Message:

| View Threaded | Show Only this Message

On Montag 20 Oktober 2008, Arne Röhrs wrote:
> normally I'am  using mhchem for simpel chemical formulas.
>
> But now I want to create a chemical formula at which it is labeled
> with an arrow for exampel that "Natrium" is oxidised from Na to Na+

I would try still using mhchem (disclaimer: which I don't know anything about)
and somehow try to insert anchors for a TikZ overlay (see manual).

HTH,
  Hans


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

signature.asc (204 bytes) Download Attachment

Re: label oxidation and chemical reduction in chemical formula

by Kjell Magne Fauske :: Rate this Message:

| View Threaded | Show Only this Message

On Tue, Oct 21, 2008 at 4:39 PM, Hans Meine
<meine@...> wrote:
> On Montag 20 Oktober 2008, Arne Röhrs wrote:
>> normally I'am  using mhchem for simpel chemical formulas.
>>
>> But now I want to create a chemical formula at which it is labeled
>> with an arrow for exampel that "Natrium" is oxidised from Na to Na+
>


> I would try still using mhchem (disclaimer: which I don't know anything about)
> and somehow try to insert anchors for a TikZ overlay (see manual).
>

Indeed. I took a look at mhchem and it turns out that mhchem uses tikz
internally for drawing arrows (if you use the arrows=pgf option).
Here is a quick hack that may be of some help:

%%%
\documentclass{article}
\usepackage{tikz}
\usepackage[version=3,arrows=pgf]{mhchem}

\begin{document}

\newcommand\ccoord[1]{%
\tikz[remember picture,overlay,baseline]{\path (0.5em,0.9em) coordinate (#1);}%
}

\ce{{\ccoord{a}} Na + Cl -> Na+   +   {\ccoord{b}} Cl-}

\tikz[overlay,remember picture] {
    \draw[red!50!black,->] (a) -- ++(0,0.7em) -| (b);
}
\end{document}
%%%

I was a bit surprised that this worked. You have to wrap the call to
\ccoord in curly braces. Otherwise TikZ will complain. Remember to
compile twice to get correct placement of the arrow.

Hope this helps.

Regards,
Kjell Magne Fauske

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

Parent Message unknown Re: label oxidation and chemical reduction in chemical formula

by Arne Röhrs :: Rate this Message:

| View Threaded | Show Only this Message

Hello,


here is the code for everyone who has the same problem ... ;-))
The code is not perfect, but it works. At first.

Suddenly, there are some mistakes by running latex. I dont know why.
First time everything works fine.
But the result is already right.


\\documentclass{article}
\usepackage{tikz}
\usepackage[version=3,arrows=pgf]{mhchem}

\begin{document}
\newcommand\ccoord[1]{%
\tikz[remember picture,overlay,baseline]{\path (0.5em,0.9em)  
coordinate (#1);}%
}

\newcommand\bcoord[1]{%
\tikz[remember picture,overlay,baseline]{\path (0.4em,-0.3em)  
coordinate (#1);}%
}
\ce{{\ccoord{a}} Na + {\bcoord{c}} Cl ->    {\ccoord{b}} Na+  +  
{\bcoord{d}} Cl-}

\tikz[overlay,remember picture] {
    \draw[thick,red!80!black,->] (a) -- ++(0,0.7em) -| (b) node[above,  
near start] {Oxidation};
}

\tikz[overlay,remember picture] {
       \draw[thick,blue!80!,black->] (c) -- +(0,-0.7em) -| (d)  
node[below, near start] {Reduktion};
}

\end{document}



Best wishes

Arne

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

Parent Message unknown Re: label oxidation and chemical reduction in chemical formula

by Arne Röhrs :: Rate this Message:

| View Threaded | Show Only this Message

Sorry!!!

I have found the mistake!!!
A comma was wrong ...

Here is the right code.

\documentclass{article}
\usepackage{tikz}
\usepackage[version=3,arrows=pgf]{mhchem}

\begin{document}
\newcommand\ccoord[1]{%
\tikz[remember picture,overlay,baseline]{\path (0.5em,0.9em)  
coordinate (#1);}%
}

\newcommand\bcoord[1]{%
\tikz[remember picture,overlay,baseline]{\path (0.4em,-0.3em)  
coordinate (#1);}%
}
\ce{{\ccoord{a}} Na + {\bcoord{c}} Cl ->    {\ccoord{b}} Na+  +  
{\bcoord{d}} Cl-}

\tikz[overlay,remember picture] {
    \draw[thick,red!80!black,->] (a) -- ++(0,0.7em) -| (b) node[above,  
near start] {Oxidation};
}

\tikz[overlay,remember picture] {
       \draw[thick,blue!80!black,->] (c) -- +(0,-0.7em) -| (d)  
node[below, near start] {Reduktion};
}

\end{document}

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users