Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm using the gather environment within the enumerate environment. After creating an item/before entering the gather environment, LaTeX adds a linebreak which I don't like.

\begin{enumerate}[(a)] 
\item 
    \begin{gather*}
    \text{substitution:}\\ % SHOULD BE ON THE SAME LINE AS (a)
    \begin{align*}
    \Rightarrow u(x) &= x  &\Rightarrow v'(x) &= \sin(x)&&\\
    \Rightarrow v(x) &= -\cos(x) &\Rightarrow u'(x) &= 1&&
    \end{align*}\\
    \begin{split}
    \int u(x) \cdot v'(x)  {\mathrm d}x &= u(x) \cdot v(x) - \int u'(x) \cdot v(x)  {\mathrm d}x \\
        &= x \cdot -\cos(x) - \int  -\cos(x)  {\mathrm d}x
    \end{split}\\
    \end{gather*}
\item
    \begin{gather*}
    \text{substitution:}\\
    \begin{align*}
    \Rightarrow u(x) &= (x-2)  &\Rightarrow v'(x) &= {\mathrm e}^{2x}&&\\
    \Rightarrow v(x) &= -\cos(x) &\Rightarrow u'(x) &= 1&&
    \end{align*}\\
    \begin{split}
    \int u(x) \cdot v'(x)  {\mathrm d}x &= u(x) \cdot v(x) - \int u'(x) \cdot v(x)  {\mathrm d}x \\
        &= x \cdot -\cos(x) - \int  -\cos(x)  {\mathrm d}x
    \end{split}\\   
    \end{gather*}
\end{enumerate}

Used packages:

\usepackage{enumerate}
\usepackage{amsfonts,amsthm, mathtools}
\usepackage{amsmath}
share|improve this question
    
You shouldn't be using display environments, but rather $\begin{gathered}[t]...\end{gathered}$. –  egreg Mar 25 '13 at 9:55
    
Welcome to TeX.SX. Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting answers is the preferred way here to say "thank you" to users who helped you. –  Claudio Fiandrino Mar 25 '13 at 9:59
    
You can still use \displaystyle if you need. And the -ed environments take an optional [t] if you want them to be aligned at the top with your enumeration. –  papabravo Mar 25 '13 at 10:02
    
What's the benefit of using the gathered environment over the gatherenvironment? Apparently begin{align} does not work within gathered. –  Patrick Mar 25 '13 at 10:19
1  
all the *ed environments are to be used inside other environments because their bounding box is the size of the content. The other environments take care of spacing around them (among other things) and therefore can not be nested. –  papabravo Mar 25 '13 at 12:03

1 Answer 1

up vote 2 down vote accepted

There are several ways to do what you want; I'll show two, the first one is what I'd prefer.

\documentclass{article}
\usepackage{enumitem}
\usepackage{amsfonts,amsthm, mathtools}
\usepackage{amsmath}

\newcommand{\diff}{\mathop{}\!\mathrm{d}}
\newcommand{\euler}{\mathrm{e}}

\begin{document}
\begin{enumerate}[label=(\alph*)]
\item substitution:
    \begin{gather*}
    \begin{aligned}
    \Rightarrow u(x) &= x  &\Rightarrow v'(x) &= \sin(x)\\
    \Rightarrow v(x) &= -\cos(x) &\Rightarrow u'(x) &= 1
    \end{aligned}\\
    \begin{aligned}
    \int u(x) \cdot v'(x)  \diff x &= u(x) \cdot v(x) - \int u'(x) \cdot v(x) \diff x \\
        &= x \cdot -\cos(x) - \int  -\cos(x) \diff x
    \end{aligned}\\
    \end{gather*}
\item
    $\begin{gathered}[t]
    \text{substitution:}\\
    \begin{aligned}
    \Rightarrow u(x) &= (x-2)  &\Rightarrow v'(x) &= \euler^{2x}\\
    \Rightarrow v(x) &= -\cos(x) &\Rightarrow u'(x) &= 1
    \end{aligned}\\
    \begin{aligned}
    \int u(x) \cdot v'(x) \diff x &= u(x) \cdot v(x) - \int u'(x) \cdot v(x) \diff x \\
        &= x (-\cos(x)) - \int  -\cos(x) \diff x
    \end{aligned}\\
    \end{gathered}$
\end{enumerate}
\end{document}

Notice the definitions that free you from the burden of using \mathrm; by the way you should say \mathrm{e} rather than {\mathrm e}. I've also used enumitem that's much more powerful than enumerate.

enter image description here

share|improve this answer
    
Awesome, thanks (as my reputation doesn't allow me to upvote your answer). Just learned a bunch of useful things! –  Patrick Mar 25 '13 at 10:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.