Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

problems with displaymath/equation inside caption environment

404 views
Skip to first unread message

Ben Bolker

unread,
Feb 10, 1994, 4:57:14 PM2/10/94
to

I am having some minor problems incorporating an equation in a caption
(LaTeX on TeX 3.0 running on a Sun SPARCStation) ... although the
output produced is actually what I want, so the problem is really just
an annoyance (error messages etc.)

When I try to run a document of the following form through LaTeX, I
get errors (as listed below). I get similar errors using \displaymath
instead of \equation , and it doesn't seem to be a fragile-command problem.

(I've read the LaTeX book and the FAQ list, and not found any answers.
Please forgive me if the answer is obvious.)

Please respond by e-mail if possible.

Thanks.

Ben (b...@eno.princeton.edu)

here's the file:
------------------------------
\documentstyle[11pt]{article}

\begin{document}

Stuff before the figure.
More stuff before the figure.

\begin{figure}
\caption[]{
Stuff before the equation.
\begin{equation}
x = y + z
\end{equation}

Stuff after the equation.
}
\end{figure}

\end{document}
------------------------------
and this is what happens:

This is TeX, C Version 3.0
(test.tex
LaTeX Version 2.09 <7 Dec 1989>
(/usr/princeton/common/lib/tex3.0/inputs/article.sty
Document Style `article' <16 Mar 88>.
(/usr/princeton/common/lib/tex3.0/inputs/art11.sty)) (test.aux)
! You can't use `\eqno' in restricted horizontal mode.
\endequation ->\eqno
\@eqnnum $$\global \@ignoretrue
\end #1->\csname end#1\endcsname
\@checkend {#1}\if@endpe \global \let \@gte...
<argument> ...{equation} x = y + z \end {equation}
Stuff after the equation.
\@makecaption ... \setbox \@tempboxa \hbox {#1: #2
} \ifdim \wd \@tempboxa >\...

\@caption ...fnum@#1\endcsname }{\ignorespaces #3}
\par \endgroup
l.20 }

? [1] (test.aux) )
Output written on test.dvi (1 page, 460 bytes).
Transcript written on test.log.

--
Benjamin Bolker Dep't of Ecology and Evolutionary Biology,
b...@eno.princeton.edu Princeton University

Donald Arseneau

unread,
Feb 11, 1994, 9:44:00 AM2/11/94
to
In article <1994Feb10....@Princeton.EDU>, b...@ash.Princeton.EDU (Ben Bolker) writes...

>I am having some minor problems incorporating an equation in a caption

>(LaTeX ...

That's a result of the poor definition of \@makecaption in the
standard styles. It starts out putting the caption in a horizuntal
save-box, but displayed math is not allowed there. This is a
feature, not a bug, because displayed equations in a caption
are really *bad*.

>output produced is actually what I want,

This is very surprising! Try it with a short caption.

>\begin{equation}

It appears you are even numbering the equation! That number will be
out of order when the figure floats. I do use a version of \@makecaption
that would allow displayed math, but, as a matter of style, my advice
is just: put the displayed equation back in the main text where it
belongs!

Donald Arseneau as...@reg.triumf.ca

0 new messages