Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have the following Chemistry equation:

2LiOH(s) + CO2(g) -> Li2CO3(s) + H2O

And I have the following LaTeX code:

\ce{2LiOH_{(s)} + CO_{2(g)} -> Li_{2}CO_{3(s)}+ H_{2}O_{(g)}}

But I can't get it to render properly. It displays like this:

Equation

Look at the arrow. What other parameters do I need?

share|improve this question
    
Just a sidenote: IUPAC recommends to typeset “the states of aggregation of chemical species [...] appended to the formula in parentheses and [...] printed in Roman (upright) type without a full stop (period).” This means: not as a subscript. –  cgnieder Mar 26 '12 at 16:09

3 Answers 3

up vote 13 down vote accepted

Can you please post a MWE? I can't reproduce your problem; the following simple code

\documentclass{article}
\usepackage{mhchem}

\begin{document}
  \ce{2LiOH_{(s)} + CO_{2(g)} -> Li_{2}CO_{3(s)} + H_{2}O_{(g)}}
\end{document}

gives me:

enter image description here

Perhaps you are using some outdated package(s)?

share|improve this answer
    
Whats a MWE? I will post one if i knew what it is. –  Dean Mar 21 '11 at 20:50
    
Yes i was using chemstyle so i changed to the mhchem one and thats fixed the problem thanks. –  Dean Mar 21 '11 at 20:52
    
@Dean: MWE = minimal working example. I initially forgot the link but now it's added. –  Gonzalo Medina Mar 21 '11 at 20:54
    
@Dean, Gonzalo: See also the post on meta about minimal examples. It also links to the page in Gonzalo's answer. –  Martin Scharrer Mar 21 '11 at 20:58
1  
Note that there should be a space before the + on the right-hand side, or the package interprets the + to indicate an ion. –  alex.jordan Mar 22 '13 at 22:07

The {mhchem} package is sensitive to spaces and I think the problem you were having was just due to some spaces in the wrong places. Compare:

\ce{2LiOH_{(s)} + CO_{2(g)} - >Li_{2}CO_{3(s)}+ H_{2}O_{(g)}}

\ce{2LiOH_{(s)} + CO_{2(g)} -> Li_{2}CO_{3(s)} +H_{2}O_{(g)}}

Also it is worth noting that in this package numbers in chemical formulas are assumed to be subscripts, this saves some typing

\ce{2LiOH_{(s)} +CO2_{(g)} -> Li2CO3_{(s)} +H2O_{(g)}}

share|improve this answer

You could use \rightarrow instead of ->, if that doesn't work.

\ce{2LiOH_{(s)} + CO_{2(g)} {\rightarrow} Li_{2}CO_{3(s)}+ H_{2}O_{(g)}}

Since you are writing chemistry, you might be interested in the command \chemarrow provided by the chemarrow package.

share|improve this answer
    
or maybe \to. –  Martin Scharrer Mar 21 '11 at 20:50
1  
There are a lot of arrows :-) interesting here is that they it should be enclosed within braces to not harm the rest of the equation. –  Stefan Kottwitz Mar 21 '11 at 20:55
    
@Martin: but isn't \to just another name for \rightarrow? –  Gonzalo Medina Mar 21 '11 at 21:08
1  
@Gonzalo: Indeed it is! I didn't know that before. I would prefer it because it is 1) shorter and 2) more logical in this case, because the left side is transformed to the right side :-) –  Martin Scharrer Mar 21 '11 at 21:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.