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'm new to Latex and I'm having some trouble with a simple chemical equation. I have the following code:

\documentclass{article}
\usepackage[version=3]{mhchem} % Package for chemical equation typesetting
\usepackage{amssymb}

\begin{document}
\begin{equation} \ce{N2(g) + 3H2(g) -> 2NH3(g)}} \end{equation}  
$\Delta H_{\mathrm{f}}^\circ = \SI{-92.5}{kJ}$
\end{document}

This prints everything that I need, but on separate lines. I would just like the heat of formation (deltaH=-92.5kj) to be inline with the equation. I've tried multiple approaches, but keep getting stuck. I haven't seen this discussed on TEX or elsewhere.

share|improve this question
    
Welcome to TeX.sx! –  cgnieder Mar 3 at 19:01
    
@Eric Morgan, if one of the solutions below has answered your question, would you consider marking it as solved so other users with the same query can jump to the solution. –  Leeser Mar 21 at 12:17
add comment

3 Answers 3

up vote 10 down vote accepted

You can simply write it inside the equation and maybe add some horizontal space between with \quad or \qquad:

\documentclass{article}
\usepackage[version=3]{mhchem} % Package for chemical equation typesetting
\usepackage{amssymb}
\usepackage{siunitx}
\begin{document}

\begin{equation}
  \ce{N2(g) + 3H2(g) -> 2NH3(g)} \qquad \Delta H_{\mathrm{f}}^\circ = \SI{-92.5}{kJ}
\end{equation}  

\end{document}

enter image description here


An alternative using chemmacros:

\documentclass{article}

\usepackage{chemmacros}

\begin{document}

\begin{equation}
  \ch{N2\gas{} + 3 H2\gas{} -> 2 NH3\gas} \qquad \Enthalpy(f){-92.5}
\end{equation}  

\end{document}

enter image description here

For a non-molar heat of formation it would let you easily define a command \formation:

\documentclass{article}

\usepackage{chemmacros}
\NewChemState\formation[subscript=f]{H}{\kilo\joule}

\begin{document}

\begin{equation}
  \ch{N2\gas{} + 3 H2\gas{} -> 2 NH3\gas} \qquad \formation{-92.5}
\end{equation}  

\end{document}

enter image description here

There are a number of options for customization (e.g. regarding the position of the subscript).

share|improve this answer
add comment

You can use the align environment from »amsmath«. You only need to use \cee for the chemical part of the equation.

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[version=3]{mhchem} % Package for chemical equation typesetting
\usepackage{amsmath}
\usepackage{siunitx}

\begin{document}
  \begin{align}
    \cee{N2(g) + 3H2(g) &-> 2NH3(g)} & \Delta H_{\text{f}}^\circ = \SI{-92.5}{\kilo\joule}
  \end{align}
\end{document}

enter image description here

share|improve this answer
    
Thanks, @Thorsten that worked perfectly. I guess I had the wrong combination of packages. –  Eric Morgan Mar 3 at 19:08
add comment

Use the chemmacros package. Then simply use the command \Enthalpy(f){-92.5}

share|improve this answer
    
Cgnieder's answer is more complete...and addresses the question fully –  Leeser Mar 3 at 20:00
add comment

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.