Discussion:
Help with amsmath: align not possible?
(too old to reply)
Daniel Barrett
2007-10-26 21:04:54 UTC
Permalink
I'm having a problem with a software package that generates small
LaTeX files like this, for displaying a single math formula:

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\pagestyle{empty}
\begin{document}
$\displaystyle
INSERT MATH FORMULA HERE
$
\end{document}

Unfortunately, whenever the math formula contains a \begin{align}
... \end{align} environment, LaTeX produces this error:

Package amsmath Error: \begin{align} allowed only in paragraph mode.

Is there a better set of LaTeX commands to generate instead of the
above, so this error does not occur? (Removing the three usepackage
lines eliminates the error, but we do want to use amsmath.)

FYI, this is part of a mathematics renderer for MediaWiki: it produces
a single math formula, converts it to PNG format, and embeds it in the
wiki page.

Thank you,

--
Dan Barrett
***@blazemonger.com
Joseph Wright
2007-10-26 21:11:21 UTC
Permalink
Post by Daniel Barrett
I'm having a problem with a software package that generates small
\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\pagestyle{empty}
\begin{document}
$\displaystyle
INSERT MATH FORMULA HERE
$
\end{document}
Unfortunately, whenever the math formula contains a \begin{align}
Package amsmath Error: \begin{align} allowed only in paragraph mode.
Is there a better set of LaTeX commands to generate instead of the
above, so this error does not occur? (Removing the three usepackage
lines eliminates the error, but we do want to use amsmath.)
FYI, this is part of a mathematics renderer for MediaWiki: it produces
a single math formula, converts it to PNG format, and embeds it in the
wiki page.
Thank you,
--
Dan Barrett
What is wrong with:

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\pagestyle{empty}
\begin{document}
\begin{align}
INSERT MATH FORMULA HERE
\end{align}
\end{document}

Joseph Wright
G. A. Edgar
2007-10-26 21:35:10 UTC
Permalink
Post by Daniel Barrett
I'm having a problem with a software package that generates small
\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\pagestyle{empty}
\begin{document}
$\displaystyle
INSERT MATH FORMULA HERE
$
\end{document}
Unfortunately, whenever the math formula contains a \begin{align}
Package amsmath Error: \begin{align} allowed only in paragraph mode.
Is there a better set of LaTeX commands to generate instead of the
above, so this error does not occur? (Removing the three usepackage
lines eliminates the error, but we do want to use amsmath.)
FYI, this is part of a mathematics renderer for MediaWiki: it produces
a single math formula, converts it to PNG format, and embeds it in the
wiki page.
Thank you,
--
Dan Barrett
Do not put \begin{align} \end{align} inside of $ $ .
Also, the align environment is automatically in displaystyle .
--
G. A. Edgar http://www.math.ohio-state.edu/~edgar/
Steve Mayer
2007-10-27 11:24:07 UTC
Permalink
Post by Daniel Barrett
$\displaystyle
INSERT MATH FORMULA HERE
$
FYI, this is part of a mathematics renderer for MediaWiki: it produces
a single math formula, converts it to PNG format, and embeds it in the
wiki page.
Do not put \begin{align} \end{align} inside of $ $ .
Also, the align environment is automatically in displaystyle .
The problem is that you are using a renderer which automatically puts the
code between $...$ and maybe adds \displaystyle as well. You could either
parse the code so as not to use $...$ whenever you use align or similar
environments or, more simply, just add \par just before \begin{align} (this
could be automated). This works by forcing LaTeX itself to deal with the
error and add its own $ cancelling out the ones that shouldn't be there if
you see what I mean.

Steve Mayer

Loading...