Adding a formula or formula to a drawing in LaTeX

I have a number in LaTeX with an inscription to which I need to add a formula ( equation*or displaymathenvironment). For example:

\documentclass[12pt]{article}
\begin{document}
\begin{figure}[tbph]
    \begin{center}
        %...
    \end{center}
    \caption{As you can see
            \begin{displaymath}4 \ne 5\end{displaymath}
    }
    \label{fig:somefig}
\end{figure}
\end{document}

This makes pdflatex angry, although it will create PDF.

! Argument of \@caption has an extra }.
<inserted text> 
                \par 
l.9    }

What is the right way to add an equation to a picture title?

NOTE . Please do not suggest just using a math environment $ ... $; the equation shown is a toy example; my real equation is much more complicated.

See also :

+5
source share
2 answers

Using the signature package:

\begin{figure}
\begin{center}
    ...
    \captionsetup{singlelinecheck=off}
    \caption[.]{
    \begin{displaymath}
        assoc\_meaning(\lambda x_{SBJ}. followed(x,y) \&actor(x) \nonumber \&actor(y),\lambda x_{SBJ}. maintained(x,\nonumber <(dist\_from(y),1))
    \end{displaymath}}
\end{center}
\end{figure}

, \caption, , , , , ​​, \usepackage{caption} \captionsetup{...}.

+7

, $ ... $ - ?

, \dfrac \frac.

$ \displaystyle \dfrac{1}{2} \cdot \sum_{i=0}^n i$, .. \displaystyle.

+2

All Articles