5

Hi I wish to number equations with a list environment

\begin{itemize}
\item Lol
\begin{equation}
y_t=h_t(\hat{x}_{t|t-1})
\end{equation}
\end{itemize}

I want y_t=h_t(\hat{x}_{t|t-1}) in the same line of Lol... Can you help me to find out a way?

lockstep
  • 250,273
Kevin
  • 429
  • 1
    In the same line? Just write inline formula with $ $. You can not number an inline expression. – Sigur Dec 31 '12 at 11:07

3 Answers3

3

This probably works really bad in a lot of cases:

enter image description here

\documentclass{article}
\newcommand{\listequationnumber}{\refstepcounter{equation}(\theequation)}
\newcommand{\listequation}[1]{\hfill$\displaystyle #1$\hfill\listequationnumber}

\begin{document}
First an equation.
\begin{equation}
f(x) = \sin(x)
\end{equation}
Then a list.
\begin{itemize}
\item Lol \listequation{y_t=h_t(\hat{x}_{t|t-1})}
\item Hackety hack. \listequation{a = b}
\end{itemize}
And another equation.
\begin{equation}
 g(x) = \cos(x)
\end{equation}

\end{document}
Torbjørn T.
  • 206,688
  • This solved my question.. But is there any way to improve the equation alignment? Thank you so much! – Kevin Dec 31 '12 at 12:57
3

This has good alignments, but the text part of item (Lol and Hackety hack.) shouldn't be too large:

\documentclass{article}


\begin{document}
First an equation.
\begin{equation}
f(x) = \sin(x)
\end{equation}
Then a list.
\begin{itemize}
\item Lol \hfill \makebox[0pt][r]{%
            \begin{minipage}[b]{\textwidth}
              \begin{equation}
                 y_t=h_t(\hat{x}_{t|t-1})
              \end{equation}
          \end{minipage}}
\item Hackety hack. \hfill \makebox[0pt][r]{%
            \begin{minipage}[b]{\textwidth}
              \begin{equation}
                 a = b
              \end{equation}
          \end{minipage}}
\end{itemize}
And another equation.
\begin{equation}
 g(x) = \cos(x)
\end{equation}

\end{document}

enter image description here

0

You can use the paralist package, especially the inparaenum environment should be what you are looking for.

Code

\documentclass{article}
\usepackage{paralist}

\begin{document}
\begin{inparaenum}[(1)]
\item lol
\item $y_t=h_t(\hat{x}_{t|t-1})$
\item lol
\end{inparaenum}
\end{document}

Output

Output

rtzll
  • 5,531
  • Oh, nice. But the equation is not numbered using the equation counter, is it? The number comes from the list. – Sigur Dec 31 '12 at 11:32
  • @Sigur that's right, if the equation numbering must come through the equation environment, your comment holds true, at least to my knowledge one can't number inline expressions. – rtzll Dec 31 '12 at 11:39
  • Thanks but the equation is not numbered using the equation counter, so this don't answer my question... – Kevin Dec 31 '12 at 11:48