Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
ghostanime2001
Posts: 402 Joined: Fri May 20, 2011 9:41 am
Post
by ghostanime2001 » Mon Aug 29, 2011 9:19 pm
I get an error with this code, it says "You can't use 'spacefactor' in vertical mode. How can I fix this? This error appears to stem from using the enumitem package with 'inline' optional argument. But I don't understand how to fix it. Thanks for anyone's help.
Code: Select all
\documentclass{article}
\usepackage{amsmath}
\usepackage[inline]{enumitem}
\usepackage{cancel}
\usepackage[T1]{fontenc}
\usepackage{mathtools}
\usepackage[version=3]{mhchem}
\setlength{\parskip}{0in}
\setlength{\parindent}{0in}
\everymath{\displaystyle}
\begin{document}
\begin{enumerate}
\item \ce{$\underset{\clap{\begin{minipage}[t]{2cm}\vspace{0.5\baselineskip}\centering\scriptsize\textsf{27 g/mol \\ 0.0306 mol}\end{minipage}}}{\ce{2Al}}$ + $\underset{\clap{\begin{minipage}[t]{2cm}\centering\scriptsize\textsf{4.5 g \\ 98.1 g/mol \\ 0.0459 mol}\end{minipage}}}{\ce{Zn(OH)2}}$ -> Al2(SO4)3 + 3H2} \\ \\ \\
$\begin{array}{ll}
n_{\ce{H2SO4}}=\dfrac{\text{4.5 \cancel{g}}}{\text{98.1 \cancel{g}/mol}} &\qquad \begin{aligned}[t]n_{\ce{Al}}&=\smash{\text{0.0459 mol \cancel{\ce{H2SO4}}}\times\dfrac{\text{2 mol Al}}{\text{3 mol \cancel{\ce{H2SO4}}}}} \\ &= \text{0.0306 mol}\end{aligned} \\ \\
&\qquad \begin{aligned}[t]m_{\ce{Al}}&=\text{0.0306 mol $\times$ 27 g/mol} \\ &=\text{0.83 g}\end{aligned}
\end{array}$
\item
\begin{enumerate*}
\item \ce{H2O}
\end{enumerate*}
\end{enumerate}
\end{document}
Last edited by
ghostanime2001 on Mon Aug 29, 2011 9:50 pm, edited 1 time in total.
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide : 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook : 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ : the first book about TikZ for perfect drawings in your LaTeX thesis
Stefan Kottwitz
Site Admin
Posts: 10359 Joined: Mon Mar 10, 2008 9:44 pm
Post
by Stefan Kottwitz » Mon Aug 29, 2011 9:44 pm
Hi,
it's good that you posted a complete example.
I tested it, but there was no error when I compiled. I used enumitem version 3.3 from 2011/07/14. If your version is older, you could update it. You can see the version if you look into the produced .log file and search for enumitem.
Stefan
LaTeX.org admin