8

I want to add an equation number in a formula, but I've got an error: "You can't use `\eqno' in math mode.". This is my code:

$e_{33} = 0 \eqno(4.4)$

How I can fix it?

4
  • 2
    Why not use some display-math environment, such as equation?
    – jub0bs
    Commented May 6, 2013 at 16:02
  • Which format are you using (LaTeX or plain TeX)? There are environments in LaTeX for displayed equations with equation number (e.g. equation). In plain TeX $$...$$ is used. Or do you want to number a equation inside a text paragraph? Commented May 6, 2013 at 16:02
  • I want to number equation inside text paragraph. Is it possible?
    – Edvard
    Commented May 6, 2013 at 16:09
  • \documentclass[a4paper,14pt]{extarticle} \begin{document} $e_{33} = 0\ \eqno(4.4)$ \end{document}
    – Edvard
    Commented May 6, 2013 at 16:14

1 Answer 1

14

I don't think numbering inline-math equations is wise, because

  • It might be difficult for your readers to locate those numbered inline equations in a block of text; inline math doesn't stand out as much from the main text as display math does.
  • The equation number, since it does not get flushed to the right (as it does by default in display math), may be mistakenly interpreted as part of the inline equation itself.

However, you could do the following:

\documentclass{article}
\usepackage{amsmath}
\newcommand\inlineeqno{\stepcounter{equation}\ (\theequation)}
\begin{document}
$e_{33} = 0 \inlineeqno$
\end{document}

enter image description here

6
  • 1
    Thanks a lot. But why it is unwise?
    – Edvard
    Commented May 6, 2013 at 16:18
  • Is it possible to make this command parameterized. For using like this \inlineeqno(4.4)?
    – Edvard
    Commented May 6, 2013 at 16:20
  • I'm not sure I understand. Do you want to number the inline equation manually? In that case, you can just typeset "(4.4)" after it, but you'd be losing the benefits of automating equation numbering made possible by the equation counter.
    – jub0bs
    Commented May 6, 2013 at 16:23
  • 7
    @Edvard: do not use $$ $$ (see Why is [ … ] preferable to $$ … $$?). Moreover, you don't have to specify the equation number: LaTeX itself does this work for you (i.e. try \begin{equation}e_{33} = 0\end{equation}). Commented May 6, 2013 at 16:50
  • 2
    @Jubobs how can one reference an inline equation using your command \inlineeqno?
    – Vlad
    Commented Mar 22, 2016 at 10:22

Not the answer you're looking for? Browse other questions tagged .