4

I would like to itemize some equations but they don't appear on the same line as the bullets.

Here is a code example

\documentclass[11pt,a4paper]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}

\begin{document}

\begin{description}
    \item[i) ] foo foo foo foo
        \begin{equation}
            a^2 + b^2 = c^2
        \end{equation}
    \item[ii)] 
        \begin{equation}
            x^2 + y^2 = z^2 
        \end{equation}
\end{description}

\end{document}

Is it possible to write the second equation next to the description so that it looks like this:

ii) x^2 + y^2 = z^2                              (numberOfEq2)

3 Answers3

3

Here is a way:

\documentclass[11pt,a4paper]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}

\begin{document}

\begin{description}
    \item[i) ] foo foo foo foo
        \begin{equation}
            a^2 + b^2 = c^2
        \end{equation}
    \item[ii)]\leavevmode\vspace*{-\baselineskip}
        \begin{equation}x^2 + y^2 = z^2 \end{equation}
\end{description}

\end{document} 

enter image description here

Bernard
  • 271,350
  • 1
    \leavevmode\vspace*{-\baselineskip} will not work properly if the equation is high: a \frac, for instance, will shift the equation downwards. The solution proposed by Philippe Goutet in vertical-alignment-of-align-in-enumerate seems to always provide the right alignment between the \item and the equation (with maybe a \vspace{-\baselineskip} before the \item to avoid an excessive space above). Contrary to the solution with \inlineequation by cryingshadow, it also works with multiline equations. – Michel Fioc Dec 04 '15 at 14:50
1

Based on this answer by Heiko Oberdiek, you can use an \inlineequation:

\documentclass[11pt,a4paper]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}

\makeatletter
\newcommand*{\inlineequation}[2][]{%
  \begingroup
    % Put \refstepcounter at the beginning, because
    % package `hyperref' sets the anchor here.
    \refstepcounter{equation}%
    \ifx\\#1\\%
    \else
      \label{#1}%
    \fi
    % prevent line breaks inside equation
    \relpenalty=10000 %
    \binoppenalty=10000 %
    \ensuremath{%
      % \displaystyle % larger fractions, ...
      #2%
    }%
    \hfill\@eqnnum
  \endgroup
}
\makeatother

\usepackage{hyperref}

\begin{document}

\begin{description}
    \item[i) ] foo foo foo foo \inlineequation{a^2 + b^2 = c^2}
    \item[ii)] \inlineequation{x^2 + y^2 = z^2}
\end{description}

\end{document}
cryingshadow
  • 2,350
  • Thanks for your answer but the solution to my answer would be a "combination" of yours and the answer of Bernard: – Rorschach Dec 04 '15 at 12:34
  • What exactly would you like to combine? More space between the equation and its number? – cryingshadow Dec 04 '15 at 12:38
  • Thank you, but I want a combination of your answer and the one of Bernard: the equation should start next to the description "ii)" but at the same time the number of equations should be one above the other - how to do that? – Rorschach Dec 04 '15 at 12:41
  • I adapted my solution to align the equation numbers to the right. – cryingshadow Dec 04 '15 at 12:49
  • 1
    This will not work for multiline equations. See my comment to Bernard's answer for a link to a more general solution. – Michel Fioc Dec 04 '15 at 14:53
  • @MichelFioc Great link. So do you consider the question as a duplicate? I see that there are already two more questions marked as related (but not the same). – cryingshadow Dec 04 '15 at 15:08
  • @cryingshadow This question has been asked so many times that finding the best answer among all of them is nearly impossible. Marking it as a duplicate will not change this, especially since the answer given by Philippe Goutet in the link I gave is not the accepted one. As this is obviously a problem for many people, TeX stack exchange managers might maybe try to make Philippe Goutet's answer more prominent, but I don't know how. – Michel Fioc Dec 04 '15 at 15:22
0

May be this is what you want,

\documentclass[11pt,a4paper]{scrbook}
\usepackage{amsmath}

\begin{document}

May be this is what you want,

\begin{eqnarray}
 && \text{i)  Foo foo foo,} \hspace{2mm}    a^2 + b^2 = c^2    \\
 && \text{ii) Foo foo foo,} \hspace{2mm}    x^2 + y^2 = z^2        
\end{eqnarray}


\end{document}

Here is my output,

enter image description here

ddas
  • 1,205